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 b6dc72ea8676e4545508a5aa2441960ba368a803..3336fb6c9740542687a41a9e00583c294b1e0bf9 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 |
@@ -231,7 +231,13 @@ public class VrShellImpl |
public boolean onTouch(View v, MotionEvent event) { |
if (!CommandLine.getInstance().hasSwitch(ChromeSwitches.ENABLE_VR_SHELL_DEV) |
&& 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 |
billorr1
2017/05/12 18:25:41
nit: must have tabs instead of spaces... fix this
billorr1
2017/05/15 23:04:17
Done.
|
+ || event.getActionMasked() == MotionEvent.ACTION_CANCEL)) { |
+ nativeOnTriggerEvent(mNativeVrShell, false); |
return true; |
} |
return false; |
@@ -396,8 +402,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) { |
@@ -596,7 +606,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); |