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

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

Issue 2829193003: Autopresent WebVR content in CCT if it was opened by a Daydream Intent (Closed)
Patch Set: reviews 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 | « chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java ('k') | 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 e1e1fb7853516077a6bae0db7de27a2ac3bc20d1..4014645eab8873b433cd87a4cef6b146c9a52098 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
@@ -78,6 +78,8 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
@IntDef({VR_NOT_AVAILABLE, VR_CARDBOARD, VR_DAYDREAM})
private @interface VrSupportLevel {}
+ private static final String DAYDREAM_VR_EXTRA = "android.intent.extra.VR_LAUNCH";
+
// Linter and formatter disagree on how the line below should be formatted.
/* package */
static final String VR_ENTRY_RESULT_ACTION =
@@ -257,6 +259,13 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
unregisterDaydreamIntent(api);
}
+ /**
+ * Whether or not the intent is a Daydream VR Intent.
+ */
+ public static boolean isDaydreamVrIntent(Intent intent) {
+ return intent.getBooleanExtra(DAYDREAM_VR_EXTRA, false);
+ }
+
@CalledByNative
private static VrShellDelegate getInstance() {
Activity activity = ApplicationStatus.getLastTrackedFocusedActivity();
@@ -689,6 +698,11 @@ public class VrShellDelegate implements ApplicationStatus.ActivityStateListener,
mListeningForWebVrActivate = listening;
if (listening) {
registerDaydreamIntent(mVrDaydreamApi, mActivity);
+ if (mActivity.shouldAutoPresent()) {
+ // Dispatch a vrdisplayactivate event to trigger WebVR page calling requestPresent.
+ // This should start WebVR presentation.
+ nativeDisplayActivate(mNativeVrShellDelegate);
+ }
} else {
unregisterDaydreamIntent(mVrDaydreamApi);
}
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698