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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 DeviceOrientationController* controller = static_cast<DeviceOrientationContr oller*>(DocumentSupplement::from(document, supplementName())); | 45 DeviceOrientationController* controller = static_cast<DeviceOrientationContr oller*>(DocumentSupplement::from(document, supplementName())); |
46 if (!controller) { | 46 if (!controller) { |
47 controller = new DeviceOrientationController(document); | 47 controller = new DeviceOrientationController(document); |
48 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe Noop(controller)); | 48 DocumentSupplement::provideTo(document, supplementName(), adoptPtrWillBe Noop(controller)); |
49 } | 49 } |
50 return *controller; | 50 return *controller; |
51 } | 51 } |
52 | 52 |
53 void DeviceOrientationController::didAddEventListener(LocalDOMWindow* window, co nst AtomicString& eventType) | 53 void DeviceOrientationController::didAddEventListener(LocalDOMWindow* window, co nst AtomicString& eventType) |
54 { | 54 { |
55 if (eventType != eventTypeName()) | |
56 return; | |
57 | |
55 if (document().frame()) { | 58 if (document().frame()) { |
56 String errorMessage; | 59 String errorMessage; |
57 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e rrorMessage)) { | 60 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e rrorMessage)) { |
58 UseCounter::count(document().frame(), UseCounter::DeviceOrientationS ecureOrigin); | 61 UseCounter::count(document().frame(), UseCounter::DeviceOrientationS ecureOrigin); |
59 } else { | 62 } else { |
60 UseCounter::count(document().frame(), UseCounter::DeviceOrientationI nsecureOrigin); | 63 UseCounter::count(document().frame(), UseCounter::DeviceOrientationI nsecureOrigin); |
61 if (document().frame()->settings()->strictPowerfulFeatureRestriction s()) | 64 if (document().frame()->settings()->strictPowerfulFeatureRestriction s()) |
62 return; | 65 return; |
63 } | 66 } |
64 } | 67 } |
65 | 68 |
66 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | 69 DeviceSingleWindowEventController::didAddEventListener(window, eventType); |
Mike West
2015/03/12 21:25:12
Ditto.
timvolodine
2015/03/13 11:40:55
Done.
| |
67 } | 70 } |
68 | 71 |
69 DeviceOrientationData* DeviceOrientationController::lastData() const | 72 DeviceOrientationData* DeviceOrientationController::lastData() const |
70 { | 73 { |
71 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO rientationDispatcher::instance().latestDeviceOrientationData(); | 74 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO rientationDispatcher::instance().latestDeviceOrientationData(); |
72 } | 75 } |
73 | 76 |
74 bool DeviceOrientationController::hasLastData() | 77 bool DeviceOrientationController::hasLastData() |
75 { | 78 { |
76 return lastData(); | 79 return lastData(); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 } | 122 } |
120 | 123 |
121 DEFINE_TRACE(DeviceOrientationController) | 124 DEFINE_TRACE(DeviceOrientationController) |
122 { | 125 { |
123 visitor->trace(m_overrideOrientationData); | 126 visitor->trace(m_overrideOrientationData); |
124 DeviceSingleWindowEventController::trace(visitor); | 127 DeviceSingleWindowEventController::trace(visitor); |
125 DocumentSupplement::trace(visitor); | 128 DocumentSupplement::trace(visitor); |
126 } | 129 } |
127 | 130 |
128 } // namespace blink | 131 } // namespace blink |
OLD | NEW |