| 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/DeviceMotionController.h" | 6 #include "modules/device_orientation/DeviceMotionController.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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 return *controller; | 45 return *controller; |
| 46 } | 46 } |
| 47 | 47 |
| 48 void DeviceMotionController::didAddEventListener(LocalDOMWindow* window, const A
tomicString& eventType) | 48 void DeviceMotionController::didAddEventListener(LocalDOMWindow* window, const A
tomicString& eventType) |
| 49 { | 49 { |
| 50 if (eventType != eventTypeName()) | 50 if (eventType != eventTypeName()) |
| 51 return; | 51 return; |
| 52 | 52 |
| 53 if (document().frame()) { | 53 if (document().frame()) { |
| 54 String errorMessage; | 54 String errorMessage; |
| 55 if (document().isPrivilegedContext(errorMessage)) { | 55 if (document().isSecureContext(errorMessage)) { |
| 56 UseCounter::count(document().frame(), UseCounter::DeviceMotionSecure
Origin); | 56 UseCounter::count(document().frame(), UseCounter::DeviceMotionSecure
Origin); |
| 57 } else { | 57 } else { |
| 58 UseCounter::countDeprecation(document().frame(), UseCounter::DeviceM
otionInsecureOrigin); | 58 UseCounter::countDeprecation(document().frame(), UseCounter::DeviceM
otionInsecureOrigin); |
| 59 OriginsUsingFeatures::countAnyWorld(document(), OriginsUsingFeatures
::Feature::DeviceMotionInsecureOrigin); | 59 OriginsUsingFeatures::countAnyWorld(document(), OriginsUsingFeatures
::Feature::DeviceMotionInsecureOrigin); |
| 60 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) | 60 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) |
| 61 return; | 61 return; |
| 62 } | 62 } |
| 63 } | 63 } |
| 64 | 64 |
| 65 if (!m_hasEventListener) | 65 if (!m_hasEventListener) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 return EventTypeNames::devicemotion; | 99 return EventTypeNames::devicemotion; |
| 100 } | 100 } |
| 101 | 101 |
| 102 DEFINE_TRACE(DeviceMotionController) | 102 DEFINE_TRACE(DeviceMotionController) |
| 103 { | 103 { |
| 104 DeviceSingleWindowEventController::trace(visitor); | 104 DeviceSingleWindowEventController::trace(visitor); |
| 105 WillBeHeapSupplement<Document>::trace(visitor); | 105 WillBeHeapSupplement<Document>::trace(visitor); |
| 106 } | 106 } |
| 107 | 107 |
| 108 } // namespace blink | 108 } // namespace blink |
| OLD | NEW |