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

Unified Diff: chrome/browser/android/vr_shell/vr_shell.cc

Issue 2510083004: WebVR: enable Cardboard button compatibility (Closed)
Patch Set: Also support controller touchpad click for compatibility Created 4 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell.cc b/chrome/browser/android/vr_shell/vr_shell.cc
index 48a19ba7428bd18e1c01cffffc3b08cfa2120c9f..1e6195164e3dd8951c6254e85e675c77a9c8020e 100644
--- a/chrome/browser/android/vr_shell/vr_shell.cc
+++ b/chrome/browser/android/vr_shell/vr_shell.cc
@@ -375,6 +375,21 @@ void VrShell::UpdateController(const gvr::Vec3f& forward_vector) {
}
#endif
if (html_interface_->GetMode() == UiInterface::Mode::WEB_VR) {
+ // Process screen touch events for Cardboard button compatibility.
+ // Also send tap events for controller "touchpad click" events.
+ if (touch_pending_ || controller_->IsButtonUp(
+ gvr::ControllerButton::GVR_CONTROLLER_BUTTON_CLICK)) {
+ touch_pending_ = false;
+ std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent());
+ gesture->sourceDevice = blink::WebGestureDeviceTouchpad;
+ gesture->timeStampSeconds =
+ (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF();
+ gesture->type = WebInputEvent::GestureTapDown;
+ gesture->data.tapDown.width = 0;
+ gesture->data.tapDown.height = 0;
+ content_input_manager_->ProcessUpdatedGesture(*gesture.get());
+ }
+
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698