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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.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
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 43a4f60ad4f5fcc845ba7282a004bb71add5a4f6..e3252d27f96f8be0ad32f5feba9bb4c01b9ae93f 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -121,16 +121,14 @@ std::unique_ptr<blink::WebMouseEvent> MakeMouseEvent(WebInputEvent::Type type,
double timestamp,
float x,
float y) {
- std::unique_ptr<blink::WebMouseEvent> mouse_event(new blink::WebMouseEvent);
- mouse_event->type = type;
+ std::unique_ptr<blink::WebMouseEvent> mouse_event(new blink::WebMouseEvent(
+ type, blink::WebInputEvent::NoModifiers, timestamp));
mouse_event->pointerType = blink::WebPointerProperties::PointerType::Mouse;
mouse_event->x = x;
mouse_event->y = y;
mouse_event->windowX = x;
mouse_event->windowY = y;
- mouse_event->timeStampSeconds = timestamp;
mouse_event->clickCount = 1;
- mouse_event->modifiers = 0;
return mouse_event;
}
@@ -417,11 +415,10 @@ void VrShellGl::UpdateController(const gvr::Vec3f& forward_vector) {
if (touch_pending_ || controller_->ButtonUpHappened(
gvr::ControllerButton::GVR_CONTROLLER_BUTTON_CLICK)) {
touch_pending_ = false;
- std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent());
+ std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent(
+ WebInputEvent::GestureTapDown, WebInputEvent::NoModifiers,
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
gesture->sourceDevice = blink::WebGestureDeviceTouchpad;
- gesture->timeStampSeconds =
- (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
- gesture->type = WebInputEvent::GestureTapDown;
gesture->x = 0;
gesture->y = 0;
SendGesture(InputTarget::CONTENT, std::move(gesture));
@@ -528,21 +525,20 @@ void VrShellGl::SendEventsToTarget(InputTarget input_target,
int pixel_y) {
std::vector<std::unique_ptr<WebGestureEvent>> gesture_list =
controller_->DetectGestures();
- double timestamp = gesture_list.front()->timeStampSeconds;
+ double timestamp = gesture_list.front()->timeStampSeconds();
if (touch_pending_) {
touch_pending_ = false;
- std::unique_ptr<WebGestureEvent> event(new WebGestureEvent());
- event->type = WebInputEvent::GestureTapDown;
+ std::unique_ptr<WebGestureEvent> event(new WebGestureEvent(
+ WebInputEvent::GestureTapDown, WebInputEvent::NoModifiers, timestamp));
event->sourceDevice = blink::WebGestureDeviceTouchpad;
- event->timeStampSeconds = timestamp;
event->x = pixel_x;
event->y = pixel_y;
gesture_list.push_back(std::move(event));
}
for (const auto& gesture : gesture_list) {
- switch (gesture->type) {
+ switch (gesture->type()) {
case WebInputEvent::GestureScrollBegin:
case WebInputEvent::GestureScrollUpdate:
case WebInputEvent::GestureScrollEnd:
« no previous file with comments | « chrome/browser/android/vr_shell/vr_input_manager.cc ('k') | chrome/browser/chromeos/first_run/first_run_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698