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

Unified Diff: Source/core/page/DOMWindow.cpp

Issue 14460010: Implement the Blink part of the Device Motion API. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: moved tests to be treated in a separate CL 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/core/page/DOMWindow.cpp
diff --git a/Source/core/page/DOMWindow.cpp b/Source/core/page/DOMWindow.cpp
index ff194899cf521d8e9a25f984ee187ac152749ae6..f27269c1eb94d304405dd59f21aeff6a58889273 100644
--- a/Source/core/page/DOMWindow.cpp
+++ b/Source/core/page/DOMWindow.cpp
@@ -1530,8 +1530,8 @@ bool DOMWindow::addEventListener(const AtomicString& eventType, PassRefPtr<Event
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
addBeforeUnloadEventListener(this);
else if (eventType == eventNames().devicemotionEvent && RuntimeEnabledFeatures::deviceMotionEnabled()) {
- if (DeviceMotionController* controller = DeviceMotionController::from(page()))
- controller->addDeviceEventListener(this);
+ if (DeviceMotionController* controller = DeviceMotionController::from(document()))
+ controller->startUpdating();
} else if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatures::deviceOrientationEnabled()) {
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->addDeviceEventListener(this);
@@ -1557,8 +1557,8 @@ bool DOMWindow::removeEventListener(const AtomicString& eventType, EventListener
else if (eventType == eventNames().beforeunloadEvent && allowsBeforeUnloadListeners(this))
removeBeforeUnloadEventListener(this);
else if (eventType == eventNames().devicemotionEvent) {
- if (DeviceMotionController* controller = DeviceMotionController::from(page()))
- controller->removeDeviceEventListener(this);
+ if (DeviceMotionController* controller = DeviceMotionController::from(document()))
+ controller->stopUpdating();
} else if (eventType == eventNames().deviceorientationEvent) {
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
controller->removeDeviceEventListener(this);
@@ -1613,10 +1613,10 @@ void DOMWindow::removeAllEventListeners()
{
EventTarget::removeAllEventListeners();
- if (DeviceMotionController* controller = DeviceMotionController::from(page()))
- controller->removeAllDeviceEventListeners(this);
+ if (DeviceMotionController* controller = DeviceMotionController::from(document()))
+ controller->stopUpdating();
if (DeviceOrientationController* controller = DeviceOrientationController::from(page()))
- controller->removeAllDeviceEventListeners(this);
+ controller->removeDeviceEventListener(this);
if (Document* document = this->document())
document->didRemoveEventTargetNode(document);

Powered by Google App Engine
This is Rietveld 408576698