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

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

Issue 2538053003: Implement vrdisplayactivate for GVR DON. (Closed)
Patch Set: Created 4 years 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 5eae53af461b4953e6dd818f95b0c6636a10e0cf..1132f97beec700f3708938b1a323ee4280261f43 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
@@ -144,11 +144,15 @@ public class VrShellDelegate {
}
/**
- * Handle a VR intent, entering VR in the process.
+ * Handle a VR intent, entering VR in the process unless we're unable to.
*/
public void enterVRFromIntent(Intent intent) {
if (!mVrAvailable) return;
assert isVrIntent(intent);
+ if (mListeningForWebVrActivate && !mRequestedWebVR) {
+ nativeDisplayActivate(mNativeVrShellDelegate);
+ return;
+ }
if (enterVR()) {
if (mRequestedWebVR) {
nativeSetPresentResult(mNativeVrShellDelegate, true);
@@ -201,7 +205,7 @@ public class VrShellDelegate {
// If vr isn't in the build, or we haven't initialized yet, or vr shell is not enabled and
// this is not a web vr request, then return immediately.
if (!mVrAvailable || mNativeVrShellDelegate == 0
- || (!isVrShellEnabled() && !mRequestedWebVR)) {
+ || (!isVrShellEnabled() && !(mRequestedWebVR || mListeningForWebVrActivate))) {
return false;
}
// TODO(mthiesse): When we have VR UI for opening new tabs, etc., allow VR Shell to be
@@ -267,9 +271,7 @@ public class VrShellDelegate {
*/
public void maybeResumeVR() {
if (!mVrAvailable) return;
- // TODO(mthiesse): Register the intent when on a page that supports WebVR, even if VrShell
- // isn't enabled.
- if (isVrShellEnabled()) {
+ if (isVrShellEnabled() || mListeningForWebVrActivate) {
registerDaydreamIntent();
}
// If this is still set, it means the user backed out of the DON flow, and we won't be
@@ -391,6 +393,11 @@ public class VrShellDelegate {
@CalledByNative
private void setListeningForWebVrActivate(boolean listening) {
mListeningForWebVrActivate = listening;
+ if (listening) {
+ registerDaydreamIntent();
+ } else {
+ unregisterDaydreamIntent();
+ }
}
/**
@@ -556,4 +563,5 @@ public class VrShellDelegate {
private native long nativeInit();
private native void nativeSetPresentResult(long nativeVrShellDelegate, boolean result);
+ private native void nativeDisplayActivate(long nativeVrShellDelegate);
}
« 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