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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java

Issue 2879973002: Expose Gamepad API instance for Cardboard button (Closed)
Patch Set: rebase 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/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
index aff70783ec833767b94a72b89916cdf694855b6e..98f9dcb5b269da59ecc00d5b59c096649471fbf2 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java
@@ -230,7 +230,13 @@ public class VrShellImpl
public boolean onTouch(View v, MotionEvent event) {
if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
mthiesse 2017/05/16 00:44:37 I think you can remove the switch checks. onTouch
&& event.getActionMasked() == MotionEvent.ACTION_DOWN) {
- nativeOnTriggerEvent(mNativeVrShell);
+ nativeOnTriggerEvent(mNativeVrShell, true);
+ return true;
+ }
+ if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
+ && (event.getActionMasked() == MotionEvent.ACTION_UP
+ || event.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
+ nativeOnTriggerEvent(mNativeVrShell, false);
return true;
}
return false;
@@ -405,8 +411,12 @@ public class VrShellImpl
boolean cardboardTriggered = false;
if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
&& event.getActionMasked() == MotionEvent.ACTION_DOWN) {
- nativeOnTriggerEvent(mNativeVrShell);
+ nativeOnTriggerEvent(mNativeVrShell, true);
cardboardTriggered = true;
+ } else if (CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV)
+ && (event.getActionMasked() == MotionEvent.ACTION_UP
+ || event.getActionMasked() == MotionEvent.ACTION_CANCEL)) {
+ nativeOnTriggerEvent(mNativeVrShell, false);
}
boolean parentConsumed = super.dispatchTouchEvent(event);
if (mOnDispatchTouchEventForTesting != null) {
@@ -605,7 +615,7 @@ public class VrShellImpl
private native void nativeSwapContents(
long nativeVrShell, WebContents webContents, MotionEventSynthesizer eventSynthesizer);
private native void nativeDestroy(long nativeVrShell);
- private native void nativeOnTriggerEvent(long nativeVrShell);
+ private native void nativeOnTriggerEvent(long nativeVrShell, boolean touched);
private native void nativeOnPause(long nativeVrShell);
private native void nativeOnResume(long nativeVrShell);
private native void nativeOnLoadProgressChanged(long nativeVrShell, double progress);
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_controller.cc » ('j') | chrome/browser/android/vr_shell/vr_shell.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698