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" |
11 #include "modules/EventModules.h" | 11 #include "modules/EventModules.h" |
12 #include "modules/device_orientation/DeviceOrientationData.h" | 12 #include "modules/device_orientation/DeviceOrientationData.h" |
13 #include "modules/device_orientation/DeviceOrientationDispatcher.h" | 13 #include "modules/device_orientation/DeviceOrientationDispatcher.h" |
14 #include "modules/device_orientation/DeviceOrientationEvent.h" | 14 #include "modules/device_orientation/DeviceOrientationEvent.h" |
15 #include "platform/weborigin/SecurityOrigin.h" | 15 #include "platform/weborigin/SecurityOrigin.h" |
| 16 #include "public/platform/Platform.h" |
16 | 17 |
17 namespace blink { | 18 namespace blink { |
18 | 19 |
19 DeviceOrientationController::DeviceOrientationController(Document& document) | 20 DeviceOrientationController::DeviceOrientationController(Document& document) |
20 : DeviceSingleWindowEventController(document) | 21 : DeviceSingleWindowEventController(document) |
21 { | 22 { |
22 } | 23 } |
23 | 24 |
24 DeviceOrientationController::~DeviceOrientationController() | 25 DeviceOrientationController::~DeviceOrientationController() |
25 { | 26 { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 String errorMessage; | 60 String errorMessage; |
60 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e
rrorMessage)) { | 61 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e
rrorMessage)) { |
61 UseCounter::count(document().frame(), UseCounter::DeviceOrientationS
ecureOrigin); | 62 UseCounter::count(document().frame(), UseCounter::DeviceOrientationS
ecureOrigin); |
62 } else { | 63 } else { |
63 UseCounter::count(document().frame(), UseCounter::DeviceOrientationI
nsecureOrigin); | 64 UseCounter::count(document().frame(), UseCounter::DeviceOrientationI
nsecureOrigin); |
64 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) | 65 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) |
65 return; | 66 return; |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
| 70 if (!m_hasEventListener) |
| 71 Platform::current()->recordRapporURL("DeviceSensors.DeviceOrientation",
WebURL(document().url())); |
| 72 |
69 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | 73 DeviceSingleWindowEventController::didAddEventListener(window, eventType); |
70 } | 74 } |
71 | 75 |
72 DeviceOrientationData* DeviceOrientationController::lastData() const | 76 DeviceOrientationData* DeviceOrientationController::lastData() const |
73 { | 77 { |
74 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO
rientationDispatcher::instance().latestDeviceOrientationData(); | 78 return m_overrideOrientationData ? m_overrideOrientationData.get() : DeviceO
rientationDispatcher::instance().latestDeviceOrientationData(); |
75 } | 79 } |
76 | 80 |
77 bool DeviceOrientationController::hasLastData() | 81 bool DeviceOrientationController::hasLastData() |
78 { | 82 { |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 126 } |
123 | 127 |
124 DEFINE_TRACE(DeviceOrientationController) | 128 DEFINE_TRACE(DeviceOrientationController) |
125 { | 129 { |
126 visitor->trace(m_overrideOrientationData); | 130 visitor->trace(m_overrideOrientationData); |
127 DeviceSingleWindowEventController::trace(visitor); | 131 DeviceSingleWindowEventController::trace(visitor); |
128 DocumentSupplement::trace(visitor); | 132 DocumentSupplement::trace(visitor); |
129 } | 133 } |
130 | 134 |
131 } // namespace blink | 135 } // namespace blink |
OLD | NEW |