| 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 #include "content/browser/renderer_host/input/input_router_impl.h" | 5 #include "content/browser/renderer_host/input/input_router_impl.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); | 167 HISTOGRAM_COUNTS_100("Renderer.KeyboardQueueSize", key_queue_.size()); |
| 168 | 168 |
| 169 gesture_event_queue_.FlingHasBeenHalted(); | 169 gesture_event_queue_.FlingHasBeenHalted(); |
| 170 | 170 |
| 171 // Only forward the non-native portions of our event. | 171 // Only forward the non-native portions of our event. |
| 172 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); | 172 FilterAndSendWebInputEvent(key_event, latency_info, is_keyboard_shortcut); |
| 173 } | 173 } |
| 174 | 174 |
| 175 void InputRouterImpl::SendGestureEvent( | 175 void InputRouterImpl::SendGestureEvent( |
| 176 const GestureEventWithLatencyInfo& original_gesture_event) { | 176 const GestureEventWithLatencyInfo& original_gesture_event) { |
| 177 event_stream_validator_.OnEvent(original_gesture_event.event); | 177 input_stream_validator_.Validate(original_gesture_event.event); |
| 178 |
| 178 GestureEventWithLatencyInfo gesture_event(original_gesture_event); | 179 GestureEventWithLatencyInfo gesture_event(original_gesture_event); |
| 179 | 180 |
| 180 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) | 181 if (touch_action_filter_.FilterGestureEvent(&gesture_event.event)) |
| 181 return; | 182 return; |
| 182 | 183 |
| 183 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) | 184 if (gesture_event.event.sourceDevice == blink::WebGestureDeviceTouchscreen) |
| 184 touch_event_queue_.OnGestureScrollEvent(gesture_event); | 185 touch_event_queue_.OnGestureScrollEvent(gesture_event); |
| 185 | 186 |
| 186 if (!gesture_event_queue_.ShouldForward(gesture_event)) | 187 if (!gesture_event_queue_.ShouldForward(gesture_event)) |
| 187 return; | 188 return; |
| 188 | 189 |
| 189 SendGestureEventImmediately(gesture_event); | 190 SendGestureEventImmediately(gesture_event); |
| 190 } | 191 } |
| 191 | 192 |
| 192 void InputRouterImpl::SendTouchEvent( | 193 void InputRouterImpl::SendTouchEvent( |
| 193 const TouchEventWithLatencyInfo& touch_event) { | 194 const TouchEventWithLatencyInfo& touch_event) { |
| 195 input_stream_validator_.Validate(touch_event.event); |
| 194 touch_event_queue_.QueueEvent(touch_event); | 196 touch_event_queue_.QueueEvent(touch_event); |
| 195 } | 197 } |
| 196 | 198 |
| 197 // Forwards MouseEvent without passing it through | 199 // Forwards MouseEvent without passing it through |
| 198 // TouchpadTapSuppressionController. | 200 // TouchpadTapSuppressionController. |
| 199 void InputRouterImpl::SendMouseEventImmediately( | 201 void InputRouterImpl::SendMouseEventImmediately( |
| 200 const MouseEventWithLatencyInfo& mouse_event) { | 202 const MouseEventWithLatencyInfo& mouse_event) { |
| 201 // Avoid spamming the renderer with mouse move events. It is important | 203 // Avoid spamming the renderer with mouse move events. It is important |
| 202 // to note that WM_MOUSEMOVE events are anyways synthetic, but since our | 204 // to note that WM_MOUSEMOVE events are anyways synthetic, but since our |
| 203 // thread is able to rapidly consume WM_MOUSEMOVE events, we may get way | 205 // thread is able to rapidly consume WM_MOUSEMOVE events, we may get way |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 | 335 |
| 334 // Any input event cancels a pending mouse move event. | 336 // Any input event cancels a pending mouse move event. |
| 335 next_mouse_move_.reset(); | 337 next_mouse_move_.reset(); |
| 336 | 338 |
| 337 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); | 339 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); |
| 338 } | 340 } |
| 339 | 341 |
| 340 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, | 342 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, |
| 341 const ui::LatencyInfo& latency_info, | 343 const ui::LatencyInfo& latency_info, |
| 342 bool is_keyboard_shortcut) { | 344 bool is_keyboard_shortcut) { |
| 345 output_stream_validator_.Validate(input_event); |
| 346 |
| 343 if (OfferToClient(input_event, latency_info)) | 347 if (OfferToClient(input_event, latency_info)) |
| 344 return; | 348 return; |
| 345 | 349 |
| 346 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); | 350 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); |
| 347 | 351 |
| 348 // Touch events should always indicate in the event whether they are | 352 // Touch events should always indicate in the event whether they are |
| 349 // cancelable (respect ACK disposition) or not. | 353 // cancelable (respect ACK disposition) or not. |
| 350 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); | 354 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); |
| 351 if (WebInputEvent::isTouchEventType(input_event.type)) { | 355 if (WebInputEvent::isTouchEventType(input_event.type)) { |
| 352 DCHECK(!ignores_ack == | 356 DCHECK(!ignores_ack == |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 686 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( | 690 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( |
| 687 const MouseWheelEventWithLatencyInfo& event, | 691 const MouseWheelEventWithLatencyInfo& event, |
| 688 bool synthesized_from_pinch) | 692 bool synthesized_from_pinch) |
| 689 : event(event), synthesized_from_pinch(synthesized_from_pinch) { | 693 : event(event), synthesized_from_pinch(synthesized_from_pinch) { |
| 690 } | 694 } |
| 691 | 695 |
| 692 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { | 696 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { |
| 693 } | 697 } |
| 694 | 698 |
| 695 } // namespace content | 699 } // namespace content |
| OLD | NEW |