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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 // dispatch of queued touch events, or the creation of gesture events. | 173 // dispatch of queued touch events, or the creation of gesture events. |
167 void ProcessTouchAck(InputEventAckState ack_result, | 174 void ProcessTouchAck(InputEventAckState ack_result, |
168 const ui::LatencyInfo& latency); | 175 const ui::LatencyInfo& latency); |
169 | 176 |
170 // Forwards |ack_result| to the client's OverscrollController, if necessary. | 177 // Forwards |ack_result| to the client's OverscrollController, if necessary. |
171 void ProcessAckForOverscroll(const blink::WebInputEvent& event, | 178 void ProcessAckForOverscroll(const blink::WebInputEvent& event, |
172 InputEventAckState ack_result); | 179 InputEventAckState ack_result); |
173 | 180 |
174 // Called when a touch timeout-affecting bit has changed, in turn toggling the | 181 // Called when a touch timeout-affecting bit has changed, in turn toggling the |
175 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input | 182 // touch ack timeout feature of the |touch_event_queue_| as appropriate. Input |
176 // to that determination includes current view properties, the allowed touch | 183 // to that determination includes current view properties and the allowed |
177 // action and the command-line configured |touch_ack_timeout_supported_|. | 184 // touch action. Note that this will only affect platforms that have a |
| 185 // non-zero touch timeout configuration. |
178 void UpdateTouchAckTimeoutEnabled(); | 186 void UpdateTouchAckTimeoutEnabled(); |
179 | 187 |
180 // If a flush has been requested, signals a completed flush to the client if | 188 // 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). | 189 // all events have been dispatched (i.e., |HasPendingEvents()| is false). |
182 void SignalFlushedIfNecessary(); | 190 void SignalFlushedIfNecessary(); |
183 | 191 |
184 bool HasPendingEvents() const; | 192 bool HasPendingEvents() const; |
185 | 193 |
186 bool IsInOverscrollGesture() const; | 194 bool IsInOverscrollGesture() const; |
187 | 195 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 | 238 |
231 // A queue of keyboard events. We can't trust data from the renderer so we | 239 // A queue of keyboard events. We can't trust data from the renderer so we |
232 // stuff key events into a queue and pop them out on ACK, feeding our copy | 240 // stuff key events into a queue and pop them out on ACK, feeding our copy |
233 // back to whatever unhandled handler instead of the returned version. | 241 // back to whatever unhandled handler instead of the returned version. |
234 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; | 242 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; |
235 KeyQueue key_queue_; | 243 KeyQueue key_queue_; |
236 | 244 |
237 // The time when an input event was sent to the client. | 245 // The time when an input event was sent to the client. |
238 base::TimeTicks input_event_start_time_; | 246 base::TimeTicks input_event_start_time_; |
239 | 247 |
240 // Whether touch ack timeout handling has been enabled via the command line. | |
241 bool touch_ack_timeout_supported_; | |
242 base::TimeDelta touch_ack_timeout_delay_; | |
243 | |
244 // Cached flags from |OnViewUpdated()|, defaults to 0. | 248 // Cached flags from |OnViewUpdated()|, defaults to 0. |
245 int current_view_flags_; | 249 int current_view_flags_; |
246 | 250 |
247 // The source of the ack within the scope of |ProcessInputEventAck()|. | 251 // The source of the ack within the scope of |ProcessInputEventAck()|. |
248 // Defaults to ACK_SOURCE_NONE. | 252 // Defaults to ACK_SOURCE_NONE. |
249 AckSource current_ack_source_; | 253 AckSource current_ack_source_; |
250 | 254 |
251 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | 255 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
252 // to the client_ after all events have been dispatched/acked. | 256 // to the client_ after all events have been dispatched/acked. |
253 bool flush_requested_; | 257 bool flush_requested_; |
254 | 258 |
255 TouchEventQueue touch_event_queue_; | 259 TouchEventQueue touch_event_queue_; |
256 GestureEventQueue gesture_event_queue_; | 260 GestureEventQueue gesture_event_queue_; |
257 TouchActionFilter touch_action_filter_; | 261 TouchActionFilter touch_action_filter_; |
258 InputEventStreamValidator event_stream_validator_; | 262 InputEventStreamValidator event_stream_validator_; |
259 | 263 |
260 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 264 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
261 }; | 265 }; |
262 | 266 |
263 } // namespace content | 267 } // namespace content |
264 | 268 |
265 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 269 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
OLD | NEW |