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

Unified Diff: chrome/browser/android/vr_shell/vr_controller.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/net/input_message_unittest.cc ('k') | chrome/browser/android/vr_shell/vr_input_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_controller.cc
diff --git a/chrome/browser/android/vr_shell/vr_controller.cc b/chrome/browser/android/vr_shell/vr_controller.cc
index 0cf8b166031931f0a267459c63539e48908735c7..5df13277c3ccf5b5df3f65f189f5198123c619b9 100644
--- a/chrome/browser/android/vr_shell/vr_controller.cc
+++ b/chrome/browser/android/vr_shell/vr_controller.cc
@@ -196,21 +196,21 @@ std::vector<std::unique_ptr<WebGestureEvent>> VrController::DetectGestures() {
UpdateTouchInfo();
UpdateGestureFromTouchInfo(gesture.get());
- if (gesture->type == WebInputEvent::Undefined &&
+ if (gesture->type() == WebInputEvent::Undefined &&
ButtonUpHappened(gvr::kControllerButtonClick)) {
- gesture->type = WebInputEvent::GestureTapDown;
+ gesture->setType(WebInputEvent::GestureTapDown);
gesture->x = 0;
gesture->y = 0;
}
gesture->sourceDevice = blink::WebGestureDeviceTouchpad;
gesture_list.push_back(std::move(gesture));
- if (gesture_list.back()->type == WebInputEvent::GestureScrollEnd) {
+ if (gesture_list.back()->type() == WebInputEvent::GestureScrollEnd) {
if (!ButtonDownHappened(gvr::kControllerButtonClick)) {
- std::unique_ptr<WebGestureEvent> fling(new WebGestureEvent());
- fling->timeStampSeconds = gesture_list.back()->timeStampSeconds;
+ std::unique_ptr<WebGestureEvent> fling(new WebGestureEvent(
+ WebInputEvent::GestureFlingStart, WebInputEvent::NoModifiers,
+ gesture_list.back()->timeStampSeconds()));
fling->sourceDevice = blink::WebGestureDeviceTouchpad;
- fling->type = WebInputEvent::GestureFlingStart;
if (IsHorizontalGesture()) {
fling->data.flingStart.velocityX =
overall_velocity_.x * kDisplacementScaleFactor;
@@ -227,8 +227,8 @@ std::vector<std::unique_ptr<WebGestureEvent>> VrController::DetectGestures() {
}
void VrController::UpdateGestureFromTouchInfo(WebGestureEvent* gesture) {
- gesture->timeStampSeconds =
- (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
+ gesture->setTimeStampSeconds(
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF());
switch (state_) {
// User has not put finger on touch pad.
case WAITING:
@@ -258,7 +258,7 @@ void VrController::HandleWaitingState(WebGestureEvent* gesture) {
*cur_touch_point_ = touch_info_->touch_point;
state_ = TOUCHING;
- gesture->type = WebInputEvent::GestureFlingCancel;
+ gesture->setType(WebInputEvent::GestureFlingCancel);
gesture->data.flingCancel.preventBoosting = false;
}
}
@@ -276,7 +276,7 @@ void VrController::HandleDetectingState(WebGestureEvent* gesture) {
!InSlop(touch_info_->touch_point.position) &&
!ButtonDownHappened(gvr::kControllerButtonClick)) {
state_ = SCROLLING;
- gesture->type = WebInputEvent::GestureScrollBegin;
+ gesture->setType(WebInputEvent::GestureScrollBegin);
UpdateGesture(gesture);
gesture->data.scrollBegin.deltaXHint =
displacement_.x * kDisplacementScaleFactor;
@@ -291,11 +291,11 @@ void VrController::HandleScrollingState(WebGestureEvent* gesture) {
if (touch_info_->touch_up || !(touch_info_->is_touching) ||
ButtonDownHappened(gvr::kControllerButtonClick)) {
// Gesture ends.
- gesture->type = WebInputEvent::GestureScrollEnd;
+ gesture->setType(WebInputEvent::GestureScrollEnd);
UpdateGesture(gesture);
} else if (touch_position_changed) {
// User continues scrolling and there is a change in touch position.
- gesture->type = WebInputEvent::GestureScrollUpdate;
+ gesture->setType(WebInputEvent::GestureScrollUpdate);
UpdateGesture(gesture);
if (IsHorizontalGesture()) {
gesture->data.scrollUpdate.deltaX =
« no previous file with comments | « blimp/net/input_message_unittest.cc ('k') | chrome/browser/android/vr_shell/vr_input_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698