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

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

Issue 14460010: Implement the Blink part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: removed files incorrectly listed in WebKit.gyp Created 7 years, 7 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 f215c4805249b6020d5b56b5776fde95532a1e92..5639c8dab7733ba5e45897522070fef462b7ff2f 100644
--- a/Source/modules/device_orientation/DeviceMotionController.h
+++ b/Source/modules/device_orientation/DeviceMotionController.h
@@ -27,31 +27,41 @@
#ifndef DeviceMotionController_h
#define DeviceMotionController_h
-#include "core/page/DeviceController.h"
+#include "core/dom/Event.h"
+#include "core/platform/Supplementable.h"
+#include "core/platform/Timer.h"
namespace WebCore {
-class DeviceMotionClient;
class DeviceMotionData;
+class Document;
+
+// FIXME: This class doesn't inherit from DeviceController anymore, which is a temporary
+// solution. Once device orientation switches to the client-less design, move some of
+// the methods in this class to the DeviceController.
+class DeviceMotionController : public Supplement<ScriptExecutionContext> {
-class DeviceMotionController : public DeviceController {
public:
- ~DeviceMotionController() { };
+ virtual ~DeviceMotionController();
- static PassOwnPtr<DeviceMotionController> create(DeviceMotionClient*);
+ static const char* supplementName();
+ static DeviceMotionController* from(Document*);
void didChangeDeviceMotion(DeviceMotionData*);
- DeviceMotionClient* deviceMotionClient();
+ bool hasLastData();
+ PassRefPtr<Event> getLastEvent();
+ void dispatchDeviceEvent(const PassRefPtr<Event>);
+ void startUpdating();
+ void stopUpdating();
- virtual bool hasLastData() OVERRIDE;
- virtual PassRefPtr<Event> getLastEvent() OVERRIDE;
+private:
+ explicit DeviceMotionController(Document*);
- static const char* supplementName();
- static DeviceMotionController* from(Page*);
- static bool isActiveAt(Page*);
+ void fireDeviceEvent(Timer<DeviceMotionController>*);
-private:
- explicit DeviceMotionController(DeviceMotionClient*);
+ Document* m_document;
+ bool m_isActive;
+ Timer<DeviceMotionController> m_timer;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698