Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1048)

Side by Side Diff: content/browser/renderer_host/input/input_router_impl.h

Issue 250923004: Synthesize ctrl-wheel events on touchpad pinch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix windows build and tweaks Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // Returns true if |input_event| was consumed by the client. 111 // Returns true if |input_event| was consumed by the client.
112 bool OfferToClient(const blink::WebInputEvent& input_event, 112 bool OfferToClient(const blink::WebInputEvent& input_event,
113 const ui::LatencyInfo& latency_info); 113 const ui::LatencyInfo& latency_info);
114 114
115 // Returns true if |input_event| was successfully sent to the renderer 115 // Returns true if |input_event| was successfully sent to the renderer
116 // as an async IPC Message. 116 // as an async IPC Message.
117 bool OfferToRenderer(const blink::WebInputEvent& input_event, 117 bool OfferToRenderer(const blink::WebInputEvent& input_event,
118 const ui::LatencyInfo& latency_info, 118 const ui::LatencyInfo& latency_info,
119 bool is_keyboard_shortcut); 119 bool is_keyboard_shortcut);
120 120
121 // A data structure that attaches some metadata to a WebMouseWheelEvent
122 // and it's latency info.
jdduke (slow) 2014/05/01 15:44:47 its
Rick Byers 2014/05/01 17:34:57 Done.
123 struct QueuedWheelEvent {
124 QueuedWheelEvent();
125 QueuedWheelEvent(const MouseWheelEventWithLatencyInfo& event,
126 bool synthesized_from_pinch);
127 ~QueuedWheelEvent();
128
129 MouseWheelEventWithLatencyInfo event;
130 bool synthesized_from_pinch;
131 };
132
133 // Enqueue or send a mouse wheel event.
134 void SendWheelEvent(const QueuedWheelEvent& wheel_event);
135
136 // Given a Touchpad GesturePinchUpdate event, create and send a synthetic
137 // wheel event for it.
138 void SendSyntheticWheelEventForPinch(
139 const blink::WebGestureEvent& pinch_event,
140 const ui::LatencyInfo& latency_info);
141
121 // IPC message handlers 142 // IPC message handlers
122 void OnInputEventAck(blink::WebInputEvent::Type event_type, 143 void OnInputEventAck(blink::WebInputEvent::Type event_type,
123 InputEventAckState ack_result, 144 InputEventAckState ack_result,
124 const ui::LatencyInfo& latency_info); 145 const ui::LatencyInfo& latency_info);
125 void OnMsgMoveCaretAck(); 146 void OnMsgMoveCaretAck();
126 void OnSelectRangeAck(); 147 void OnSelectRangeAck();
127 void OnHasTouchEventHandlers(bool has_handlers); 148 void OnHasTouchEventHandlers(bool has_handlers);
128 void OnSetTouchAction(TouchAction touch_action); 149 void OnSetTouchAction(TouchAction touch_action);
129 150
130 // Indicates the source of an ack provided to |ProcessInputEventAck()|. 151 // Indicates the source of an ack provided to |ProcessInputEventAck()|.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // for a corresponding InputHostMsg_HandleInputEvent_ACK message. 230 // for a corresponding InputHostMsg_HandleInputEvent_ACK message.
210 bool mouse_move_pending_; 231 bool mouse_move_pending_;
211 232
212 // The next mouse move event to send (only non-null while mouse_move_pending_ 233 // The next mouse move event to send (only non-null while mouse_move_pending_
213 // is true). 234 // is true).
214 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_; 235 scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move_;
215 236
216 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent 237 // (Similar to |mouse_move_pending_|.) True if a mouse wheel event was sent
217 // and we are waiting for a corresponding ack. 238 // and we are waiting for a corresponding ack.
218 bool mouse_wheel_pending_; 239 bool mouse_wheel_pending_;
219 MouseWheelEventWithLatencyInfo current_wheel_event_; 240 QueuedWheelEvent current_wheel_event_;
220 241
221 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send. 242 // (Similar to |next_mouse_move_|.) The next mouse wheel events to send.
222 // Unlike mouse moves, mouse wheel events received while one is pending are 243 // Unlike mouse moves, mouse wheel events received while one is pending are
223 // coalesced (by accumulating deltas) if they match the previous event in 244 // coalesced (by accumulating deltas) if they match the previous event in
224 // modifiers. On the Mac, in particular, mouse wheel events are received at a 245 // modifiers. On the Mac, in particular, mouse wheel events are received at a
225 // high rate; not waiting for the ack results in jankiness, and using the same 246 // high rate; not waiting for the ack results in jankiness, and using the same
226 // mechanism as for mouse moves (just dropping old events when multiple ones 247 // mechanism as for mouse moves (just dropping old events when multiple ones
227 // would be queued) results in very slow scrolling. 248 // would be queued) results in very slow scrolling.
228 typedef std::deque<MouseWheelEventWithLatencyInfo> WheelEventQueue; 249 typedef std::deque<QueuedWheelEvent> WheelEventQueue;
229 WheelEventQueue coalesced_mouse_wheel_events_; 250 WheelEventQueue coalesced_mouse_wheel_events_;
230 251
231 // A queue of keyboard events. We can't trust data from the renderer so we 252 // A queue of keyboard events. We can't trust data from the renderer so we
232 // stuff key events into a queue and pop them out on ACK, feeding our copy 253 // stuff key events into a queue and pop them out on ACK, feeding our copy
233 // back to whatever unhandled handler instead of the returned version. 254 // back to whatever unhandled handler instead of the returned version.
234 typedef std::deque<NativeWebKeyboardEvent> KeyQueue; 255 typedef std::deque<NativeWebKeyboardEvent> KeyQueue;
235 KeyQueue key_queue_; 256 KeyQueue key_queue_;
236 257
237 // The time when an input event was sent to the client. 258 // The time when an input event was sent to the client.
238 base::TimeTicks input_event_start_time_; 259 base::TimeTicks input_event_start_time_;
(...skipping 17 matching lines...) Expand all
256 GestureEventQueue gesture_event_queue_; 277 GestureEventQueue gesture_event_queue_;
257 TouchActionFilter touch_action_filter_; 278 TouchActionFilter touch_action_filter_;
258 InputEventStreamValidator event_stream_validator_; 279 InputEventStreamValidator event_stream_validator_;
259 280
260 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl); 281 DISALLOW_COPY_AND_ASSIGN(InputRouterImpl);
261 }; 282 };
262 283
263 } // namespace content 284 } // namespace content
264 285
265 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_ 286 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698