Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "config.h" | |
| 6 #include "modules/device_orientation/DeviceOrientationAbsoluteController.h" | |
| 7 | |
| 8 #include "core/dom/Document.h" | |
| 9 #include "core/frame/Settings.h" | |
| 10 #include "modules/device_orientation/DeviceOrientationDispatcher.h" | |
| 11 | |
| 12 namespace blink { | |
| 13 | |
| 14 DeviceOrientationAbsoluteController::DeviceOrientationAbsoluteController(Documen t& document) | |
| 15 : DeviceOrientationController(document) | |
| 16 { | |
| 17 } | |
| 18 | |
| 19 DeviceOrientationAbsoluteController::~DeviceOrientationAbsoluteController() | |
| 20 { | |
| 21 } | |
| 22 | |
| 23 const char* DeviceOrientationAbsoluteController::supplementName() | |
| 24 { | |
| 25 return "DeviceOrientationAbsoluteController"; | |
| 26 } | |
| 27 | |
| 28 DeviceOrientationAbsoluteController& DeviceOrientationAbsoluteController::from(D ocument& document) | |
|
haraken
2015/10/28 18:23:34
I think this method should just redirect to Device
timvolodine
2015/10/29 13:49:18
Hmm, not sure how this would work. The problem is
| |
| 29 { | |
| 30 DeviceOrientationAbsoluteController* controller = static_cast<DeviceOrientat ionAbsoluteController*>(WillBeHeapSupplement<Document>::from(document, supplemen tName())); | |
| 31 if (!controller) { | |
| 32 controller = new DeviceOrientationAbsoluteController(document); | |
| 33 WillBeHeapSupplement<Document>::provideTo(document, supplementName(), ad optPtrWillBeNoop(controller)); | |
| 34 } | |
| 35 return *controller; | |
| 36 } | |
| 37 | |
| 38 void DeviceOrientationAbsoluteController::didAddEventListener(LocalDOMWindow* wi ndow, const AtomicString& eventType) | |
| 39 { | |
| 40 if (eventType != eventTypeName()) | |
| 41 return; | |
| 42 | |
| 43 if (document().frame()) { | |
| 44 String errorMessage; | |
| 45 if (document().isSecureContext(errorMessage)) { | |
| 46 UseCounter::count(document().frame(), UseCounter::DeviceOrientationA bsoluteSecureOrigin); | |
| 47 } else { | |
| 48 UseCounter::countDeprecation(document().frame(), UseCounter::DeviceO rientationAbsoluteInsecureOrigin); | |
| 49 // FIXME: add rappor logging of insecure origins as in DeviceOrienta tionController. | |
|
haraken
2015/10/28 18:18:37
FIXME => TODO
timvolodine
2015/10/29 13:49:18
Done.
| |
| 50 if (document().frame()->settings()->strictPowerfulFeatureRestriction s()) | |
| 51 return; | |
| 52 } | |
| 53 } | |
| 54 | |
| 55 // FIXME: add rappor url logging as in DeviceOrientationController. | |
|
haraken
2015/10/28 18:18:37
FIXME => TODO
timvolodine
2015/10/29 13:49:18
Done.
| |
| 56 | |
| 57 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | |
| 58 } | |
| 59 | |
| 60 DeviceOrientationDispatcher& DeviceOrientationAbsoluteController::dispatcherInst ance() const | |
| 61 { | |
| 62 return DeviceOrientationDispatcher::instance(true); | |
| 63 } | |
| 64 | |
| 65 const AtomicString& DeviceOrientationAbsoluteController::eventTypeName() const | |
| 66 { | |
| 67 return EventTypeNames::deviceorientationabsolute; | |
| 68 } | |
| 69 | |
| 70 DEFINE_TRACE(DeviceOrientationAbsoluteController) | |
| 71 { | |
| 72 DeviceOrientationController::trace(visitor); | |
| 73 WillBeHeapSupplement<Document>::trace(visitor); | |
|
haraken
2015/10/28 18:18:37
This is not needed. DeviceOrientationAbsoluteContr
timvolodine
2015/10/29 13:49:18
Done.
| |
| 74 } | |
| 75 | |
| 76 } // namespace blink | |
| OLD | NEW |