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

Unified Diff: Source/modules/device_orientation/DeviceMotionController.h

Issue 23705010: Add page visibility observer support for Device Motion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Improve the test Created 7 years, 3 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
Index: Source/modules/device_orientation/DeviceMotionController.h
diff --git a/Source/modules/device_orientation/DeviceMotionController.h b/Source/modules/device_orientation/DeviceMotionController.h
index dd6a24caee724302c54f8099be46d8bde9f7f007..249e3719d4b6430967cbe42eb63b83a57fa99b09 100644
--- a/Source/modules/device_orientation/DeviceMotionController.h
+++ b/Source/modules/device_orientation/DeviceMotionController.h
@@ -29,6 +29,7 @@
#include "core/dom/Event.h"
#include "core/page/DOMWindowLifecycleObserver.h"
+#include "core/page/PageLifecycleObserver.h"
#include "core/platform/Supplementable.h"
#include "modules/device_orientation/DeviceSensorEventController.h"
@@ -37,7 +38,7 @@ namespace WebCore {
class DeviceMotionData;
class DOMWindow;
-class DeviceMotionController : public DeviceSensorEventController, public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver {
+class DeviceMotionController : public DeviceSensorEventController, public Supplement<ScriptExecutionContext>, public DOMWindowLifecycleObserver, public PageLifecycleObserver {
public:
virtual ~DeviceMotionController();
@@ -47,19 +48,24 @@ public:
void didChangeDeviceMotion(DeviceMotionData*);
- // Inherited from DOMWindowLifecycleObserver
- virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
- virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
- virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE;
-
private:
explicit DeviceMotionController(Document*);
virtual void registerWithDispatcher() OVERRIDE;
virtual void unregisterWithDispatcher() OVERRIDE;
+ // Inherited from DOMWindowLifecycleObserver.
+ virtual void didAddEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
+ virtual void didRemoveEventListener(DOMWindow*, const AtomicString&) OVERRIDE;
+ virtual void didRemoveAllEventListeners(DOMWindow*) OVERRIDE;
+
+ // Inherited from PageLifecycleObserver.
+ virtual void pageVisibilityChanged() OVERRIDE;
+
virtual bool hasLastData() OVERRIDE;
virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
virtual bool isNullEvent(Event*) OVERRIDE;
+
+ bool m_hasEventListener;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698