| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 void SimulateTouchGestureWithMouse( | 174 void SimulateTouchGestureWithMouse( |
| 175 const MouseEventWithLatencyInfo& mouse_event); | 175 const MouseEventWithLatencyInfo& mouse_event); |
| 176 | 176 |
| 177 // Called when a touch timeout-affecting bit has changed, in turn toggling the | 177 // Called when a touch timeout-affecting bit has changed, in turn toggling the |
| 178 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input | 178 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input |
| 179 // to that determination includes current view properties, the allowed touch | 179 // to that determination includes current view properties, the allowed touch |
| 180 // action and the command-line configured |touch_ack_timeout_supported_|. | 180 // action and the command-line configured |touch_ack_timeout_supported_|. |
| 181 void UpdateTouchAckTimeoutEnabled(); | 181 void UpdateTouchAckTimeoutEnabled(); |
| 182 | 182 |
| 183 // If a flush has been requested, signals a completed flush to the client if |
| 184 // all events have been dispatched (i.e., |HasPendingEvents()| is false). |
| 185 void SignalFlushedIfNecessary(); |
| 186 |
| 187 bool HasPendingEvents() const; |
| 188 |
| 183 bool IsInOverscrollGesture() const; | 189 bool IsInOverscrollGesture() const; |
| 184 | 190 |
| 185 int routing_id() const { return routing_id_; } | 191 int routing_id() const { return routing_id_; } |
| 186 | 192 |
| 187 | 193 |
| 188 IPC::Sender* sender_; | 194 IPC::Sender* sender_; |
| 189 InputRouterClient* client_; | 195 InputRouterClient* client_; |
| 190 InputAckHandler* ack_handler_; | 196 InputAckHandler* ack_handler_; |
| 191 int routing_id_; | 197 int routing_id_; |
| 192 | 198 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 208 | 214 |
| 209 // The next mouse move event to send (only non-null while mouse_move_pending_ | 215 // The next mouse move event to send (only non-null while mouse_move_pending_ |
| 210 // is true). | 216 // is true). |
| 211 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_; | 217 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_; |
| 212 | 218 |
| 213 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent | 219 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent |
| 214 // and we are waiting for a corresponding ack. | 220 // and we are waiting for a corresponding ack. |
| 215 bool mouse_wheel_pending_; | 221 bool mouse_wheel_pending_; |
| 216 MouseWheelEventWithLatencyInfo current_wheel_event_; | 222 MouseWheelEventWithLatencyInfo current_wheel_event_; |
| 217 | 223 |
| 218 typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue; | |
| 219 | |
| 220 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send. | 224 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send. |
| 221 // Unlike mouse moves, mouse wheel events received while one is pending are | 225 // Unlike mouse moves, mouse wheel events received while one is pending are |
| 222 // coalesced (by accumulating deltas) if they match the previous event in | 226 // coalesced (by accumulating deltas) if they match the previous event in |
| 223 // modifiers. On the Mac, in particular, mouse wheel events are received at a | 227 // modifiers. On the Mac, in particular, mouse wheel events are received at a |
| 224 // high rate; not waiting for the ack results in jankiness, and using the same | 228 // high rate; not waiting for the ack results in jankiness, and using the same |
| 225 // mechanism as for mouse moves (just dropping old events when multiple ones | 229 // mechanism as for mouse moves (just dropping old events when multiple ones |
| 226 // would be queued) results in very slow scrolling. | 230 // would be queued) results in very slow scrolling. |
| 231 typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue; |
| 227 WheelEventQueue coalesced_mouse_wheel_events_; | 232 WheelEventQueue coalesced_mouse_wheel_events_; |
| 228 | 233 |
| 229 // The time when an input event was sent to the RenderWidget. | 234 // The time when an input event was sent to the RenderWidget. |
| 230 base::TimeTicks input_event_start_time_; | 235 base::TimeTicks input_event_start_time_; |
| 231 | 236 |
| 232 // Queue of keyboard events that we need to track. | |
| 233 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; | |
| 234 | |
| 235 // A queue of keyboard events. We can't trust data from the renderer so we | 237 // A queue of keyboard events. We can't trust data from the renderer so we |
| 236 // stuff key events into a queue and pop them out on ACK, feeding our copy | 238 // stuff key events into a queue and pop them out on ACK, feeding our copy |
| 237 // back to whatever unhandled handler instead of the returned version. | 239 // back to whatever unhandled handler instead of the returned version. |
| 240 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; |
| 238 KeyQueue key_queue_; | 241 KeyQueue key_queue_; |
| 239 | 242 |
| 240 // Whether touch ack timeout handling has been enabled via the command line. | 243 // Whether touch ack timeout handling has been enabled via the command line. |
| 241 bool touch_ack_timeout_supported_; | 244 bool touch_ack_timeout_supported_; |
| 242 base::TimeDelta touch_ack_timeout_delay_; | 245 base::TimeDelta touch_ack_timeout_delay_; |
| 243 | 246 |
| 244 // Cached flags from |OnViewUpdated()|, defaults to 0. | 247 // Cached flags from |OnViewUpdated()|, defaults to 0. |
| 245 int current_view_flags_; | 248 int current_view_flags_; |
| 246 | 249 |
| 247 // The source of the ack within the scope of |ProcessInputEventAck()|. | 250 // The source of the ack within the scope of |ProcessInputEventAck()|. |
| 248 // Defaults to ACK_SOURCE_NONE. | 251 // Defaults to ACK_SOURCE_NONE. |
| 249 AckSource current_ack_source_; | 252 AckSource current_ack_source_; |
| 250 | 253 |
| 254 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
| 255 // to the client_ after all events have been dispatched/acked. |
| 256 bool flush_requested_; |
| 257 |
| 251 scoped_ptr<TouchEventQueue> touch_event_queue_; | 258 scoped_ptr<TouchEventQueue> touch_event_queue_; |
| 252 scoped_ptr<GestureEventQueue> gesture_event_queue_; | 259 scoped_ptr<GestureEventQueue> gesture_event_queue_; |
| 253 TouchActionFilter touch_action_filter_; | 260 TouchActionFilter touch_action_filter_; |
| 254 InputEventStreamValidator event_stream_validator_; | 261 InputEventStreamValidator event_stream_validator_; |
| 255 | 262 |
| 256 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 263 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
| 257 }; | 264 }; |
| 258 | 265 |
| 259 } // namespace content | 266 } // namespace content |
| 260 | 267 |
| 261 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 268 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
| OLD | NEW |