Home | History | Annotate | Download | only in in_process
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_INPUT_EVENT_FILTER_H_
      6 #define CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_INPUT_EVENT_FILTER_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/callback.h"
     10 #include "base/compiler_specific.h"
     11 #include "content/port/common/input_event_ack_state.h"
     12 #include "content/renderer/gpu/input_handler_manager_client.h"
     13 #include "ui/gfx/vector2d_f.h"
     14 
     15 namespace WebKit {
     16 class WebInputEvent;
     17 }
     18 
     19 namespace content {
     20 
     21 // This class perform synchronous, in-process InputEvent handling.
     22 //
     23 // The provided |handler| process WebInputEvents synchronously on the merged
     24 // UI and compositing thread. If the event goes unhandled, that is reflected in
     25 // the InputEventAckState; no forwarding is performed.
     26 class SynchronousInputEventFilter : public InputHandlerManagerClient {
     27  public:
     28   SynchronousInputEventFilter();
     29   virtual ~SynchronousInputEventFilter();
     30 
     31   InputEventAckState HandleInputEvent(int routing_id,
     32                                       const WebKit::WebInputEvent& input_event);
     33 
     34   // InputHandlerManagerClient implementation.
     35   virtual void SetBoundHandler(const Handler& handler) OVERRIDE;
     36   virtual void DidAddInputHandler(int routing_id,
     37                                   cc::InputHandler* input_handler) OVERRIDE;
     38   virtual void DidRemoveInputHandler(int routing_id) OVERRIDE;
     39   virtual void DidOverscroll(int routing_id,
     40                              const cc::DidOverscrollParams& params) OVERRIDE;
     41 
     42  private:
     43   void SetBoundHandlerOnUIThread(const Handler& handler);
     44 
     45   Handler handler_;
     46 };
     47 
     48 }  // namespace content
     49 
     50 #endif  // CONTENT_BROWSER_ANDROID_IN_PROCESS_SYNCHRONOUS_INPUT_EVENT_FILTER_H_
     51