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/DeviceOrientationController.h" | 6 #include "modules/device_orientation/DeviceOrientationController.h" |
7 | 7 |
8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 if (!m_hasEventListener) | 72 if (!m_hasEventListener) |
73 Platform::current()->recordRapporURL("DeviceSensors.DeviceOrientation",
WebURL(document().url())); | 73 Platform::current()->recordRapporURL("DeviceSensors.DeviceOrientation",
WebURL(document().url())); |
74 | 74 |
75 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | 75 DeviceSingleWindowEventController::didAddEventListener(window, eventType); |
76 } | 76 } |
77 | 77 |
78 DeviceOrientationData* DeviceOrientationController::lastData() const | 78 DeviceOrientationData* DeviceOrientationController::lastData() const |
79 { | 79 { |
80 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO
rientationDispatcher::instance().latestDeviceOrientationData(); | 80 return m_overrideOrientationData ? m_overrideOrientationData.get() : dispatc
herInstance().latestDeviceOrientationData(); |
81 } | 81 } |
82 | 82 |
83 bool DeviceOrientationController::hasLastData() | 83 bool DeviceOrientationController::hasLastData() |
84 { | 84 { |
85 return lastData(); | 85 return lastData(); |
86 } | 86 } |
87 | 87 |
88 void DeviceOrientationController::registerWithDispatcher() | 88 void DeviceOrientationController::registerWithDispatcher() |
89 { | 89 { |
90 DeviceOrientationDispatcher::instance().addController(this); | 90 dispatcherInstance().addController(this); |
91 } | 91 } |
92 | 92 |
93 void DeviceOrientationController::unregisterWithDispatcher() | 93 void DeviceOrientationController::unregisterWithDispatcher() |
94 { | 94 { |
95 DeviceOrientationDispatcher::instance().removeController(this); | 95 dispatcherInstance().removeController(this); |
96 } | 96 } |
97 | 97 |
98 PassRefPtrWillBeRawPtr<Event> DeviceOrientationController::lastEvent() const | 98 PassRefPtrWillBeRawPtr<Event> DeviceOrientationController::lastEvent() const |
99 { | 99 { |
100 return DeviceOrientationEvent::create(eventTypeName(), lastData()); | 100 return DeviceOrientationEvent::create(eventTypeName(), lastData()); |
101 } | 101 } |
102 | 102 |
103 bool DeviceOrientationController::isNullEvent(Event* event) const | 103 bool DeviceOrientationController::isNullEvent(Event* event) const |
104 { | 104 { |
105 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event); | 105 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event); |
(...skipping 14 matching lines...) Expand all Loading... |
120 | 120 |
121 void DeviceOrientationController::clearOverride() | 121 void DeviceOrientationController::clearOverride() |
122 { | 122 { |
123 if (!m_overrideOrientationData) | 123 if (!m_overrideOrientationData) |
124 return; | 124 return; |
125 m_overrideOrientationData.clear(); | 125 m_overrideOrientationData.clear(); |
126 if (lastData()) | 126 if (lastData()) |
127 didUpdateData(); | 127 didUpdateData(); |
128 } | 128 } |
129 | 129 |
| 130 DeviceOrientationDispatcher& DeviceOrientationController::dispatcherInstance() c
onst |
| 131 { |
| 132 return DeviceOrientationDispatcher::instance(false); |
| 133 } |
| 134 |
130 DEFINE_TRACE(DeviceOrientationController) | 135 DEFINE_TRACE(DeviceOrientationController) |
131 { | 136 { |
132 visitor->trace(m_overrideOrientationData); | 137 visitor->trace(m_overrideOrientationData); |
133 DeviceSingleWindowEventController::trace(visitor); | 138 DeviceSingleWindowEventController::trace(visitor); |
134 WillBeHeapSupplement<Document>::trace(visitor); | 139 WillBeHeapSupplement<Document>::trace(visitor); |
135 } | 140 } |
136 | 141 |
137 } // namespace blink | 142 } // namespace blink |
OLD | NEW |