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 "modules/device_orientation/DeviceMotionController.h" | 5 #include "modules/device_orientation/DeviceMotionController.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "core/frame/Deprecation.h" | 8 #include "core/frame/Deprecation.h" |
9 #include "core/frame/OriginsUsingFeatures.h" | 9 #include "core/frame/OriginsUsingFeatures.h" |
10 #include "core/frame/Settings.h" | 10 #include "core/frame/Settings.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*>(He
apSupplement<Document>::from(document, supplementName())); | 39 DeviceMotionController* controller = static_cast<DeviceMotionController*>(Su
pplement<Document>::from(document, supplementName())); |
40 if (!controller) { | 40 if (!controller) { |
41 controller = new DeviceMotionController(document); | 41 controller = new DeviceMotionController(document); |
42 HeapSupplement<Document>::provideTo(document, supplementName(), controll
er); | 42 Supplement<Document>::provideTo(document, supplementName(), 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 } | 94 } |
95 | 95 |
96 const AtomicString& DeviceMotionController::eventTypeName() const | 96 const AtomicString& DeviceMotionController::eventTypeName() const |
97 { | 97 { |
98 return EventTypeNames::devicemotion; | 98 return EventTypeNames::devicemotion; |
99 } | 99 } |
100 | 100 |
101 DEFINE_TRACE(DeviceMotionController) | 101 DEFINE_TRACE(DeviceMotionController) |
102 { | 102 { |
103 DeviceSingleWindowEventController::trace(visitor); | 103 DeviceSingleWindowEventController::trace(visitor); |
104 HeapSupplement<Document>::trace(visitor); | 104 Supplement<Document>::trace(visitor); |
105 } | 105 } |
106 | 106 |
107 } // namespace blink | 107 } // namespace blink |
OLD | NEW |