| 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/gesture_event_filter.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_event_queue.h" | 15 #include "content/browser/renderer_host/input/touch_event_queue.h" |
| 16 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 16 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
| 17 #include "content/public/browser/native_web_keyboard_event.h" | 17 #include "content/public/browser/native_web_keyboard_event.h" |
| 18 #include "content/public/common/touch_action.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 { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 const ui::LatencyInfo& latency_info, | 117 const ui::LatencyInfo& latency_info, |
| 117 bool is_keyboard_shortcut); | 118 bool is_keyboard_shortcut); |
| 118 | 119 |
| 119 // IPC message handlers | 120 // IPC message handlers |
| 120 void OnInputEventAck(WebKit::WebInputEvent::Type event_type, | 121 void OnInputEventAck(WebKit::WebInputEvent::Type event_type, |
| 121 InputEventAckState ack_result, | 122 InputEventAckState ack_result, |
| 122 const ui::LatencyInfo& latency_info); | 123 const ui::LatencyInfo& latency_info); |
| 123 void OnMsgMoveCaretAck(); | 124 void OnMsgMoveCaretAck(); |
| 124 void OnSelectRangeAck(); | 125 void OnSelectRangeAck(); |
| 125 void OnHasTouchEventHandlers(bool has_handlers); | 126 void OnHasTouchEventHandlers(bool has_handlers); |
| 127 void OnSetTouchAction(int touch_id, content::TouchAction touchAction); |
| 126 | 128 |
| 127 // Indicates the source of an ack provided to |ProcessInputEventAck()|. | 129 // Indicates the source of an ack provided to |ProcessInputEventAck()|. |
| 128 // The source is tracked by |current_ack_source_|, which aids in ack routing. | 130 // The source is tracked by |current_ack_source_|, which aids in ack routing. |
| 129 enum AckSource { | 131 enum AckSource { |
| 130 RENDERER, | 132 RENDERER, |
| 131 CLIENT, | 133 CLIENT, |
| 132 OVERSCROLL_CONTROLLER, | 134 OVERSCROLL_CONTROLLER, |
| 133 ACK_SOURCE_NONE | 135 ACK_SOURCE_NONE |
| 134 }; | 136 }; |
| 135 // Note: This function may result in |this| being deleted, and as such | 137 // Note: This function may result in |this| being deleted, and as such |
| (...skipping 24 matching lines...) Expand all Loading... |
| 160 | 162 |
| 161 // Forwards the event ack to |touch_event_queue_|, potentially triggering | 163 // Forwards the event ack to |touch_event_queue_|, potentially triggering |
| 162 // dispatch of queued touch events, or the creation of gesture events. | 164 // dispatch of queued touch events, or the creation of gesture events. |
| 163 void ProcessTouchAck(InputEventAckState ack_result, | 165 void ProcessTouchAck(InputEventAckState ack_result, |
| 164 const ui::LatencyInfo& latency); | 166 const ui::LatencyInfo& latency); |
| 165 | 167 |
| 166 // Forwards |ack_result| to the client's OverscrollController, if necessary. | 168 // Forwards |ack_result| to the client's OverscrollController, if necessary. |
| 167 void ProcessAckForOverscroll(const WebKit::WebInputEvent& event, | 169 void ProcessAckForOverscroll(const WebKit::WebInputEvent& event, |
| 168 InputEventAckState ack_result); | 170 InputEventAckState ack_result); |
| 169 | 171 |
| 170 void HandleGestureScroll(const GestureEventWithLatencyInfo& gesture_event); | 172 bool FilterTouchAction(const GestureEventWithLatencyInfo& gesture_event); |
| 171 | 173 |
| 172 void SimulateTouchGestureWithMouse( | 174 void SimulateTouchGestureWithMouse( |
| 173 const MouseEventWithLatencyInfo& mouse_event); | 175 const MouseEventWithLatencyInfo& mouse_event); |
| 174 | 176 |
| 175 bool IsInOverscrollGesture() const; | 177 bool IsInOverscrollGesture() const; |
| 176 | 178 |
| 177 int routing_id() const { return routing_id_; } | 179 int routing_id() const { return routing_id_; } |
| 178 | 180 |
| 179 | 181 |
| 180 IPC::Sender* sender_; | 182 IPC::Sender* sender_; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 // A queue of keyboard events. We can't trust data from the renderer so we | 229 // A queue of keyboard events. We can't trust data from the renderer so we |
| 228 // stuff key events into a queue and pop them out on ACK, feeding our copy | 230 // stuff key events into a queue and pop them out on ACK, feeding our copy |
| 229 // back to whatever unhandled handler instead of the returned version. | 231 // back to whatever unhandled handler instead of the returned version. |
| 230 KeyQueue key_queue_; | 232 KeyQueue key_queue_; |
| 231 | 233 |
| 232 // Keeps track of whether the webpage has any touch event handler. If it does, | 234 // 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 | 235 // then touch events are sent to the renderer. Otherwise, the touch events are |
| 234 // not sent to the renderer. | 236 // not sent to the renderer. |
| 235 bool has_touch_handler_; | 237 bool has_touch_handler_; |
| 236 | 238 |
| 239 // Whether GestureScroll events should be discarded due to touch-action. |
| 240 bool drop_scroll_gesture_events_; |
| 241 |
| 242 // What touch actions are currently permitted. |
| 243 content::TouchAction allowed_touch_action_; |
| 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<GestureEventFilter> gesture_event_filter_; |
| 243 | 251 |
| 244 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); | 252 DISALLOW_COPY_AND_ASSIGN(ImmediateInputRouter); |
| 245 }; | 253 }; |
| 246 | 254 |
| 247 } // namespace content | 255 } // namespace content |
| 248 | 256 |
| 249 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ | 257 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_IMMEDIATE_INPUT_ROUTER_H_ |
| OLD | NEW |