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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
13 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 13 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
14 #include "content/browser/renderer_host/input/input_router.h" | 14 #include "content/browser/renderer_host/input/input_router.h" |
15 #include "content/browser/renderer_host/input/touch_action_filter.h" | 15 #include "content/browser/renderer_host/input/touch_action_filter.h" |
16 #include "content/browser/renderer_host/input/touch_event_queue.h" | 16 #include "content/browser/renderer_host/input/touch_event_queue.h" |
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
18 #include "content/common/input/input_event_stream_validator.h" | |
19 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
20 | 19 |
21 struct InputHostMsg_HandleInputEvent_ACK_Params; | 20 struct InputHostMsg_HandleInputEvent_ACK_Params; |
22 | 21 |
23 namespace IPC { | 22 namespace IPC { |
24 class Sender; | 23 class Sender; |
25 } | 24 } |
26 | 25 |
27 namespace ui { | 26 namespace ui { |
28 struct LatencyInfo; | 27 struct LatencyInfo; |
29 } | 28 } |
30 | 29 |
31 namespace content { | 30 namespace content { |
32 | 31 |
33 class InputAckHandler; | 32 class InputAckHandler; |
| 33 class InputEventStreamValidator; |
34 class InputRouterClient; | 34 class InputRouterClient; |
35 class OverscrollController; | 35 class OverscrollController; |
36 struct DidOverscrollParams; | 36 struct DidOverscrollParams; |
37 | 37 |
38 // A default implementation for browser input event routing. | 38 // A default implementation for browser input event routing. |
39 class CONTENT_EXPORT InputRouterImpl | 39 class CONTENT_EXPORT InputRouterImpl |
40 : public NON_EXPORTED_BASE(InputRouter), | 40 : public NON_EXPORTED_BASE(InputRouter), |
41 public NON_EXPORTED_BASE(GestureEventQueueClient), | 41 public NON_EXPORTED_BASE(GestureEventQueueClient), |
42 public NON_EXPORTED_BASE(TouchEventQueueClient), | 42 public NON_EXPORTED_BASE(TouchEventQueueClient), |
43 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { | 43 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { |
44 public: | 44 public: |
45 struct CONTENT_EXPORT Config { | 45 struct CONTENT_EXPORT Config { |
46 Config(); | 46 Config(); |
47 GestureEventQueue::Config gesture_config; | 47 GestureEventQueue::Config gesture_config; |
48 TouchEventQueue::Config touch_config; | 48 TouchEventQueue::Config touch_config; |
| 49 bool validate_event_stream; |
49 }; | 50 }; |
50 | 51 |
51 InputRouterImpl(IPC::Sender* sender, | 52 InputRouterImpl(IPC::Sender* sender, |
52 InputRouterClient* client, | 53 InputRouterClient* client, |
53 InputAckHandler* ack_handler, | 54 InputAckHandler* ack_handler, |
54 int routing_id, | 55 int routing_id, |
55 const Config& config); | 56 const Config& config); |
56 virtual ~InputRouterImpl(); | 57 virtual ~InputRouterImpl(); |
57 | 58 |
58 // InputRouter | 59 // InputRouter |
59 virtual void Flush() override; | |
60 virtual bool SendInput(scoped_ptr<IPC::Message> message) override; | 60 virtual bool SendInput(scoped_ptr<IPC::Message> message) override; |
61 virtual void SendMouseEvent( | 61 virtual void SendMouseEvent( |
62 const MouseEventWithLatencyInfo& mouse_event) override; | 62 const MouseEventWithLatencyInfo& mouse_event) override; |
63 virtual void SendWheelEvent( | 63 virtual void SendWheelEvent( |
64 const MouseWheelEventWithLatencyInfo& wheel_event) override; | 64 const MouseWheelEventWithLatencyInfo& wheel_event) override; |
65 virtual void SendKeyboardEvent( | 65 virtual void SendKeyboardEvent( |
66 const NativeWebKeyboardEvent& key_event, | 66 const NativeWebKeyboardEvent& key_event, |
67 const ui::LatencyInfo& latency_info, | 67 const ui::LatencyInfo& latency_info, |
68 bool is_keyboard_shortcut) override; | 68 bool is_keyboard_shortcut) override; |
69 virtual void SendGestureEvent( | 69 virtual void SendGestureEvent( |
70 const GestureEventWithLatencyInfo& gesture_event) override; | 70 const GestureEventWithLatencyInfo& gesture_event) override; |
71 virtual void SendTouchEvent( | 71 virtual void SendTouchEvent( |
72 const TouchEventWithLatencyInfo& touch_event) override; | 72 const TouchEventWithLatencyInfo& touch_event) override; |
| 73 virtual void Recycle() override; |
| 74 virtual void RequestFlushedNotification() override; |
73 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; | 75 virtual const NativeWebKeyboardEvent* GetLastKeyboardEvent() const override; |
74 virtual bool ShouldForwardTouchEvent() const override; | 76 virtual bool ShouldForwardTouchEvent() const override; |
75 virtual void OnViewUpdated(int view_flags) override; | 77 virtual void OnViewUpdated(int view_flags) override; |
76 virtual bool HasPendingEvents() const override; | 78 virtual bool HasPendingEvents() const override; |
77 | 79 |
78 // IPC::Listener | 80 // IPC::Listener |
79 virtual bool OnMessageReceived(const IPC::Message& message) override; | 81 virtual bool OnMessageReceived(const IPC::Message& message) override; |
80 | 82 |
81 private: | 83 private: |
82 friend class InputRouterImplTest; | 84 friend class InputRouterImplTest; |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 int current_view_flags_; | 265 int current_view_flags_; |
264 | 266 |
265 // The source of the ack within the scope of |ProcessInputEventAck()|. | 267 // The source of the ack within the scope of |ProcessInputEventAck()|. |
266 // Defaults to ACK_SOURCE_NONE. | 268 // Defaults to ACK_SOURCE_NONE. |
267 AckSource current_ack_source_; | 269 AckSource current_ack_source_; |
268 | 270 |
269 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call | 271 // Whether a call to |Flush()| has yet been accompanied by a |DidFlush()| call |
270 // to the client_ after all events have been dispatched/acked. | 272 // to the client_ after all events have been dispatched/acked. |
271 bool flush_requested_; | 273 bool flush_requested_; |
272 | 274 |
| 275 // Whether we're in the scope of a |Recycle()| call. The only input events |
| 276 // that should conceivably arrive when this is true are gesture events, which |
| 277 // will be summarily dropped. |
| 278 bool in_recycle_; |
| 279 |
273 TouchEventQueue touch_event_queue_; | 280 TouchEventQueue touch_event_queue_; |
274 GestureEventQueue gesture_event_queue_; | 281 GestureEventQueue gesture_event_queue_; |
275 TouchActionFilter touch_action_filter_; | 282 TouchActionFilter touch_action_filter_; |
276 InputEventStreamValidator input_stream_validator_; | 283 |
277 InputEventStreamValidator output_stream_validator_; | 284 scoped_ptr<InputEventStreamValidator> optional_input_stream_validator_; |
| 285 scoped_ptr<InputEventStreamValidator> optional_output_stream_validator_; |
278 | 286 |
279 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); | 287 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); |
280 }; | 288 }; |
281 | 289 |
282 } // namespace content | 290 } // namespace content |
283 | 291 |
284 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ | 292 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ |
OLD | NEW |