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

Unified Diff: third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp

Issue 1416123002: Absolute Device Orientation API: blink implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add usecounter and rebase Created 5 years, 2 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: third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp
diff --git a/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp b/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp
index bc997d8ed10ca7c0df767df68fb103c5d4dfd657..f996ffaf694b296cc8585ef9611666da8b9e9bd5 100644
--- a/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp
+++ b/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationDispatcher.cpp
@@ -37,13 +37,17 @@
namespace blink {
-DeviceOrientationDispatcher& DeviceOrientationDispatcher::instance()
+DeviceOrientationDispatcher& DeviceOrientationDispatcher::instance(bool absolute)
{
- DEFINE_STATIC_LOCAL(Persistent<DeviceOrientationDispatcher>, deviceOrientationDispatcher, (new DeviceOrientationDispatcher()));
+ if (absolute) {
+ DEFINE_STATIC_LOCAL(Persistent<DeviceOrientationDispatcher>, deviceOrientationAbsoluteDispatcher, (new DeviceOrientationDispatcher(absolute)));
haraken 2015/10/28 18:18:38 Shouldn't this be DeviceOrientationAbsoluteDispatc
timvolodine 2015/10/29 13:49:18 no, we've only one dispatcher class (parameterized
+ return *deviceOrientationAbsoluteDispatcher;
+ }
+ DEFINE_STATIC_LOCAL(Persistent<DeviceOrientationDispatcher>, deviceOrientationDispatcher, (new DeviceOrientationDispatcher(absolute)));
return *deviceOrientationDispatcher;
}
-DeviceOrientationDispatcher::DeviceOrientationDispatcher()
+DeviceOrientationDispatcher::DeviceOrientationDispatcher(bool absolute) : m_absolute(absolute)
{
}
@@ -59,12 +63,12 @@ DEFINE_TRACE(DeviceOrientationDispatcher)
void DeviceOrientationDispatcher::startListening()
{
- Platform::current()->startListening(WebPlatformEventTypeDeviceOrientation, this);
+ Platform::current()->startListening(getWebPlatformEventType(), this);
}
void DeviceOrientationDispatcher::stopListening()
{
- Platform::current()->stopListening(WebPlatformEventTypeDeviceOrientation);
+ Platform::current()->stopListening(getWebPlatformEventType());
m_lastDeviceOrientationData.clear();
}
@@ -79,4 +83,9 @@ DeviceOrientationData* DeviceOrientationDispatcher::latestDeviceOrientationData(
return m_lastDeviceOrientationData.get();
}
+WebPlatformEventType DeviceOrientationDispatcher::getWebPlatformEventType() const
+{
+ return (m_absolute) ? WebPlatformEventTypeDeviceOrientationAbsolute : WebPlatformEventTypeDeviceOrientation;
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698