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 |