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 | |
49 InputRouterImpl(IPC::Sender* sender, | 43 InputRouterImpl(IPC::Sender* sender, |
50 InputRouterClient* client, | 44 InputRouterClient* client, |
51 InputAckHandler* ack_handler, | 45 InputAckHandler* ack_handler, |
52 int routing_id, | 46 int routing_id); |
53 const Config& config); | |
54 virtual ~InputRouterImpl(); | 47 virtual ~InputRouterImpl(); |
55 | 48 |
56 // InputRouter | 49 // InputRouter |
57 virtual void Flush() OVERRIDE; | 50 virtual void Flush() OVERRIDE; |
58 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; | 51 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; |
59 virtual void SendMouseEvent( | 52 virtual void SendMouseEvent( |
60 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; | 53 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
61 virtual void SendWheelEvent( | 54 virtual void SendWheelEvent( |
62 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; | 55 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; |
63 virtual void SendKeyboardEvent( | 56 virtual void SendKeyboardEvent( |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // dispatch of queued touch events, or the creation of gesture events. | 166 // dispatch of queued touch events, or the creation of gesture events. |
174 void ProcessTouchAck(InputEventAckState ack_result, | 167 void ProcessTouchAck(InputEventAckState ack_result, |
175 const ui::LatencyInfo& latency); | 168 const ui::LatencyInfo& latency); |
176 | 169 |
177 // Forwards |ack_result| to the client's OverscrollController, if necessary. | 170 // Forwards |ack_result| to the client's OverscrollController, if necessary. |
178 void ProcessAckForOverscroll(const blink::WebInputEvent& event, | 171 void ProcessAckForOverscroll(const blink::WebInputEvent& event, |
179 InputEventAckState ack_result); | 172 InputEventAckState ack_result); |
180 | 173 |
181 // Called when a touch timeout-affecting bit has changed, in turn toggling the | 174 // Called when a touch timeout-affecting bit has changed, in turn toggling the |
182 // 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 |
183 // to that determination includes current view properties and the allowed | 176 // to that determination includes current view properties, the allowed touch |
184 // touch action. Note that this will only affect platforms that have a | 177 // action and the command-line configured |touch_ack_timeout_supported_|. |
185 // non-zero touch timeout configuration. | |
186 void UpdateTouchAckTimeoutEnabled(); | 178 void UpdateTouchAckTimeoutEnabled(); |
187 | 179 |
188 // If a flush has been requested, signals a completed flush to the client if | 180 // If a flush has been requested, signals a completed flush to the client if |
189 // all events have been dispatched (i.e., |HasPendingEvents()| is false). | 181 // all events have been dispatched (i.e., |HasPendingEvents()| is false). |
190 void SignalFlushedIfNecessary(); | 182 void SignalFlushedIfNecessary(); |
191 | 183 |
192 bool HasPendingEvents() const; | 184 bool HasPendingEvents() const; |
193 | 185 |
194 bool IsInOverscrollGesture() const; | 186 bool IsInOverscrollGesture() const; |
195 | 187 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 | 230 |
239 // 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 |
240 // 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 |
241 // back to whatever unhandled handler instead of the returned version. | 233 // back to whatever unhandled handler instead of the returned version. |
242 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; | 234 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; |
243 KeyQueue key_queue_; | 235 KeyQueue key_queue_; |
244 | 236 |
245 // The time when an input event was sent to the client. | 237 // The time when an input event was sent to the client. |
246 base::TimeTicks input_event_start_time_; | 238 base::TimeTicks input_event_start_time_; |
247 | 239 |
| 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 |
248 // Cached flags from |OnViewUpdated()|, defaults to 0. | 244 // Cached flags from |OnViewUpdated()|, defaults to 0. |
249 int current_view_flags_; | 245 int current_view_flags_; |
250 | 246 |
251 // The source of the ack within the scope of |ProcessInputEventAck()|. | 247 // The source of the ack within the scope of |ProcessInputEventAck()|. |
252 // Defaults to ACK_SOURCE_NONE. | 248 // Defaults to ACK_SOURCE_NONE. |
253 AckSource current_ack_source_; | 249 AckSource current_ack_source_; |
254 | 250 |
255 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | 251 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
256 // to the client_ after all events have been dispatched/acked. | 252 // to the client_ after all events have been dispatched/acked. |
257 bool flush_requested_; | 253 bool flush_requested_; |
258 | 254 |
259 TouchEventQueue touch_event_queue_; | 255 TouchEventQueue touch_event_queue_; |
260 GestureEventQueue gesture_event_queue_; | 256 GestureEventQueue gesture_event_queue_; |
261 TouchActionFilter touch_action_filter_; | 257 TouchActionFilter touch_action_filter_; |
262 InputEventStreamValidator event_stream_validator_; | 258 InputEventStreamValidator event_stream_validator_; |
263 | 259 |
264 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 260 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
265 }; | 261 }; |
266 | 262 |
267 } // namespace content | 263 } // namespace content |
268 | 264 |
269 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 265 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
OLD | NEW |