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_IMMEDIATE_INPUT_ROUTER_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_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_filter.h" | 13 #include "content/browser/renderer_host/input/fling/flinger.h" |
| 14 #include "content/browser/renderer_host/input/gesture_event_filter_client.h" |
14 #include "content/browser/renderer_host/input/input_router.h" | 15 #include "content/browser/renderer_host/input/input_router.h" |
15 #include "content/browser/renderer_host/input/touch_event_queue.h" | 16 #include "content/browser/renderer_host/input/touch_event_queue.h" |
16 #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" |
17 #include "content/public/browser/native_web_keyboard_event.h" | 18 #include "content/public/browser/native_web_keyboard_event.h" |
18 | 19 |
19 namespace IPC { | 20 namespace IPC { |
20 class Sender; | 21 class Sender; |
21 } | 22 } |
22 | 23 |
23 namespace ui { | 24 namespace ui { |
24 struct LatencyInfo; | 25 struct LatencyInfo; |
25 } | 26 } |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 class BaseGestureEventFilter; |
29 class InputAckHandler; | 30 class InputAckHandler; |
30 class InputRouterClient; | 31 class InputRouterClient; |
31 class OverscrollController; | 32 class OverscrollController; |
32 class RenderWidgetHostImpl; | 33 class RenderWidgetHostImpl; |
33 | 34 |
34 // A default implementation for browser input event routing. Input commands are | 35 // A default implementation for browser input event routing. Input commands are |
35 // forwarded to the renderer immediately upon receipt. | 36 // forwarded to the renderer immediately upon receipt. |
36 class CONTENT_EXPORT ImmediateInputRouter | 37 class CONTENT_EXPORT ImmediateInputRouter |
37 : public NON_EXPORTED_BASE(InputRouter), | 38 : public NON_EXPORTED_BASE(InputRouter), |
38 public NON_EXPORTED_BASE(GestureEventFilterClient), | 39 public NON_EXPORTED_BASE(GestureEventFilterClient), |
39 public NON_EXPORTED_BASE(TouchEventQueueClient), | 40 public NON_EXPORTED_BASE(TouchEventQueueClient), |
40 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient) { | 41 public NON_EXPORTED_BASE(TouchpadTapSuppressionControllerClient), |
| 42 public NON_EXPORTED_BASE(FlingHelper) { |
41 public: | 43 public: |
42 ImmediateInputRouter(IPC::Sender* sender, | 44 ImmediateInputRouter(IPC::Sender* sender, |
43 InputRouterClient* client, | 45 InputRouterClient* client, |
44 InputAckHandler* ack_handler, | 46 InputAckHandler* ack_handler, |
45 int routing_id); | 47 int routing_id); |
46 virtual ~ImmediateInputRouter(); | 48 virtual ~ImmediateInputRouter(); |
47 | 49 |
48 // InputRouter | 50 // InputRouter |
49 virtual void Flush() OVERRIDE; | 51 virtual void Flush() OVERRIDE; |
50 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; | 52 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; |
(...skipping 28 matching lines...) Expand all Loading... |
79 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; | 81 const TouchEventWithLatencyInfo& touch_event) OVERRIDE; |
80 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 82 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
81 InputEventAckState ack_result) OVERRIDE; | 83 InputEventAckState ack_result) OVERRIDE; |
82 | 84 |
83 // GetureEventFilterClient | 85 // GetureEventFilterClient |
84 virtual void SendGestureEventImmediately( | 86 virtual void SendGestureEventImmediately( |
85 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; | 87 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; |
86 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, | 88 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, |
87 InputEventAckState ack_result) OVERRIDE; | 89 InputEventAckState ack_result) OVERRIDE; |
88 | 90 |
| 91 // FlingHelper |
| 92 virtual void SendEventForFling(const blink::WebInputEvent& event) OVERRIDE; |
| 93 virtual void FlingFinished( |
| 94 blink::WebGestureEvent::SourceDevice source) OVERRIDE; |
| 95 |
89 bool SendMoveCaret(scoped_ptr<IPC::Message> message); | 96 bool SendMoveCaret(scoped_ptr<IPC::Message> message); |
90 bool SendSelectRange(scoped_ptr<IPC::Message> message); | 97 bool SendSelectRange(scoped_ptr<IPC::Message> message); |
91 bool Send(IPC::Message* message); | 98 bool Send(IPC::Message* message); |
92 | 99 |
93 // Filters and forwards |input_event| to the appropriate handler. | 100 // Filters and forwards |input_event| to the appropriate handler. |
94 void FilterAndSendWebInputEvent(const blink::WebInputEvent& input_event, | 101 void FilterAndSendWebInputEvent(const blink::WebInputEvent& input_event, |
95 const ui::LatencyInfo& latency_info, | 102 const ui::LatencyInfo& latency_info, |
96 bool is_keyboard_shortcut); | 103 bool is_keyboard_shortcut); |
97 | 104 |
98 // Utility routine for filtering and forwarding |input_event| to the | 105 // Utility routine for filtering and forwarding |input_event| to the |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 176 |
170 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); | 177 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); |
171 | 178 |
172 void SimulateTouchGestureWithMouse( | 179 void SimulateTouchGestureWithMouse( |
173 const MouseEventWithLatencyInfo& mouse_event); | 180 const MouseEventWithLatencyInfo& mouse_event); |
174 | 181 |
175 bool IsInOverscrollGesture() const; | 182 bool IsInOverscrollGesture() const; |
176 | 183 |
177 int routing_id() const { return routing_id_; } | 184 int routing_id() const { return routing_id_; } |
178 | 185 |
| 186 BaseGestureEventFilter* gesture_event_filter(); |
179 | 187 |
180 IPC::Sender* sender_; | 188 IPC::Sender* sender_; |
181 InputRouterClient* client_; | 189 InputRouterClient* client_; |
182 InputAckHandler* ack_handler_; | 190 InputAckHandler* ack_handler_; |
183 int routing_id_; | 191 int routing_id_; |
184 | 192 |
185 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. | 193 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. |
186 bool select_range_pending_; | 194 bool select_range_pending_; |
187 | 195 |
188 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. | 196 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 // Keeps track of whether the webpage has any touch event handler. If it does, | 240 // Keeps track of whether the webpage has any touch event handler. If it does, |
233 // then touch events are sent to the renderer. Otherwise, the touch events are | 241 // then touch events are sent to the renderer. Otherwise, the touch events are |
234 // not sent to the renderer. | 242 // not sent to the renderer. |
235 bool has_touch_handler_; | 243 bool has_touch_handler_; |
236 | 244 |
237 // The source of the ack within the scope of |ProcessInputEventAck()|. | 245 // The source of the ack within the scope of |ProcessInputEventAck()|. |
238 // Defaults to ACK_SOURCE_NONE. | 246 // Defaults to ACK_SOURCE_NONE. |
239 AckSource current_ack_source_; | 247 AckSource current_ack_source_; |
240 | 248 |
241 scoped_ptr<TouchEventQueue> touch_event_queue_; | 249 scoped_ptr<TouchEventQueue> touch_event_queue_; |
242 scoped_ptr<GestureEventFilter> gesture_event_filter_; | 250 scoped_ptr<Flinger> flinger_; |
| 251 |
| 252 class EventFilteringHelper; |
| 253 scoped_ptr<EventFilteringHelper> event_filter_; |
| 254 |
| 255 enum InputMessageSource { |
| 256 MESSAGE_SOURCE_FLING, |
| 257 MESSAGE_SOURCE_REGULAR, |
| 258 }; |
| 259 |
| 260 std::queue<InputMessageSource> in_process_messages_sources_; |
243 | 261 |
244 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); | 262 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); |
245 }; | 263 }; |
246 | 264 |
247 } // namespace content | 265 } // namespace content |
248 | 266 |
249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 267 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
OLD | NEW |