| 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/Settings.h" | 9 #include "core/frame/Settings.h" |
| 10 #include "core/frame/UseCounter.h" | 10 #include "core/frame/UseCounter.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 dispatchDeviceEvent(lastEvent()); | 36 dispatchDeviceEvent(lastEvent()); |
| 37 } | 37 } |
| 38 | 38 |
| 39 const char* DeviceOrientationController::supplementName() | 39 const char* DeviceOrientationController::supplementName() |
| 40 { | 40 { |
| 41 return "DeviceOrientationController"; | 41 return "DeviceOrientationController"; |
| 42 } | 42 } |
| 43 | 43 |
| 44 DeviceOrientationController& DeviceOrientationController::from(Document& documen
t) | 44 DeviceOrientationController& DeviceOrientationController::from(Document& documen
t) |
| 45 { | 45 { |
| 46 DeviceOrientationController* controller = static_cast<DeviceOrientationContr
oller*>(DocumentSupplement::from(document, supplementName())); | 46 DeviceOrientationController* controller = static_cast<DeviceOrientationContr
oller*>(WillBeHeapSupplement<Document>::from(document, supplementName())); |
| 47 if (!controller) { | 47 if (!controller) { |
| 48 controller = new DeviceOrientationController(document); | 48 controller = new DeviceOrientationController(document); |
| 49 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe
Noop(controller)); | 49 WillBeHeapSupplement<Document>::provideTo(document, supplementName(), ad
optPtrWillBeNoop(controller)); |
| 50 } | 50 } |
| 51 return *controller; | 51 return *controller; |
| 52 } | 52 } |
| 53 | 53 |
| 54 void DeviceOrientationController::didAddEventListener(LocalDOMWindow* window, co
nst AtomicString& eventType) | 54 void DeviceOrientationController::didAddEventListener(LocalDOMWindow* window, co
nst AtomicString& eventType) |
| 55 { | 55 { |
| 56 if (eventType != eventTypeName()) | 56 if (eventType != eventTypeName()) |
| 57 return; | 57 return; |
| 58 | 58 |
| 59 if (document().frame()) { | 59 if (document().frame()) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 return; | 122 return; |
| 123 m_overrideOrientationData.clear(); | 123 m_overrideOrientationData.clear(); |
| 124 if (lastData()) | 124 if (lastData()) |
| 125 didUpdateData(); | 125 didUpdateData(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 DEFINE_TRACE(DeviceOrientationController) | 128 DEFINE_TRACE(DeviceOrientationController) |
| 129 { | 129 { |
| 130 visitor->trace(m_overrideOrientationData); | 130 visitor->trace(m_overrideOrientationData); |
| 131 DeviceSingleWindowEventController::trace(visitor); | 131 DeviceSingleWindowEventController::trace(visitor); |
| 132 DocumentSupplement::trace(visitor); | 132 WillBeHeapSupplement<Document>::trace(visitor); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace blink | 135 } // namespace blink |
| OLD | NEW |