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

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

Issue 2879973002: Expose Gamepad API instance for Cardboard button (Closed)
Patch Set: Created 3 years, 7 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 9bdba4cc81b428493a4b91e82a4fe2ad1be76bba..575ce570e44942980e67fd29ca5249821cf425bf 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -500,7 +500,9 @@ void VrShellGl::UpdateController(const gfx::Vector3dF& head_direction) {
controller_->UpdateState(head_direction);
pointer_start_ = controller_->GetPointerStart();
- browser_->UpdateGamepadData(controller_->GetGamepadData());
+ device::GvrGamepadData controller_data = controller_->GetGamepadData();
+ controller_data.is_screen_touching = currently_touched_;
+ browser_->UpdateGamepadData(controller_data);
}
void VrShellGl::HandleControllerInput(const gfx::Vector3dF& head_direction) {
@@ -514,6 +516,7 @@ void VrShellGl::HandleControllerInput(const gfx::Vector3dF& head_direction) {
std::unique_ptr<WebGestureEvent> gesture(new WebGestureEvent(
WebInputEvent::kGestureTapDown, WebInputEvent::kNoModifiers,
(base::TimeTicks::Now() - base::TimeTicks()).InSecondsF()));
+
billorr1 2017/05/12 18:25:41 nit: remove this extra blank line
billorr1 2017/05/15 23:04:17 Done.
gesture->source_device = blink::kWebGestureDeviceTouchpad;
gesture->x = 0;
gesture->y = 0;
@@ -1191,9 +1194,10 @@ void VrShellGl::DrawWebVr() {
vr_shell_renderer_->GetWebVrRenderer()->Draw(webvr_texture_id_);
}
-void VrShellGl::OnTriggerEvent() {
+void VrShellGl::OnTriggerEvent(bool touching) {
// Set a flag to handle this on the render thread at the next frame.
- touch_pending_ = true;
+ touch_pending_ = touch_pending_ || touching;
+ currently_touched_ = touching;
}
void VrShellGl::OnPause() {

Powered by Google App Engine
This is Rietveld 408576698