| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "config.h" | 5 #include "config.h" | 
| 6 #include "modules/device_orientation/DeviceMotionController.h" | 6 #include "modules/device_orientation/DeviceMotionController.h" | 
| 7 | 7 | 
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" | 
| 9 #include "core/frame/Settings.h" | 9 #include "core/frame/Settings.h" | 
| 10 #include "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 29 #endif | 29 #endif | 
| 30 } | 30 } | 
| 31 | 31 | 
| 32 const char* DeviceMotionController::supplementName() | 32 const char* DeviceMotionController::supplementName() | 
| 33 { | 33 { | 
| 34     return "DeviceMotionController"; | 34     return "DeviceMotionController"; | 
| 35 } | 35 } | 
| 36 | 36 | 
| 37 DeviceMotionController& DeviceMotionController::from(Document& document) | 37 DeviceMotionController& DeviceMotionController::from(Document& document) | 
| 38 { | 38 { | 
| 39     DeviceMotionController* controller = static_cast<DeviceMotionController*>(Do
     cumentSupplement::from(document, supplementName())); | 39     DeviceMotionController* controller = static_cast<DeviceMotionController*>(Wi
     llBeHeapSupplement<Document>::from(document, supplementName())); | 
| 40     if (!controller) { | 40     if (!controller) { | 
| 41         controller = new DeviceMotionController(document); | 41         controller = new DeviceMotionController(document); | 
| 42         DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
     Noop(controller)); | 42         WillBeHeapSupplement<Document>::provideTo(document, supplementName(), ad
     optPtrWillBeNoop(controller)); | 
| 43     } | 43     } | 
| 44     return *controller; | 44     return *controller; | 
| 45 } | 45 } | 
| 46 | 46 | 
| 47 void DeviceMotionController::didAddEventListener(LocalDOMWindow* window, const A
     tomicString& eventType) | 47 void DeviceMotionController::didAddEventListener(LocalDOMWindow* window, const A
     tomicString& eventType) | 
| 48 { | 48 { | 
| 49     if (eventType != eventTypeName()) | 49     if (eventType != eventTypeName()) | 
| 50         return; | 50         return; | 
| 51 | 51 | 
| 52     if (document().frame()) { | 52     if (document().frame()) { | 
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 93 } | 93 } | 
| 94 | 94 | 
| 95 const AtomicString& DeviceMotionController::eventTypeName() const | 95 const AtomicString& DeviceMotionController::eventTypeName() const | 
| 96 { | 96 { | 
| 97     return EventTypeNames::devicemotion; | 97     return EventTypeNames::devicemotion; | 
| 98 } | 98 } | 
| 99 | 99 | 
| 100 DEFINE_TRACE(DeviceMotionController) | 100 DEFINE_TRACE(DeviceMotionController) | 
| 101 { | 101 { | 
| 102     DeviceSingleWindowEventController::trace(visitor); | 102     DeviceSingleWindowEventController::trace(visitor); | 
| 103     DocumentSupplement::trace(visitor); | 103     WillBeHeapSupplement<Document>::trace(visitor); | 
| 104 } | 104 } | 
| 105 | 105 | 
| 106 } // namespace blink | 106 } // namespace blink | 
| OLD | NEW | 
|---|