| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/render_widget_host_view_event_handler.h" | 5 #include "content/browser/renderer_host/render_widget_host_view_event_handler.h" |
| 6 | 6 |
| 7 #include "base/metrics/user_metrics_action.h" | 7 #include "base/metrics/user_metrics_action.h" |
| 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 8 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
| 9 #include "content/browser/renderer_host/overscroll_controller.h" | 9 #include "content/browser/renderer_host/overscroll_controller.h" |
| 10 #include "content/browser/renderer_host/render_view_host_delegate.h" | 10 #include "content/browser/renderer_host/render_view_host_delegate.h" |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 406 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 407 host_view_, &gesture_event, | 407 host_view_, &gesture_event, |
| 408 ui::LatencyInfo(ui::SourceEventType::WHEEL)); | 408 ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
| 409 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( | 409 host_->delegate()->GetInputEventRouter()->RouteMouseWheelEvent( |
| 410 host_view_, &mouse_wheel_event, *event->latency()); | 410 host_view_, &mouse_wheel_event, *event->latency()); |
| 411 } else { | 411 } else { |
| 412 host_->ForwardGestureEvent(gesture_event); | 412 host_->ForwardGestureEvent(gesture_event); |
| 413 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, | 413 host_->ForwardWheelEventWithLatencyInfo(mouse_wheel_event, |
| 414 *event->latency()); | 414 *event->latency()); |
| 415 } | 415 } |
| 416 RecordAction(base::UserMetricsAction("TrackpadScroll")); | |
| 417 } else if (event->type() == ui::ET_SCROLL_FLING_START || | 416 } else if (event->type() == ui::ET_SCROLL_FLING_START || |
| 418 event->type() == ui::ET_SCROLL_FLING_CANCEL) { | 417 event->type() == ui::ET_SCROLL_FLING_CANCEL) { |
| 419 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent( | 418 blink::WebGestureEvent gesture_event = ui::MakeWebGestureEvent( |
| 420 *event, base::Bind(&GetScreenLocationFromEvent)); | 419 *event, base::Bind(&GetScreenLocationFromEvent)); |
| 421 if (ShouldRouteEvent(event)) { | 420 if (ShouldRouteEvent(event)) { |
| 422 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 421 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 423 host_view_, &gesture_event, | 422 host_view_, &gesture_event, |
| 424 ui::LatencyInfo(ui::SourceEventType::WHEEL)); | 423 ui::LatencyInfo(ui::SourceEventType::WHEEL)); |
| 425 } else { | 424 } else { |
| 426 host_->ForwardGestureEvent(gesture_event); | 425 host_->ForwardGestureEvent(gesture_event); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 } | 516 } |
| 518 | 517 |
| 519 if (gesture.type() != blink::WebInputEvent::Undefined) { | 518 if (gesture.type() != blink::WebInputEvent::Undefined) { |
| 520 if (ShouldRouteEvent(event)) { | 519 if (ShouldRouteEvent(event)) { |
| 521 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( | 520 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( |
| 522 host_view_, &gesture, *event->latency()); | 521 host_view_, &gesture, *event->latency()); |
| 523 } else { | 522 } else { |
| 524 host_->ForwardGestureEventWithLatencyInfo(gesture, *event->latency()); | 523 host_->ForwardGestureEventWithLatencyInfo(gesture, *event->latency()); |
| 525 } | 524 } |
| 526 | 525 |
| 527 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || | 526 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN) { |
| 528 event->type() == ui::ET_GESTURE_SCROLL_UPDATE || | |
| 529 event->type() == ui::ET_GESTURE_SCROLL_END) { | |
| 530 RecordAction(base::UserMetricsAction("TouchscreenScroll")); | 527 RecordAction(base::UserMetricsAction("TouchscreenScroll")); |
| 531 } else if (event->type() == ui::ET_SCROLL_FLING_START) { | 528 } else if (event->type() == ui::ET_SCROLL_FLING_START) { |
| 532 RecordAction(base::UserMetricsAction("TouchscreenScrollFling")); | 529 RecordAction(base::UserMetricsAction("TouchscreenScrollFling")); |
| 533 } | 530 } |
| 534 } | 531 } |
| 535 | 532 |
| 536 // If a gesture is not processed by the webpage, then WebKit processes it | 533 // If a gesture is not processed by the webpage, then WebKit processes it |
| 537 // (e.g. generates synthetic mouse events). | 534 // (e.g. generates synthetic mouse events). |
| 538 event->SetHandled(); | 535 event->SetHandled(); |
| 539 } | 536 } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 host_->ForwardWheelEventWithLatencyInfo(event, latency); | 857 host_->ForwardWheelEventWithLatencyInfo(event, latency); |
| 861 } | 858 } |
| 862 | 859 |
| 863 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( | 860 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( |
| 864 const blink::WebTouchEvent& event, | 861 const blink::WebTouchEvent& event, |
| 865 const ui::LatencyInfo& latency) { | 862 const ui::LatencyInfo& latency) { |
| 866 host_->ForwardTouchEventWithLatencyInfo(event, latency); | 863 host_->ForwardTouchEventWithLatencyInfo(event, latency); |
| 867 } | 864 } |
| 868 | 865 |
| 869 } // namespace content | 866 } // namespace content |
| OLD | NEW |