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

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

Issue 2539763004: Don't dispatch vrdisplayactivate event if the page that listens for it is invisible (Closed)
Patch Set: Nit 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 | third_party/WebKit/Source/modules/vr/NavigatorVR.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 393aba6c96bf6928e16868bc8f961663ac019066..b3031ddc729210e2ea38691af70656d535508b12 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
@@ -84,6 +84,7 @@ public class VrShellDelegate {
private boolean mRequestedWebVR;
private long mLastVRExit;
private boolean mListeningForWebVrActivate;
+ private boolean mListeningForWebVrActivateBeforePause;
public VrShellDelegate(ChromeTabbedActivity activity) {
mActivity = activity;
@@ -149,7 +150,7 @@ public class VrShellDelegate {
public void enterVRFromIntent(Intent intent) {
if (!mVrAvailable) return;
assert isVrIntent(intent);
- if (mListeningForWebVrActivate && !mRequestedWebVR) {
+ if (mListeningForWebVrActivateBeforePause && !mRequestedWebVR) {
mthiesse 2016/11/30 19:02:03 Should add a block for if (!mListeningForWebVrActi
bshe 2016/11/30 19:16:28 Agree it should be fixed. But this is a different
mthiesse 2016/11/30 19:31:42 I think it's an issue that's caused by this CL, so
bshe 2016/11/30 22:01:09 Discussed offline. There is another issue which re
nativeDisplayActivate(mNativeVrShellDelegate);
return;
}
@@ -277,7 +278,7 @@ public class VrShellDelegate {
*/
public void maybeResumeVR() {
if (!mVrAvailable) return;
- if (isVrShellEnabled() || mListeningForWebVrActivate) {
+ if (isVrShellEnabled() || mListeningForWebVrActivateBeforePause) {
registerDaydreamIntent();
}
// If this is still set, it means the user backed out of the DON flow, and we won't be
@@ -323,6 +324,14 @@ public class VrShellDelegate {
if (!mVrAvailable) return;
unregisterDaydreamIntent();
+ // When the active web page has a vrdisplayactivate event handler,
+ // mListeningForWebVrActivate should be set to true, which means a vrdisplayactive event
+ // should be fired once DON flow finished. However, DON flow will pause our activity, which
+ // makes the active page becomes invisible. And the event fires before the active page
+ // becomes visible again after DON finished. So here we remember the value of
+ // mListeningForWebVrActivity before pause and use this value to decide if vrdisplayactivate
+ // event should be dispatched in enterVRFromIntent.
+ mListeningForWebVrActivateBeforePause = mListeningForWebVrActivate;
if (mNonPresentingGvrContext != null) {
mNonPresentingGvrContext.pause();
}
« no previous file with comments | « no previous file | third_party/WebKit/Source/modules/vr/NavigatorVR.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698