Chromium Code Reviews| 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 6112be34e224d80e8ea6d69d70165874a9ea9491..fb0344aaa61eb22a32e44d0229e00023407ef1da 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 |
| @@ -23,6 +23,7 @@ import com.google.vr.ndk.base.GvrLayout; |
| import org.chromium.base.CommandLine; |
| import org.chromium.base.Log; |
| import org.chromium.base.ThreadUtils; |
| +import org.chromium.base.VisibleForTesting; |
| import org.chromium.base.annotations.CalledByNative; |
| import org.chromium.base.annotations.JNINamespace; |
| import org.chromium.chrome.browser.ChromeActivity; |
| @@ -118,6 +119,8 @@ public class VrShellImpl |
| private MotionEventSynthesizer mMotionEventSynthesizer; |
| + private Runnable mOnDispatchTouchEventForTesting; |
| + |
| public VrShellImpl( |
| ChromeActivity activity, VrShellDelegate delegate, TabModelSelector tabModelSelector) { |
| super(activity); |
| @@ -447,7 +450,11 @@ public class VrShellImpl |
| && event.getActionMasked() == MotionEvent.ACTION_DOWN) { |
| nativeOnTriggerEvent(mNativeVrShell); |
|
mthiesse
2017/03/28 18:08:01
Don't we also want to make sure this wasn't called
bsheedy
2017/03/28 20:50:35
Done.
|
| } |
| - return super.dispatchTouchEvent(event); |
| + boolean parentHandled = super.dispatchTouchEvent(event); |
| + if (mOnDispatchTouchEventForTesting != null && parentHandled) { |
| + mOnDispatchTouchEventForTesting.run(); |
| + } |
| + return parentHandled; |
| } |
| @Override |
| @@ -628,6 +635,16 @@ public class VrShellImpl |
| @Override |
| public void removeWindowAndroidChangedObserver(WindowAndroidChangedObserver observer) {} |
| + /** |
| + * Sets the runnable that will be run when VrShellImpl's dispatchTouchEvent |
| + * is run and the parent consumed the event. |
| + * @param runnable The Runnable that will be run |
| + */ |
| + @VisibleForTesting |
| + public void setOnDispatchTouchEventForTesting(Runnable runnable) { |
| + mOnDispatchTouchEventForTesting = runnable; |
| + } |
| + |
| private native long nativeInit(WebContents uiWebContents, long nativeContentWindowAndroid, |
| long nativeUiWindowAndroid, boolean forWebVR, VrShellDelegate delegate, long gvrApi, |
| boolean reprojectedRendering); |