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

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

Issue 2844833005: Tentatively goes into WebVR presentation mode if page listens to vrdisplayactivate. (Closed)
Patch Set: Fixed device unit tests Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 12248dc0ac68a32084809b85d256dcccf3f32637..24c4098ae32dacee2afaa8e7e1b02ada3f8e4523 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -434,11 +434,15 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
nativeDisplayActivate(mNativeVrShellDelegate);
}
- enterVr();
+ // If the page is listening for vrdisplayactivate we assume it wants to request
+ // presentation. Go into WebVR mode tentatively. If the page doesn't request presentation
+ // in the vrdisplayactivate handler we will exit presentation later.
+ enterVr(mListeningForWebVrActivateBeforePause && !mRequestedWebVr);
+
return true;
}
- private void enterVr() {
+ private void enterVr(final boolean tentativeWebVrMode) {
// We can't enter VR before the application resumes, or we encounter bizarre crashes
// related to gpu surfaces.
assert !mPaused;
@@ -449,7 +453,7 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
new Handler().post(new Runnable() {
@Override
public void run() {
- enterVr();
+ enterVr(tentativeWebVrMode);
}
});
return;
@@ -465,8 +469,9 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
addVrViews();
- mVrShell.initializeNative(mActivity.getActivityTab(), mRequestedWebVr);
- mVrShell.setWebVrModeEnabled(mRequestedWebVr);
+ mVrShell.initializeNative(
+ mActivity.getActivityTab(), mRequestedWebVr || tentativeWebVrMode);
+ mVrShell.setWebVrModeEnabled(mRequestedWebVr || tentativeWebVrMode);
// onResume needs to be called on GvrLayout after initialization to make sure DON flow work
// properly.
@@ -560,7 +565,7 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
if (mVrSupportLevel == VR_CARDBOARD || !mVrDaydreamApi.isDaydreamCurrentViewer()) {
// Avoid using launchInVr which would trigger DON flow regardless current viewer type
// due to the lack of support for unexported activities.
- enterVr();
+ enterVr(false);
} else {
// LANDSCAPE orientation is needed before we can safely enter VR. DON can make sure that
// the device is at LANDSCAPE orientation once it is finished. So here we use SENSOR to
« no previous file with comments | « no previous file | chrome/browser/android/vr_shell/vr_shell_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698