| 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/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/DeviceMotionData.h" | 12 #include "modules/device_orientation/DeviceMotionData.h" |
| 13 #include "modules/device_orientation/DeviceMotionDispatcher.h" | 13 #include "modules/device_orientation/DeviceMotionDispatcher.h" |
| 14 #include "modules/device_orientation/DeviceMotionEvent.h" | 14 #include "modules/device_orientation/DeviceMotionEvent.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 DeviceMotionController::DeviceMotionController(Document& document) | 20 DeviceMotionController::DeviceMotionController(Document& document) |
| 20 : DeviceSingleWindowEventController(document) | 21 : DeviceSingleWindowEventController(document) |
| 21 { | 22 { |
| 22 } | 23 } |
| 23 | 24 |
| 24 DeviceMotionController::~DeviceMotionController() | 25 DeviceMotionController::~DeviceMotionController() |
| 25 { | 26 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 52 String errorMessage; | 53 String errorMessage; |
| 53 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e
rrorMessage)) { | 54 if (document().securityOrigin()->canAccessFeatureRequiringSecureOrigin(e
rrorMessage)) { |
| 54 UseCounter::count(document().frame(), UseCounter::DeviceMotionSecure
Origin); | 55 UseCounter::count(document().frame(), UseCounter::DeviceMotionSecure
Origin); |
| 55 } else { | 56 } else { |
| 56 UseCounter::count(document().frame(), UseCounter::DeviceMotionInsecu
reOrigin); | 57 UseCounter::count(document().frame(), UseCounter::DeviceMotionInsecu
reOrigin); |
| 57 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) | 58 if (document().frame()->settings()->strictPowerfulFeatureRestriction
s()) |
| 58 return; | 59 return; |
| 59 } | 60 } |
| 60 } | 61 } |
| 61 | 62 |
| 63 if (!m_hasEventListener) |
| 64 Platform::current()->recordRapporMetric(WebPlatformEventDeviceMotion, We
bURL(document().url())); |
| 65 |
| 62 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | 66 DeviceSingleWindowEventController::didAddEventListener(window, eventType); |
| 63 } | 67 } |
| 64 | 68 |
| 65 bool DeviceMotionController::hasLastData() | 69 bool DeviceMotionController::hasLastData() |
| 66 { | 70 { |
| 67 return DeviceMotionDispatcher::instance().latestDeviceMotionData(); | 71 return DeviceMotionDispatcher::instance().latestDeviceMotionData(); |
| 68 } | 72 } |
| 69 | 73 |
| 70 void DeviceMotionController::registerWithDispatcher() | 74 void DeviceMotionController::registerWithDispatcher() |
| 71 { | 75 { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 93 return EventTypeNames::devicemotion; | 97 return EventTypeNames::devicemotion; |
| 94 } | 98 } |
| 95 | 99 |
| 96 DEFINE_TRACE(DeviceMotionController) | 100 DEFINE_TRACE(DeviceMotionController) |
| 97 { | 101 { |
| 98 DeviceSingleWindowEventController::trace(visitor); | 102 DeviceSingleWindowEventController::trace(visitor); |
| 99 DocumentSupplement::trace(visitor); | 103 DocumentSupplement::trace(visitor); |
| 100 } | 104 } |
| 101 | 105 |
| 102 } // namespace blink | 106 } // namespace blink |
| OLD | NEW |