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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_event_handler.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 years, 11 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
OLDNEW
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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return true; 90 return true;
91 } 91 }
92 #endif 92 #endif
93 return false; 93 return false;
94 } 94 }
95 95
96 // Reset unchanged touch points to StateStationary for touchmove and 96 // Reset unchanged touch points to StateStationary for touchmove and
97 // touchcancel. 97 // touchcancel.
98 void MarkUnchangedTouchPointsAsStationary(blink::WebTouchEvent* event, 98 void MarkUnchangedTouchPointsAsStationary(blink::WebTouchEvent* event,
99 int changed_touch_id) { 99 int changed_touch_id) {
100 if (event->type == blink::WebInputEvent::TouchMove || 100 if (event->type() == blink::WebInputEvent::TouchMove ||
101 event->type == blink::WebInputEvent::TouchCancel) { 101 event->type() == blink::WebInputEvent::TouchCancel) {
102 for (size_t i = 0; i < event->touchesLength; ++i) { 102 for (size_t i = 0; i < event->touchesLength; ++i) {
103 if (event->touches[i].id != changed_touch_id) 103 if (event->touches[i].id != changed_touch_id)
104 event->touches[i].state = blink::WebTouchPoint::StateStationary; 104 event->touches[i].state = blink::WebTouchPoint::StateStationary;
105 } 105 }
106 } 106 }
107 } 107 }
108 108
109 bool NeedsInputGrab(content::RenderWidgetHostViewBase* view) { 109 bool NeedsInputGrab(content::RenderWidgetHostViewBase* view) {
110 if (!view) 110 if (!view)
111 return false; 111 return false;
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen; 509 fling_cancel.sourceDevice = blink::WebGestureDeviceTouchscreen;
510 if (ShouldRouteEvent(event)) { 510 if (ShouldRouteEvent(event)) {
511 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 511 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
512 host_view_, &fling_cancel, 512 host_view_, &fling_cancel,
513 ui::LatencyInfo(ui::SourceEventType::TOUCH)); 513 ui::LatencyInfo(ui::SourceEventType::TOUCH));
514 } else { 514 } else {
515 host_->ForwardGestureEvent(fling_cancel); 515 host_->ForwardGestureEvent(fling_cancel);
516 } 516 }
517 } 517 }
518 518
519 if (gesture.type != blink::WebInputEvent::Undefined) { 519 if (gesture.type() != blink::WebInputEvent::Undefined) {
520 if (ShouldRouteEvent(event)) { 520 if (ShouldRouteEvent(event)) {
521 host_->delegate()->GetInputEventRouter()->RouteGestureEvent( 521 host_->delegate()->GetInputEventRouter()->RouteGestureEvent(
522 host_view_, &gesture, *event->latency()); 522 host_view_, &gesture, *event->latency());
523 } else { 523 } else {
524 host_->ForwardGestureEventWithLatencyInfo(gesture, *event->latency()); 524 host_->ForwardGestureEventWithLatencyInfo(gesture, *event->latency());
525 } 525 }
526 526
527 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN || 527 if (event->type() == ui::ET_GESTURE_SCROLL_BEGIN ||
528 event->type() == ui::ET_GESTURE_SCROLL_UPDATE || 528 event->type() == ui::ET_GESTURE_SCROLL_UPDATE ||
529 event->type() == ui::ET_GESTURE_SCROLL_END) { 529 event->type() == ui::ET_GESTURE_SCROLL_END) {
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 host_->ForwardWheelEventWithLatencyInfo(event, latency); 864 host_->ForwardWheelEventWithLatencyInfo(event, latency);
865 } 865 }
866 866
867 void RenderWidgetHostViewEventHandler::ProcessTouchEvent( 867 void RenderWidgetHostViewEventHandler::ProcessTouchEvent(
868 const blink::WebTouchEvent& event, 868 const blink::WebTouchEvent& event,
869 const ui::LatencyInfo& latency) { 869 const ui::LatencyInfo& latency) {
870 host_->ForwardTouchEventWithLatencyInfo(event, latency); 870 host_->ForwardTouchEventWithLatencyInfo(event, latency);
871 } 871 }
872 872
873 } // namespace content 873 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698