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" |
11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
12 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
| 13 #include "content/browser/gpu/gpu_process_host_ui_shim.h" |
13 #include "content/browser/renderer_host/input/gesture_event_queue.h" | 14 #include "content/browser/renderer_host/input/gesture_event_queue.h" |
14 #include "content/browser/renderer_host/input/input_ack_handler.h" | 15 #include "content/browser/renderer_host/input/input_ack_handler.h" |
15 #include "content/browser/renderer_host/input/input_router_client.h" | 16 #include "content/browser/renderer_host/input/input_router_client.h" |
16 #include "content/browser/renderer_host/input/touch_event_queue.h" | 17 #include "content/browser/renderer_host/input/touch_event_queue.h" |
17 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" | 18 #include "content/browser/renderer_host/input/touchpad_tap_suppression_controlle
r.h" |
18 #include "content/common/content_constants_internal.h" | 19 #include "content/common/content_constants_internal.h" |
19 #include "content/common/edit_command.h" | 20 #include "content/common/edit_command.h" |
| 21 #include "content/common/gpu/gpu_messages.h" |
20 #include "content/common/input/input_event_ack_state.h" | 22 #include "content/common/input/input_event_ack_state.h" |
21 #include "content/common/input/touch_action.h" | 23 #include "content/common/input/touch_action.h" |
22 #include "content/common/input/web_touch_event_traits.h" | 24 #include "content/common/input/web_touch_event_traits.h" |
23 #include "content/common/input_messages.h" | 25 #include "content/common/input_messages.h" |
24 #include "content/common/view_messages.h" | 26 #include "content/common/view_messages.h" |
25 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
26 #include "content/public/browser/notification_types.h" | 28 #include "content/public/browser/notification_types.h" |
27 #include "content/public/browser/user_metrics.h" | 29 #include "content/public/browser/user_metrics.h" |
28 #include "content/public/common/content_switches.h" | 30 #include "content/public/common/content_switches.h" |
29 #include "ipc/ipc_sender.h" | 31 #include "ipc/ipc_sender.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 next_mouse_move_.reset(); | 339 next_mouse_move_.reset(); |
338 | 340 |
339 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); | 341 OfferToHandlers(input_event, latency_info, is_keyboard_shortcut); |
340 } | 342 } |
341 | 343 |
342 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, | 344 void InputRouterImpl::OfferToHandlers(const WebInputEvent& input_event, |
343 const ui::LatencyInfo& latency_info, | 345 const ui::LatencyInfo& latency_info, |
344 bool is_keyboard_shortcut) { | 346 bool is_keyboard_shortcut) { |
345 output_stream_validator_.Validate(input_event); | 347 output_stream_validator_.Validate(input_event); |
346 | 348 |
| 349 LOG(WARNING) << "InputRouterImpl::OfferToHandlers"; |
| 350 |
347 if (OfferToClient(input_event, latency_info)) | 351 if (OfferToClient(input_event, latency_info)) |
348 return; | 352 return; |
349 | 353 |
| 354 OfferToGpuService(input_event, is_keyboard_shortcut); |
350 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); | 355 OfferToRenderer(input_event, latency_info, is_keyboard_shortcut); |
351 | 356 |
352 // Touch events should always indicate in the event whether they are | 357 // Touch events should always indicate in the event whether they are |
353 // cancelable (respect ACK disposition) or not. | 358 // cancelable (respect ACK disposition) or not. |
354 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); | 359 bool ignores_ack = WebInputEventTraits::IgnoresAckDisposition(input_event); |
355 if (WebInputEvent::isTouchEventType(input_event.type)) { | 360 if (WebInputEvent::isTouchEventType(input_event.type)) { |
356 DCHECK(!ignores_ack == | 361 DCHECK(!ignores_ack == |
357 static_cast<const blink::WebTouchEvent&>(input_event).cancelable); | 362 static_cast<const blink::WebTouchEvent&>(input_event).cancelable); |
358 } | 363 } |
359 | 364 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 // or in-flight event count metrics. | 407 // or in-flight event count metrics. |
403 if (!WebInputEventTraits::IgnoresAckDisposition(input_event)) { | 408 if (!WebInputEventTraits::IgnoresAckDisposition(input_event)) { |
404 input_event_start_time_ = TimeTicks::Now(); | 409 input_event_start_time_ = TimeTicks::Now(); |
405 client_->IncrementInFlightEventCount(); | 410 client_->IncrementInFlightEventCount(); |
406 } | 411 } |
407 return true; | 412 return true; |
408 } | 413 } |
409 return false; | 414 return false; |
410 } | 415 } |
411 | 416 |
| 417 bool InputRouterImpl::OfferToGpuService(const blink::WebInputEvent& input_event, |
| 418 bool is_keyboard_shortcut) { |
| 419 GpuProcessHostUIShim* shim = GpuProcessHostUIShim::GetOneInstance(); |
| 420 return (shim && |
| 421 shim->Send( |
| 422 new GpuMsg_HandleInputEvent(&input_event, is_keyboard_shortcut))); |
| 423 } |
| 424 |
412 void InputRouterImpl::SendSyntheticWheelEventForPinch( | 425 void InputRouterImpl::SendSyntheticWheelEventForPinch( |
413 const GestureEventWithLatencyInfo& pinch_event) { | 426 const GestureEventWithLatencyInfo& pinch_event) { |
414 // We match typical trackpad behavior on Windows by sending fake wheel events | 427 // We match typical trackpad behavior on Windows by sending fake wheel events |
415 // with the ctrl modifier set when we see trackpad pinch gestures. Ideally | 428 // with the ctrl modifier set when we see trackpad pinch gestures. Ideally |
416 // we'd someday get a standard 'pinch' event and send that instead. | 429 // we'd someday get a standard 'pinch' event and send that instead. |
417 | 430 |
418 WebMouseWheelEvent wheelEvent; | 431 WebMouseWheelEvent wheelEvent; |
419 wheelEvent.type = WebInputEvent::MouseWheel; | 432 wheelEvent.type = WebInputEvent::MouseWheel; |
420 wheelEvent.timeStampSeconds = pinch_event.event.timeStampSeconds; | 433 wheelEvent.timeStampSeconds = pinch_event.event.timeStampSeconds; |
421 wheelEvent.windowX = wheelEvent.x = pinch_event.event.x; | 434 wheelEvent.windowX = wheelEvent.x = pinch_event.event.x; |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( | 703 InputRouterImpl::QueuedWheelEvent::QueuedWheelEvent( |
691 const MouseWheelEventWithLatencyInfo& event, | 704 const MouseWheelEventWithLatencyInfo& event, |
692 bool synthesized_from_pinch) | 705 bool synthesized_from_pinch) |
693 : event(event), synthesized_from_pinch(synthesized_from_pinch) { | 706 : event(event), synthesized_from_pinch(synthesized_from_pinch) { |
694 } | 707 } |
695 | 708 |
696 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { | 709 InputRouterImpl::QueuedWheelEvent::~QueuedWheelEvent() { |
697 } | 710 } |
698 | 711 |
699 } // namespace content | 712 } // namespace content |
OLD | NEW |