| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override; | 66 void SendMouseEvent(const MouseEventWithLatencyInfo& mouse_event) override; |
| 67 void SendWheelEvent( | 67 void SendWheelEvent( |
| 68 const MouseWheelEventWithLatencyInfo& wheel_event) override; | 68 const MouseWheelEventWithLatencyInfo& wheel_event) override; |
| 69 void SendKeyboardEvent( | 69 void SendKeyboardEvent( |
| 70 const NativeWebKeyboardEventWithLatencyInfo& key_event) override; | 70 const NativeWebKeyboardEventWithLatencyInfo& key_event) override; |
| 71 void SendGestureEvent( | 71 void SendGestureEvent( |
| 72 const GestureEventWithLatencyInfo& gesture_event) override; | 72 const GestureEventWithLatencyInfo& gesture_event) override; |
| 73 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override; | 73 void SendTouchEvent(const TouchEventWithLatencyInfo& touch_event) override; |
| 74 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; | 74 const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; |
| 75 void NotifySiteIsMobileOptimized(bool is_mobile_optimized) override; | 75 void NotifySiteIsMobileOptimized(bool is_mobile_optimized) override; |
| 76 void RequestNotificationWhenFlushed() override; | |
| 77 bool HasPendingEvents() const override; | 76 bool HasPendingEvents() const override; |
| 78 void SetDeviceScaleFactor(float device_scale_factor) override; | 77 void SetDeviceScaleFactor(float device_scale_factor) override; |
| 79 | 78 |
| 80 // IPC::Listener | 79 // IPC::Listener |
| 81 bool OnMessageReceived(const IPC::Message& message) override; | 80 bool OnMessageReceived(const IPC::Message& message) override; |
| 82 | 81 |
| 83 void SetFrameTreeNodeId(int frameTreeNodeId) override; | 82 void SetFrameTreeNodeId(int frameTreeNodeId) override; |
| 84 | 83 |
| 85 private: | 84 private: |
| 86 friend class InputRouterImplTest; | 85 friend class InputRouterImplTest; |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 const ui::LatencyInfo& latency, | 194 const ui::LatencyInfo& latency, |
| 196 uint32_t unique_touch_event_id); | 195 uint32_t unique_touch_event_id); |
| 197 | 196 |
| 198 // Called when a touch timeout-affecting bit has changed, in turn toggling the | 197 // Called when a touch timeout-affecting bit has changed, in turn toggling the |
| 199 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input | 198 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input |
| 200 // to that determination includes current view properties and the allowed | 199 // to that determination includes current view properties and the allowed |
| 201 // touch action. Note that this will only affect platforms that have a | 200 // touch action. Note that this will only affect platforms that have a |
| 202 // non-zero touch timeout configuration. | 201 // non-zero touch timeout configuration. |
| 203 void UpdateTouchAckTimeoutEnabled(); | 202 void UpdateTouchAckTimeoutEnabled(); |
| 204 | 203 |
| 205 // If a flush has been requested, signals a completed flush to the client if | |
| 206 // all events have been dispatched (i.e., |HasPendingEvents()| is false). | |
| 207 void SignalFlushedIfNecessary(); | |
| 208 | |
| 209 int routing_id() const { return routing_id_; } | 204 int routing_id() const { return routing_id_; } |
| 210 | 205 |
| 211 IPC::Sender* sender_; | 206 IPC::Sender* sender_; |
| 212 InputRouterClient* client_; | 207 InputRouterClient* client_; |
| 213 InputAckHandler* ack_handler_; | 208 InputAckHandler* ack_handler_; |
| 214 int routing_id_; | 209 int routing_id_; |
| 215 int frame_tree_node_id_; | 210 int frame_tree_node_id_; |
| 216 | 211 |
| 217 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK | 212 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK |
| 218 // or MoveRangeSelectionExtent_ACK. | 213 // or MoveRangeSelectionExtent_ACK. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 236 // A queue of keyboard events. We can't trust data from the renderer so we | 231 // A queue of keyboard events. We can't trust data from the renderer so we |
| 237 // stuff key events into a queue and pop them out on ACK, feeding our copy | 232 // stuff key events into a queue and pop them out on ACK, feeding our copy |
| 238 // back to whatever unhandled handler instead of the returned version. | 233 // back to whatever unhandled handler instead of the returned version. |
| 239 typedef std::deque<NativeWebKeyboardEventWithLatencyInfo> KeyQueue; | 234 typedef std::deque<NativeWebKeyboardEventWithLatencyInfo> KeyQueue; |
| 240 KeyQueue key_queue_; | 235 KeyQueue key_queue_; |
| 241 | 236 |
| 242 // The source of the ack within the scope of |ProcessInputEventAck()|. | 237 // The source of the ack within the scope of |ProcessInputEventAck()|. |
| 243 // Defaults to ACK_SOURCE_NONE. | 238 // Defaults to ACK_SOURCE_NONE. |
| 244 AckSource current_ack_source_; | 239 AckSource current_ack_source_; |
| 245 | 240 |
| 246 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | |
| 247 // to the client_ after all events have been dispatched/acked. | |
| 248 bool flush_requested_; | |
| 249 | |
| 250 // Whether there are any active flings in the renderer. As the fling | 241 // 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 | 242 // end notification is asynchronous, we use a count rather than a boolean |
| 252 // to avoid races in bookkeeping when starting a new fling. | 243 // to avoid races in bookkeeping when starting a new fling. |
| 253 int active_renderer_fling_count_; | 244 int active_renderer_fling_count_; |
| 254 | 245 |
| 255 // Whether the TouchScrollStarted event has been sent for the current | 246 // Whether the TouchScrollStarted event has been sent for the current |
| 256 // gesture scroll yet. | 247 // gesture scroll yet. |
| 257 bool touch_scroll_started_sent_; | 248 bool touch_scroll_started_sent_; |
| 258 | 249 |
| 259 MouseWheelEventQueue wheel_event_queue_; | 250 MouseWheelEventQueue wheel_event_queue_; |
| 260 std::unique_ptr<TouchEventQueue> touch_event_queue_; | 251 std::unique_ptr<TouchEventQueue> touch_event_queue_; |
| 261 GestureEventQueue gesture_event_queue_; | 252 GestureEventQueue gesture_event_queue_; |
| 262 TouchActionFilter touch_action_filter_; | 253 TouchActionFilter touch_action_filter_; |
| 263 InputEventStreamValidator input_stream_validator_; | 254 InputEventStreamValidator input_stream_validator_; |
| 264 InputEventStreamValidator output_stream_validator_; | 255 InputEventStreamValidator output_stream_validator_; |
| 265 | 256 |
| 266 float device_scale_factor_; | 257 float device_scale_factor_; |
| 267 bool raf_aligned_touch_enabled_; | 258 bool raf_aligned_touch_enabled_; |
| 268 | 259 |
| 269 // Last touch position relative to screen. Used to compute movementX/Y. | 260 // Last touch position relative to screen. Used to compute movementX/Y. |
| 270 std::map<int, gfx::Point> global_touch_position_; | 261 std::map<int, gfx::Point> global_touch_position_; |
| 271 | 262 |
| 272 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 263 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
| 273 }; | 264 }; |
| 274 | 265 |
| 275 } // namespace content | 266 } // namespace content |
| 276 | 267 |
| 277 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 268 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
| OLD | NEW |