| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "content/browser/renderer_host/input/fling/flinger.h" | 13 #include "content/browser/renderer_host/input/fling/flinger.h" |
| 14 #include "content/browser/renderer_host/input/gesture_event_filter_client.h" | 14 #include "content/browser/renderer_host/input/gesture_event_filter_client.h" |
| 15 #include "content/browser/renderer_host/input/input_router.h" | 15 #include "content/browser/renderer_host/input/input_router.h" |
| 16 #include "content/browser/renderer_host/input/touch_event_queue.h" | 16 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | |
| 18 #include "content/public/browser/native_web_keyboard_event.h" | 17 #include "content/public/browser/native_web_keyboard_event.h" |
| 19 | 18 |
| 20 namespace IPC { | 19 namespace IPC { |
| 21 class Sender; | 20 class Sender; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace ui { | 23 namespace ui { |
| 25 struct LatencyInfo; | 24 struct LatencyInfo; |
| 26 } | 25 } |
| 27 | 26 |
| 28 namespace content { | 27 namespace content { |
| 29 class BaseGestureEventFilter; | 28 class BaseGestureEventFilter; |
| 30 class InputAckHandler; | 29 class InputAckHandler; |
| 31 class InputRouterClient; | 30 class InputRouterClient; |
| 32 class OverscrollController; | 31 class OverscrollController; |
| 33 class RenderWidgetHostImpl; | 32 class RenderWidgetHostImpl; |
| 34 | 33 |
| 35 // A default implementation for browser input event routing. Input commands are | 34 // A default implementation for browser input event routing. Input commands are |
| 36 // forwarded to the renderer immediately upon receipt. | 35 // forwarded to the renderer immediately upon receipt. |
| 37 class CONTENT_EXPORT ImmediateInputRouter | 36 class CONTENT_EXPORT ImmediateInputRouter |
| 38 : public NON_EXPORTED_BASE(InputRouter), | 37 : public NON_EXPORTED_BASE(InputRouter), |
| 39 public NON_EXPORTED_BASE(GestureEventFilterClient), | 38 public NON_EXPORTED_BASE(GestureEventFilterClient), |
| 40 public NON_EXPORTED_BASE(TouchEventQueueClient), | 39 public NON_EXPORTED_BASE(TouchEventQueueClient), |
| 41 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient), | |
| 42 public NON_EXPORTED_BASE(FlingHelper) { | 40 public NON_EXPORTED_BASE(FlingHelper) { |
| 43 public: | 41 public: |
| 44 ImmediateInputRouter(IPC::Sender* sender, | 42 ImmediateInputRouter(IPC::Sender* sender, |
| 45 InputRouterClient* client, | 43 InputRouterClient* client, |
| 46 InputAckHandler* ack_handler, | 44 InputAckHandler* ack_handler, |
| 47 int routing_id); | 45 int routing_id); |
| 48 virtual ~ImmediateInputRouter(); | 46 virtual ~ImmediateInputRouter(); |
| 49 | 47 |
| 50 // InputRouter | 48 // InputRouter |
| 51 virtual void Flush() OVERRIDE; | 49 virtual void Flush() OVERRIDE; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 65 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const OVERRIDE; | 63 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const OVERRIDE; |
| 66 virtual bool ShouldForwardTouchEvent() const OVERRIDE; | 64 virtual bool ShouldForwardTouchEvent() const OVERRIDE; |
| 67 | 65 |
| 68 // IPC::Listener | 66 // IPC::Listener |
| 69 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 67 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 70 | 68 |
| 71 private: | 69 private: |
| 72 friend class ImmediateInputRouterTest; | 70 friend class ImmediateInputRouterTest; |
| 73 friend class MockRenderWidgetHost; | 71 friend class MockRenderWidgetHost; |
| 74 | 72 |
| 75 // TouchpadTapSuppressionControllerClient | |
| 76 virtual void SendMouseEventImmediately( | 73 virtual void SendMouseEventImmediately( |
| 77 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; | 74 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
| 78 | 75 |
| 79 // TouchEventQueueClient | 76 // TouchEventQueueClient |
| 80 virtual void SendTouchEventImmediately( | 77 virtual void SendTouchEventImmediately( |
| 81 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; | 78 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; |
| 82 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 79 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
| 83 InputEventAckState ack_result) OVERRIDE; | 80 InputEventAckState ack_result) OVERRIDE; |
| 84 | 81 |
| 85 // GetureEventFilterClient | 82 // GetureEventFilterClient |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 | 167 |
| 171 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); | 168 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); |
| 172 | 169 |
| 173 void SimulateTouchGestureWithMouse( | 170 void SimulateTouchGestureWithMouse( |
| 174 const MouseEventWithLatencyInfo& mouse_event); | 171 const MouseEventWithLatencyInfo& mouse_event); |
| 175 | 172 |
| 176 bool IsInOverscrollGesture() const; | 173 bool IsInOverscrollGesture() const; |
| 177 | 174 |
| 178 int routing_id() const { return routing_id_; } | 175 int routing_id() const { return routing_id_; } |
| 179 | 176 |
| 180 BaseGestureEventFilter* gesture_event_filter(); | |
| 181 | |
| 182 IPC::Sender* sender_; | 177 IPC::Sender* sender_; |
| 183 InputRouterClient* client_; | 178 InputRouterClient* client_; |
| 184 InputAckHandler* ack_handler_; | 179 InputAckHandler* ack_handler_; |
| 185 int routing_id_; | 180 int routing_id_; |
| 186 | 181 |
| 187 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. | 182 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. |
| 188 bool select_range_pending_; | 183 bool select_range_pending_; |
| 189 | 184 |
| 190 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. | 185 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. |
| 191 scoped_ptr<IPC::Message> next_selection_range_; | 186 scoped_ptr<IPC::Message> next_selection_range_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // not sent to the renderer. | 231 // not sent to the renderer. |
| 237 bool has_touch_handler_; | 232 bool has_touch_handler_; |
| 238 | 233 |
| 239 // The source of the ack within the scope of |ProcessInputEventAck()|. | 234 // The source of the ack within the scope of |ProcessInputEventAck()|. |
| 240 // Defaults to ACK_SOURCE_NONE. | 235 // Defaults to ACK_SOURCE_NONE. |
| 241 AckSource current_ack_source_; | 236 AckSource current_ack_source_; |
| 242 | 237 |
| 243 scoped_ptr<TouchEventQueue> touch_event_queue_; | 238 scoped_ptr<TouchEventQueue> touch_event_queue_; |
| 244 scoped_ptr<Flinger> flinger_; | 239 scoped_ptr<Flinger> flinger_; |
| 245 | 240 |
| 246 class EventFilteringHelper; | 241 scoped_ptr<BaseGestureEventFilter> event_filter_; |
| 247 scoped_ptr<EventFilteringHelper> event_filter_; | |
| 248 | 242 |
| 249 enum InputMessageSource { | 243 enum InputMessageSource { |
| 250 MESSAGE_SOURCE_FLING, | 244 MESSAGE_SOURCE_FLING, |
| 251 MESSAGE_SOURCE_REGULAR, | 245 MESSAGE_SOURCE_REGULAR, |
| 252 }; | 246 }; |
| 253 | 247 |
| 254 std::queue<InputMessageSource> in_process_messages_sources_; | 248 std::queue<InputMessageSource> in_process_messages_sources_; |
| 255 | 249 |
| 256 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); | 250 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); |
| 257 }; | 251 }; |
| 258 | 252 |
| 259 } // namespace content | 253 } // namespace content |
| 260 | 254 |
| 261 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 255 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
| OLD | NEW |