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

Unified Diff: third_party/WebKit/Source/modules/vr/NavigatorVR.h

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
Index: third_party/WebKit/Source/modules/vr/NavigatorVR.h
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVR.h b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
index b023345f89a5c6f5aa27f291f595be79dcd9fb9a..a88a304a318fc06d683fcb880b648fba403ab537 100644
--- a/third_party/WebKit/Source/modules/vr/NavigatorVR.h
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
@@ -8,6 +8,7 @@
#include "bindings/core/v8/ScriptPromise.h"
#include "core/frame/DOMWindowProperty.h"
#include "core/frame/LocalDOMWindow.h"
+#include "core/page/PageVisibilityObserver.h"
#include "modules/ModulesExport.h"
#include "modules/vr/VRDisplay.h"
#include "modules/vr/VRDisplayEvent.h"
@@ -26,6 +27,7 @@ class MODULES_EXPORT NavigatorVR final
: public GarbageCollectedFinalized<NavigatorVR>,
public Supplement<Navigator>,
public DOMWindowProperty,
+ public PageVisibilityObserver,
public LocalDOMWindow::EventListenerObserver {
USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR);
WTF_MAKE_NONCOPYABLE(NavigatorVR);
@@ -47,6 +49,9 @@ class MODULES_EXPORT NavigatorVR final
// Dispatches a user gesture event immediately.
void dispatchVRGestureEvent(VRDisplayEvent*);
+ // Inherited from PageVisibilityObserver.
+ void pageVisibilityChanged() override;
+
// Inherited from LocalDOMWindow::EventListenerObserver.
void didAddEventListener(LocalDOMWindow*, const AtomicString&) override;
void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override;
@@ -65,6 +70,9 @@ class MODULES_EXPORT NavigatorVR final
void fireVRDisplayPresentChange(VRDisplay*);
Member<VRController> m_controller;
+
+ // Whether this page is listening for vrdisplayactivate event.
+ bool m_listeningForActivate = false;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698