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 5d7ed6e6dfcb357eb99e82f46cae9c18ea74e068..5a0ed8991a346ee9a02d0caa45c55df8a5f3e9af 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 |
@@ -93,6 +93,7 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener, |
private static final String DAYDREAM_VR_EXTRA = "android.intent.extra.VR_LAUNCH"; |
private static final String DAYDREAM_HOME_PACKAGE = "com.google.android.vr.home"; |
+ static final String VR_FRE_INTENT_EXTRA = "org.chromium.chrome.browser.vr_shell.VR_FRE"; |
// Linter and formatter disagree on how the line below should be formatted. |
/* package */ |
@@ -412,7 +413,7 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener, |
} |
@SuppressWarnings("unchecked") |
- private static VrClassesWrapper createVrClassesWrapper() { |
+ /* package */ static VrClassesWrapper createVrClassesWrapper() { |
try { |
Class<? extends VrClassesWrapper> vrClassesBuilderClass = |
(Class<? extends VrClassesWrapper>) Class.forName( |
@@ -843,6 +844,19 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener, |
} |
} |
+ /** |
+ * @return An intent that will launch a VR activity that will prompt the |
+ * user to take off their headset and foward the freIntent to the standard |
+ * 2D FRE activity. |
+ */ |
+ public static Intent setupVrFreIntent(Context context, Intent freIntent) { |
+ Intent intent = new Intent(); |
+ intent.setClassName(context, VrFirstRunActivity.class.getName()); |
+ intent.putExtra(VR_FRE_INTENT_EXTRA, new Intent(freIntent)); |
+ intent.putExtra(DAYDREAM_VR_EXTRA, true); |
+ return intent; |
+ } |
+ |
/** |
* @return Whether or not the given intent is a VR-specific intent. |
*/ |
@@ -850,6 +864,13 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener, |
return IntentUtils.safeGetBooleanExtra(intent, DAYDREAM_VR_EXTRA, false); |
} |
+ /* |
+ * Remove VR-specific extras from the given intent. |
+ */ |
+ public static void removeVrExtras(Intent intent) { |
+ intent.removeExtra(DAYDREAM_VR_EXTRA); |
+ } |
+ |
/** |
* @return Options that a VR-specific Chrome activity should be launched with. |
*/ |