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/input_router.h" | 13 #include "content/browser/renderer_host/input/input_router.h" |
14 #include "content/browser/renderer_host/input/touch_event_queue.h" | 14 #include "content/browser/renderer_host/input/touch_event_queue.h" |
15 #include "content/public/browser/native_web_keyboard_event.h" | 15 #include "content/public/browser/native_web_keyboard_event.h" |
16 | 16 |
17 namespace ui { | 17 namespace ui { |
18 struct LatencyInfo; | 18 struct LatencyInfo; |
19 } | 19 } |
20 | 20 |
21 namespace content { | 21 namespace content { |
22 | 22 |
23 class GestureEventFilter; | 23 class GestureEventFilter; |
| 24 class InputAckHandler; |
24 class InputRouterClient; | 25 class InputRouterClient; |
25 class RenderProcessHost; | 26 class RenderProcessHost; |
26 class RenderWidgetHostImpl; | 27 class RenderWidgetHostImpl; |
27 | 28 |
28 // A default implementation for browser input event routing. Input commands are | 29 // A default implementation for browser input event routing. Input commands are |
29 // forwarded to the renderer immediately upon receipt. | 30 // forwarded to the renderer immediately upon receipt. |
30 class CONTENT_EXPORT ImmediateInputRouter | 31 class CONTENT_EXPORT ImmediateInputRouter |
31 : public NON_EXPORTED_BASE(InputRouter), | 32 : public NON_EXPORTED_BASE(InputRouter), |
32 public NON_EXPORTED_BASE(TouchEventQueueClient) { | 33 public NON_EXPORTED_BASE(TouchEventQueueClient) { |
33 public: | 34 public: |
34 ImmediateInputRouter(RenderProcessHost* process, | 35 ImmediateInputRouter(RenderProcessHost* process, |
35 InputRouterClient* client, | 36 InputRouterClient* client, |
| 37 InputAckHandler* ack_handler, |
36 int routing_id); | 38 int routing_id); |
37 virtual ~ImmediateInputRouter(); | 39 virtual ~ImmediateInputRouter(); |
38 | 40 |
39 // InputRouter | 41 // InputRouter |
40 virtual bool SendInput(IPC::Message* message) OVERRIDE; | 42 virtual void Flush() OVERRIDE; |
| 43 virtual bool SendInput(scoped_ptr<IPC::Message> message) OVERRIDE; |
41 virtual void SendMouseEvent( | 44 virtual void SendMouseEvent( |
42 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; | 45 const MouseEventWithLatencyInfo& mouse_event) OVERRIDE; |
43 virtual void SendWheelEvent( | 46 virtual void SendWheelEvent( |
44 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; | 47 const MouseWheelEventWithLatencyInfo& wheel_event) OVERRIDE; |
45 virtual void SendKeyboardEvent( | 48 virtual void SendKeyboardEvent( |
46 const NativeWebKeyboardEvent& key_event, | 49 const NativeWebKeyboardEvent& key_event, |
47 const ui::LatencyInfo& latency_info) OVERRIDE; | 50 const ui::LatencyInfo& latency_info) OVERRIDE; |
48 virtual void SendGestureEvent( | 51 virtual void SendGestureEvent( |
49 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; | 52 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; |
50 virtual void SendTouchEvent( | 53 virtual void SendTouchEvent( |
(...skipping 21 matching lines...) Expand all Loading... |
72 return touch_event_queue_.get(); | 75 return touch_event_queue_.get(); |
73 } | 76 } |
74 | 77 |
75 private: | 78 private: |
76 friend class ImmediateInputRouterTest; | 79 friend class ImmediateInputRouterTest; |
77 | 80 |
78 // TouchEventQueueClient | 81 // TouchEventQueueClient |
79 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, | 82 virtual void OnTouchEventAck(const TouchEventWithLatencyInfo& event, |
80 InputEventAckState ack_result) OVERRIDE; | 83 InputEventAckState ack_result) OVERRIDE; |
81 | 84 |
82 bool SendMoveCaret(IPC::Message* message); | 85 bool SendMoveCaret(scoped_ptr<IPC::Message> message); |
83 bool SendSelectRange(IPC::Message* message); | 86 bool SendSelectRange(scoped_ptr<IPC::Message> message); |
84 bool Send(IPC::Message* message); | 87 bool Send(IPC::Message* message); |
85 | 88 |
86 // Transmits the given input event an as an IPC::Message. This is an internal | 89 // Transmits the given input event an as an IPC::Message. This is an internal |
87 // helper for |FilterAndSendInputEvent()| and should not be used otherwise. | 90 // helper for |FilterAndSendInputEvent()| and should not be used otherwise. |
88 void SendWebInputEvent(const WebKit::WebInputEvent& input_event, | 91 void SendWebInputEvent(const WebKit::WebInputEvent& input_event, |
89 const ui::LatencyInfo& latency_info, | 92 const ui::LatencyInfo& latency_info, |
90 bool is_keyboard_shortcut); | 93 bool is_keyboard_shortcut); |
91 | 94 |
92 // Filters and forwards the given WebInputEvent to |SendWebInputEvent()|. This | 95 // Filters and forwards the given WebInputEvent to |SendWebInputEvent()|. This |
93 // is an internal helper for |Send*Event()| and should not be used otherwise. | 96 // is an internal helper for |Send*Event()| and should not be used otherwise. |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const ui::LatencyInfo& latency_info); | 133 const ui::LatencyInfo& latency_info); |
131 | 134 |
132 void HandleGestureScroll( | 135 void HandleGestureScroll( |
133 const GestureEventWithLatencyInfo& gesture_event); | 136 const GestureEventWithLatencyInfo& gesture_event); |
134 | 137 |
135 int routing_id() const { return routing_id_; } | 138 int routing_id() const { return routing_id_; } |
136 | 139 |
137 | 140 |
138 RenderProcessHost* process_; | 141 RenderProcessHost* process_; |
139 InputRouterClient* client_; | 142 InputRouterClient* client_; |
| 143 InputAckHandler* ack_handler_; |
140 int routing_id_; | 144 int routing_id_; |
141 | 145 |
142 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. | 146 // (Similar to |mouse_move_pending_|.) True while waiting for SelectRange_ACK. |
143 bool select_range_pending_; | 147 bool select_range_pending_; |
144 | 148 |
145 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. | 149 // (Similar to |next_mouse_move_|.) The next SelectRange to send, if any. |
146 scoped_ptr<IPC::Message> next_selection_range_; | 150 scoped_ptr<IPC::Message> next_selection_range_; |
147 | 151 |
148 // (Similar to |mouse_move_pending_|.) True while waiting for MoveCaret_ACK. | 152 // (Similar to |mouse_move_pending_|.) True while waiting for MoveCaret_ACK. |
149 bool move_caret_pending_; | 153 bool move_caret_pending_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 201 |
198 scoped_ptr<TouchEventQueue> touch_event_queue_; | 202 scoped_ptr<TouchEventQueue> touch_event_queue_; |
199 scoped_ptr<GestureEventFilter> gesture_event_filter_; | 203 scoped_ptr<GestureEventFilter> gesture_event_filter_; |
200 | 204 |
201 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); | 205 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); |
202 }; | 206 }; |
203 | 207 |
204 } // namespace content | 208 } // namespace content |
205 | 209 |
206 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 210 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
OLD | NEW |