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

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

Issue 2516453002: Be more selective about when we show the "Take off your headset" flow. (Closed)
Patch Set: rebase Created 4 years, 1 month 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 | no next file » | 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 5eae53af461b4953e6dd818f95b0c6636a10e0cf..6558d50aec1b1ec9e2ed913d3041596782c1c31a 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
@@ -99,7 +99,7 @@ public class VrShellDelegate {
public void onContentChanged(Tab tab) {
if (tab.getNativePage() != null || tab.isShowingSadTab()) {
// For now we don't handle native pages. crbug.com/661609
- exitVRIfNecessary(true);
+ shutdownVR(true, true);
}
}
@@ -258,7 +258,7 @@ public class VrShellDelegate {
// TODO(bajones): Once VR Shell can be invoked outside of WebVR this
// should no longer exit the shell outright. Need a way to determine
// how VrShell was created.
- shutdownVR(true);
+ shutdownVR(true, !isVrShellEnabled());
return true;
}
@@ -332,7 +332,7 @@ public class VrShellDelegate {
public boolean exitVRIfNecessary(boolean returnTo2D) {
if (!mVrAvailable) return false;
if (!mInVr) return false;
- shutdownVR(returnTo2D);
+ shutdownVR(returnTo2D, false);
return true;
}
@@ -396,11 +396,15 @@ public class VrShellDelegate {
/**
* Exits VR Shell, performing all necessary cleanup.
*/
- private void shutdownVR(boolean returnTo2D) {
+ private void shutdownVR(boolean returnTo2D, boolean showTransition) {
if (!mInVr) return;
mRequestedWebVR = false;
if (returnTo2D) {
- mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent());
+ if (showTransition) {
+ mVrDaydreamApi.exitFromVr(EXIT_VR_RESULT, new Intent());
+ } else {
+ mVrDaydreamApi.setVrModeEnabled(false);
+ }
} else {
mVrDaydreamApi.setVrModeEnabled(false);
mLastVRExit = SystemClock.uptimeMillis();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698