| 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_INPUT_ROUTER_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 }; | 49 }; |
| 50 | 50 |
| 51 InputRouterImpl(IPC::Sender* sender, | 51 InputRouterImpl(IPC::Sender* sender, |
| 52 InputRouterClient* client, | 52 InputRouterClient* client, |
| 53 InputAckHandler* ack_handler, | 53 InputAckHandler* ack_handler, |
| 54 int routing_id, | 54 int routing_id, |
| 55 const Config& config); | 55 const Config& config); |
| 56 ~InputRouterImpl() override; | 56 ~InputRouterImpl() override; |
| 57 | 57 |
| 58 // InputRouter | 58 // InputRouter |
| 59 void Flush() override; | |
| 60 bool SendInput(scoped_ptr<IPC::Message> message) override; | 59 bool SendInput(scoped_ptr<IPC::Message> message) override; |
| 61 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override; | 60 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override; |
| 62 void SendWheelEvent( | 61 void SendWheelEvent( |
| 63 const MouseWheelEventWithLatencyInfo& wheel_event) override; | 62 const MouseWheelEventWithLatencyInfo& wheel_event) override; |
| 64 void SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, | 63 void SendKeyboardEvent(const NativeWebKeyboardEvent& key_event, |
| 65 const ui::LatencyInfo& latency_info, | 64 const ui::LatencyInfo& latency_info, |
| 66 bool is_keyboard_shortcut) override; | 65 bool is_keyboard_shortcut) override; |
| 67 void SendGestureEvent( | 66 void SendGestureEvent( |
| 68 const GestureEventWithLatencyInfo& gesture_event) override; | 67 const GestureEventWithLatencyInfo& gesture_event) override; |
| 69 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override; | 68 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override; |
| 70 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; | 69 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; |
| 71 void OnViewUpdated(int view_flags) override; | 70 void OnViewUpdated(int view_flags) override; |
| 71 void RequestNotificationWhenFlushed() override; |
| 72 bool HasPendingEvents() const override; | 72 bool HasPendingEvents() const override; |
| 73 | 73 |
| 74 // IPC::Listener | 74 // IPC::Listener |
| 75 bool OnMessageReceived(const IPC::Message& message) override; | 75 bool OnMessageReceived(const IPC::Message& message) override; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 friend class InputRouterImplTest; | 78 friend class InputRouterImplTest; |
| 79 | 79 |
| 80 // TouchpadTapSuppressionControllerClient | 80 // TouchpadTapSuppressionControllerClient |
| 81 void SendMouseEventImmediately( | 81 void SendMouseEventImmediately( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 const ui::LatencyInfo& latency_info, | 123 const ui::LatencyInfo& latency_info, |
| 124 bool is_keyboard_shortcut); | 124 bool is_keyboard_shortcut); |
| 125 | 125 |
| 126 // IPC message handlers | 126 // IPC message handlers |
| 127 void OnInputEventAck(const InputHostMsg_HandleInputEvent_ACK_Params& ack); | 127 void OnInputEventAck(const InputHostMsg_HandleInputEvent_ACK_Params& ack); |
| 128 void OnDidOverscroll(const DidOverscrollParams& params); | 128 void OnDidOverscroll(const DidOverscrollParams& params); |
| 129 void OnMsgMoveCaretAck(); | 129 void OnMsgMoveCaretAck(); |
| 130 void OnSelectMessageAck(); | 130 void OnSelectMessageAck(); |
| 131 void OnHasTouchEventHandlers(bool has_handlers); | 131 void OnHasTouchEventHandlers(bool has_handlers); |
| 132 void OnSetTouchAction(TouchAction touch_action); | 132 void OnSetTouchAction(TouchAction touch_action); |
| 133 void OnFlingingStopped(); |
| 133 | 134 |
| 134 // Indicates the source of an ack provided to |ProcessInputEventAck()|. | 135 // Indicates the source of an ack provided to |ProcessInputEventAck()|. |
| 135 // The source is tracked by |current_ack_source_|, which aids in ack routing. | 136 // The source is tracked by |current_ack_source_|, which aids in ack routing. |
| 136 enum AckSource { | 137 enum AckSource { |
| 137 RENDERER, | 138 RENDERER, |
| 138 CLIENT, | 139 CLIENT, |
| 139 IGNORING_DISPOSITION, | 140 IGNORING_DISPOSITION, |
| 140 ACK_SOURCE_NONE | 141 ACK_SOURCE_NONE |
| 141 }; | 142 }; |
| 142 // Note: This function may result in |this| being deleted, and as such | 143 // Note: This function may result in |this| being deleted, and as such |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input | 175 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input |
| 175 // to that determination includes current view properties and the allowed | 176 // to that determination includes current view properties and the allowed |
| 176 // touch action. Note that this will only affect platforms that have a | 177 // touch action. Note that this will only affect platforms that have a |
| 177 // non-zero touch timeout configuration. | 178 // non-zero touch timeout configuration. |
| 178 void UpdateTouchAckTimeoutEnabled(); | 179 void UpdateTouchAckTimeoutEnabled(); |
| 179 | 180 |
| 180 // If a flush has been requested, signals a completed flush to the client if | 181 // If a flush has been requested, signals a completed flush to the client if |
| 181 // all events have been dispatched (i.e., |HasPendingEvents()| is false). | 182 // all events have been dispatched (i.e., |HasPendingEvents()| is false). |
| 182 void SignalFlushedIfNecessary(); | 183 void SignalFlushedIfNecessary(); |
| 183 | 184 |
| 184 bool IsInOverscrollGesture() const; | |
| 185 | |
| 186 int routing_id() const { return routing_id_; } | 185 int routing_id() const { return routing_id_; } |
| 187 | 186 |
| 188 | 187 |
| 189 IPC::Sender* sender_; | 188 IPC::Sender* sender_; |
| 190 InputRouterClient* client_; | 189 InputRouterClient* client_; |
| 191 InputAckHandler* ack_handler_; | 190 InputAckHandler* ack_handler_; |
| 192 int routing_id_; | 191 int routing_id_; |
| 193 | 192 |
| 194 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK | 193 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK |
| 195 // or MoveRangeSelectionExtent_ACK. | 194 // or MoveRangeSelectionExtent_ACK. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 int current_view_flags_; | 240 int current_view_flags_; |
| 242 | 241 |
| 243 // The source of the ack within the scope of |ProcessInputEventAck()|. | 242 // The source of the ack within the scope of |ProcessInputEventAck()|. |
| 244 // Defaults to ACK_SOURCE_NONE. | 243 // Defaults to ACK_SOURCE_NONE. |
| 245 AckSource current_ack_source_; | 244 AckSource current_ack_source_; |
| 246 | 245 |
| 247 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | 246 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
| 248 // to the client_ after all events have been dispatched/acked. | 247 // to the client_ after all events have been dispatched/acked. |
| 249 bool flush_requested_; | 248 bool flush_requested_; |
| 250 | 249 |
| 250 // Whether there are any active flings in the renderer. As the fling |
| 251 // end notification is asynchronous, we use a count rather than a boolean |
| 252 // to avoid races in bookkeeping when starting a new fling. |
| 253 int active_fling_count_; |
| 254 |
| 251 TouchEventQueue touch_event_queue_; | 255 TouchEventQueue touch_event_queue_; |
| 252 GestureEventQueue gesture_event_queue_; | 256 GestureEventQueue gesture_event_queue_; |
| 253 TouchActionFilter touch_action_filter_; | 257 TouchActionFilter touch_action_filter_; |
| 254 InputEventStreamValidator input_stream_validator_; | 258 InputEventStreamValidator input_stream_validator_; |
| 255 InputEventStreamValidator output_stream_validator_; | 259 InputEventStreamValidator output_stream_validator_; |
| 256 | 260 |
| 257 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 261 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
| 258 }; | 262 }; |
| 259 | 263 |
| 260 } // namespace content | 264 } // namespace content |
| 261 | 265 |
| 262 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 266 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
| OLD | NEW |