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 22 matching lines...) Expand all Loading... |
33 class OverscrollController; | 33 class OverscrollController; |
34 class RenderWidgetHostImpl; | 34 class RenderWidgetHostImpl; |
35 | 35 |
36 // A default implementation for browser input event routing. | 36 // A default implementation for browser input event routing. |
37 class CONTENT_EXPORT InputRouterImpl | 37 class CONTENT_EXPORT InputRouterImpl |
38 : public NON_EXPORTED_BASE(InputRouter), | 38 : public NON_EXPORTED_BASE(InputRouter), |
39 public NON_EXPORTED_BASE(GestureEventQueueClient), | 39 public NON_EXPORTED_BASE(GestureEventQueueClient), |
40 public NON_EXPORTED_BASE(TouchEventQueueClient), | 40 public NON_EXPORTED_BASE(TouchEventQueueClient), |
41 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { | 41 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { |
42 public: | 42 public: |
| 43 struct CONTENT_EXPORT Config { |
| 44 Config(); |
| 45 GestureEventQueue::Config gesture_config; |
| 46 TouchEventQueue::Config touch_config; |
| 47 }; |
| 48 |
43 InputRouterImpl(IPC::Sender* sender, | 49 InputRouterImpl(IPC::Sender* sender, |
44 InputRouterClient* client, | 50 InputRouterClient* client, |
45 InputAckHandler* ack_handler, | 51 InputAckHandler* ack_handler, |
46 int routing_id); | 52 int routing_id, |
| 53 const Config& config); |
47 virtual ~InputRouterImpl(); | 54 virtual ~InputRouterImpl(); |
48 | 55 |
49 // InputRouter | 56 // InputRouter |
50 virtual void Flush() OVERRIDE; | 57 virtual void Flush() OVERRIDE; |
51 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; | 58 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; |
52 virtual void SendMouseEvent( | 59 virtual void SendMouseEvent( |
53 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; | 60 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
54 virtual void SendWheelEvent( | 61 virtual void SendWheelEvent( |
55 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; | 62 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; |
56 virtual void SendKeyboardEvent( | 63 virtual void SendKeyboardEvent( |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 // dispatch of queued touch events, or the creation of gesture events. | 193 // dispatch of queued touch events, or the creation of gesture events. |
187 void ProcessTouchAck(InputEventAckState ack_result, | 194 void ProcessTouchAck(InputEventAckState ack_result, |
188 const ui::LatencyInfo& latency); | 195 const ui::LatencyInfo& latency); |
189 | 196 |
190 // Forwards |ack_result| to the client's OverscrollController, if necessary. | 197 // Forwards |ack_result| to the client's OverscrollController, if necessary. |
191 void ProcessAckForOverscroll(const blink::WebInputEvent& event, | 198 void ProcessAckForOverscroll(const blink::WebInputEvent& event, |
192 InputEventAckState ack_result); | 199 InputEventAckState ack_result); |
193 | 200 |
194 // Called when a touch timeout-affecting bit has changed, in turn toggling the | 201 // Called when a touch timeout-affecting bit has changed, in turn toggling the |
195 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input | 202 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input |
196 // to that determination includes current view properties, the allowed touch | 203 // to that determination includes current view properties and the allowed |
197 // action and the command-line configured |touch_ack_timeout_supported_|. | 204 // touch action. Note that this will only affect platforms that have a |
| 205 // non-zero touch timeout configuration. |
198 void UpdateTouchAckTimeoutEnabled(); | 206 void UpdateTouchAckTimeoutEnabled(); |
199 | 207 |
200 // If a flush has been requested, signals a completed flush to the client if | 208 // If a flush has been requested, signals a completed flush to the client if |
201 // all events have been dispatched (i.e., |HasPendingEvents()| is false). | 209 // all events have been dispatched (i.e., |HasPendingEvents()| is false). |
202 void SignalFlushedIfNecessary(); | 210 void SignalFlushedIfNecessary(); |
203 | 211 |
204 bool HasPendingEvents() const; | 212 bool HasPendingEvents() const; |
205 | 213 |
206 bool IsInOverscrollGesture() const; | 214 bool IsInOverscrollGesture() const; |
207 | 215 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 258 |
251 // A queue of keyboard events. We can't trust data from the renderer so we | 259 // A queue of keyboard events. We can't trust data from the renderer so we |
252 // stuff key events into a queue and pop them out on ACK, feeding our copy | 260 // stuff key events into a queue and pop them out on ACK, feeding our copy |
253 // back to whatever unhandled handler instead of the returned version. | 261 // back to whatever unhandled handler instead of the returned version. |
254 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; | 262 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; |
255 KeyQueue key_queue_; | 263 KeyQueue key_queue_; |
256 | 264 |
257 // The time when an input event was sent to the client. | 265 // The time when an input event was sent to the client. |
258 base::TimeTicks input_event_start_time_; | 266 base::TimeTicks input_event_start_time_; |
259 | 267 |
260 // Whether touch ack timeout handling has been enabled via the command line. | |
261 bool touch_ack_timeout_supported_; | |
262 base::TimeDelta touch_ack_timeout_delay_; | |
263 | |
264 // Cached flags from |OnViewUpdated()|, defaults to 0. | 268 // Cached flags from |OnViewUpdated()|, defaults to 0. |
265 int current_view_flags_; | 269 int current_view_flags_; |
266 | 270 |
267 // The source of the ack within the scope of |ProcessInputEventAck()|. | 271 // The source of the ack within the scope of |ProcessInputEventAck()|. |
268 // Defaults to ACK_SOURCE_NONE. | 272 // Defaults to ACK_SOURCE_NONE. |
269 AckSource current_ack_source_; | 273 AckSource current_ack_source_; |
270 | 274 |
271 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | 275 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
272 // to the client_ after all events have been dispatched/acked. | 276 // to the client_ after all events have been dispatched/acked. |
273 bool flush_requested_; | 277 bool flush_requested_; |
274 | 278 |
275 TouchEventQueue touch_event_queue_; | 279 TouchEventQueue touch_event_queue_; |
276 GestureEventQueue gesture_event_queue_; | 280 GestureEventQueue gesture_event_queue_; |
277 TouchActionFilter touch_action_filter_; | 281 TouchActionFilter touch_action_filter_; |
278 InputEventStreamValidator event_stream_validator_; | 282 InputEventStreamValidator event_stream_validator_; |
279 | 283 |
280 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 284 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
281 }; | 285 }; |
282 | 286 |
283 } // namespace content | 287 } // namespace content |
284 | 288 |
285 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 289 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
OLD | NEW |