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" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 virtual void SendGestureEventImmediately( | 84 virtual void SendGestureEventImmediately( |
85 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; | 85 const GestureEventWithLatencyInfo& gesture_event) OVERRIDE; |
86 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, | 86 virtual void OnGestureEventAck(const GestureEventWithLatencyInfo& event, |
87 InputEventAckState ack_result) OVERRIDE; | 87 InputEventAckState ack_result) OVERRIDE; |
88 | 88 |
89 bool SendMoveCaret(scoped_ptr<IPC::Message> message); | 89 bool SendMoveCaret(scoped_ptr<IPC::Message> message); |
90 bool SendSelectRange(scoped_ptr<IPC::Message> message); | 90 bool SendSelectRange(scoped_ptr<IPC::Message> message); |
91 bool Send(IPC::Message* message); | 91 bool Send(IPC::Message* message); |
92 | 92 |
93 // Filters and forwards |input_event| to the appropriate handler. | 93 // Filters and forwards |input_event| to the appropriate handler. |
94 void FilterAndSendWebInputEvent(const WebKit::WebInputEvent& input_event, | 94 void FilterAndSendWebInputEvent(const blink::WebInputEvent& input_event, |
95 const ui::LatencyInfo& latency_info, | 95 const ui::LatencyInfo& latency_info, |
96 bool is_keyboard_shortcut); | 96 bool is_keyboard_shortcut); |
97 | 97 |
98 // Utility routine for filtering and forwarding |input_event| to the | 98 // Utility routine for filtering and forwarding |input_event| to the |
99 // appropriate handler. |input_event| will be offered to the overscroll | 99 // appropriate handler. |input_event| will be offered to the overscroll |
100 // controller, client and renderer, in that order. | 100 // controller, client and renderer, in that order. |
101 void OfferToHandlers(const WebKit::WebInputEvent& input_event, | 101 void OfferToHandlers(const blink::WebInputEvent& input_event, |
102 const ui::LatencyInfo& latency_info, | 102 const ui::LatencyInfo& latency_info, |
103 bool is_keyboard_shortcut); | 103 bool is_keyboard_shortcut); |
104 | 104 |
105 // Returns true if |input_event| was consumed by the overscroll controller. | 105 // Returns true if |input_event| was consumed by the overscroll controller. |
106 bool OfferToOverscrollController(const WebKit::WebInputEvent& input_event, | 106 bool OfferToOverscrollController(const blink::WebInputEvent& input_event, |
107 const ui::LatencyInfo& latency_info); | 107 const ui::LatencyInfo& latency_info); |
108 | 108 |
109 // Returns true if |input_event| was consumed by the client. | 109 // Returns true if |input_event| was consumed by the client. |
110 bool OfferToClient(const WebKit::WebInputEvent& input_event, | 110 bool OfferToClient(const blink::WebInputEvent& input_event, |
111 const ui::LatencyInfo& latency_info); | 111 const ui::LatencyInfo& latency_info); |
112 | 112 |
113 // Returns true if |input_event| was successfully sent to the renderer | 113 // Returns true if |input_event| was successfully sent to the renderer |
114 // as an async IPC Message. | 114 // as an async IPC Message. |
115 bool OfferToRenderer(const WebKit::WebInputEvent& input_event, | 115 bool OfferToRenderer(const blink::WebInputEvent& input_event, |
116 const ui::LatencyInfo& latency_info, | 116 const ui::LatencyInfo& latency_info, |
117 bool is_keyboard_shortcut); | 117 bool is_keyboard_shortcut); |
118 | 118 |
119 // IPC message handlers | 119 // IPC message handlers |
120 void OnInputEventAck(WebKit::WebInputEvent::Type event_type, | 120 void OnInputEventAck(blink::WebInputEvent::Type event_type, |
121 InputEventAckState ack_result, | 121 InputEventAckState ack_result, |
122 const ui::LatencyInfo& latency_info); | 122 const ui::LatencyInfo& latency_info); |
123 void OnMsgMoveCaretAck(); | 123 void OnMsgMoveCaretAck(); |
124 void OnSelectRangeAck(); | 124 void OnSelectRangeAck(); |
125 void OnHasTouchEventHandlers(bool has_handlers); | 125 void OnHasTouchEventHandlers(bool has_handlers); |
126 | 126 |
127 // Indicates the source of an ack provided to |ProcessInputEventAck()|. | 127 // Indicates the source of an ack provided to |ProcessInputEventAck()|. |
128 // The source is tracked by |current_ack_source_|, which aids in ack routing. | 128 // The source is tracked by |current_ack_source_|, which aids in ack routing. |
129 enum AckSource { | 129 enum AckSource { |
130 RENDERER, | 130 RENDERER, |
131 CLIENT, | 131 CLIENT, |
132 OVERSCROLL_CONTROLLER, | 132 OVERSCROLL_CONTROLLER, |
133 ACK_SOURCE_NONE | 133 ACK_SOURCE_NONE |
134 }; | 134 }; |
135 // Note: This function may result in |this| being deleted, and as such | 135 // Note: This function may result in |this| being deleted, and as such |
136 // should be the last method called in any internal chain of event handling. | 136 // should be the last method called in any internal chain of event handling. |
137 void ProcessInputEventAck(WebKit::WebInputEvent::Type event_type, | 137 void ProcessInputEventAck(blink::WebInputEvent::Type event_type, |
138 InputEventAckState ack_result, | 138 InputEventAckState ack_result, |
139 const ui::LatencyInfo& latency_info, | 139 const ui::LatencyInfo& latency_info, |
140 AckSource ack_source); | 140 AckSource ack_source); |
141 | 141 |
142 // Dispatches the ack'ed event to |ack_handler_|. | 142 // Dispatches the ack'ed event to |ack_handler_|. |
143 void ProcessKeyboardAck(WebKit::WebInputEvent::Type type, | 143 void ProcessKeyboardAck(blink::WebInputEvent::Type type, |
144 InputEventAckState ack_result); | 144 InputEventAckState ack_result); |
145 | 145 |
146 // Forwards a valid |next_mouse_move_| if |type| is MouseMove. | 146 // Forwards a valid |next_mouse_move_| if |type| is MouseMove. |
147 void ProcessMouseAck(WebKit::WebInputEvent::Type type, | 147 void ProcessMouseAck(blink::WebInputEvent::Type type, |
148 InputEventAckState ack_result); | 148 InputEventAckState ack_result); |
149 | 149 |
150 // Dispatches the ack'ed event to |ack_handler_|, forwarding queued events | 150 // Dispatches the ack'ed event to |ack_handler_|, forwarding queued events |
151 // from |coalesced_mouse_wheel_events_|. | 151 // from |coalesced_mouse_wheel_events_|. |
152 void ProcessWheelAck(InputEventAckState ack_result, | 152 void ProcessWheelAck(InputEventAckState ack_result, |
153 const ui::LatencyInfo& latency); | 153 const ui::LatencyInfo& latency); |
154 | 154 |
155 // Forwards the event ack to |gesture_event_filter|, potentially triggering | 155 // Forwards the event ack to |gesture_event_filter|, potentially triggering |
156 // dispatch of queued gesture events. | 156 // dispatch of queued gesture events. |
157 void ProcessGestureAck(WebKit::WebInputEvent::Type type, | 157 void ProcessGestureAck(blink::WebInputEvent::Type type, |
158 InputEventAckState ack_result, | 158 InputEventAckState ack_result, |
159 const ui::LatencyInfo& latency); | 159 const ui::LatencyInfo& latency); |
160 | 160 |
161 // Forwards the event ack to |touch_event_queue_|, potentially triggering | 161 // Forwards the event ack to |touch_event_queue_|, potentially triggering |
162 // dispatch of queued touch events, or the creation of gesture events. | 162 // dispatch of queued touch events, or the creation of gesture events. |
163 void ProcessTouchAck(InputEventAckState ack_result, | 163 void ProcessTouchAck(InputEventAckState ack_result, |
164 const ui::LatencyInfo& latency); | 164 const ui::LatencyInfo& latency); |
165 | 165 |
166 // Forwards |ack_result| to the client's OverscrollController, if necessary. | 166 // Forwards |ack_result| to the client's OverscrollController, if necessary. |
167 void ProcessAckForOverscroll(const WebKit::WebInputEvent& event, | 167 void ProcessAckForOverscroll(const blink::WebInputEvent& event, |
168 InputEventAckState ack_result); | 168 InputEventAckState ack_result); |
169 | 169 |
170 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); | 170 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); |
171 | 171 |
172 void SimulateTouchGestureWithMouse( | 172 void SimulateTouchGestureWithMouse( |
173 const MouseEventWithLatencyInfo& mouse_event); | 173 const MouseEventWithLatencyInfo& mouse_event); |
174 | 174 |
175 bool IsInOverscrollGesture() const; | 175 bool IsInOverscrollGesture() const; |
176 | 176 |
177 int routing_id() const { return routing_id_; } | 177 int routing_id() const { return routing_id_; } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 | 240 |
241 scoped_ptr<TouchEventQueue> touch_event_queue_; | 241 scoped_ptr<TouchEventQueue> touch_event_queue_; |
242 scoped_ptr<GestureEventFilter> gesture_event_filter_; | 242 scoped_ptr<GestureEventFilter> gesture_event_filter_; |
243 | 243 |
244 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); | 244 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); |
245 }; | 245 }; |
246 | 246 |
247 } // namespace content | 247 } // namespace content |
248 | 248 |
249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
OLD | NEW |