Chromium Code Reviews| Index: third_party/WebKit/Source/modules/device_orientation/DeviceOrientationAbsoluteController.cpp |
| diff --git a/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationAbsoluteController.cpp b/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationAbsoluteController.cpp |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..09e1093f6f5eb87268721fb8258b2e3d75f3ae2d |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationAbsoluteController.cpp |
| @@ -0,0 +1,76 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "config.h" |
| +#include "modules/device_orientation/DeviceOrientationAbsoluteController.h" |
| + |
| +#include "core/dom/Document.h" |
| +#include "core/frame/Settings.h" |
| +#include "modules/device_orientation/DeviceOrientationDispatcher.h" |
| + |
| +namespace blink { |
| + |
| +DeviceOrientationAbsoluteController::DeviceOrientationAbsoluteController(Document& document) |
| + : DeviceOrientationController(document) |
| +{ |
| +} |
| + |
| +DeviceOrientationAbsoluteController::~DeviceOrientationAbsoluteController() |
| +{ |
| +} |
| + |
| +const char* DeviceOrientationAbsoluteController::supplementName() |
| +{ |
| + return "DeviceOrientationAbsoluteController"; |
| +} |
| + |
| +DeviceOrientationAbsoluteController& DeviceOrientationAbsoluteController::from(Document& 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
|
| +{ |
| + DeviceOrientationAbsoluteController* controller = static_cast<DeviceOrientationAbsoluteController*>(WillBeHeapSupplement<Document>::from(document, supplementName())); |
| + if (!controller) { |
| + controller = new DeviceOrientationAbsoluteController(document); |
| + WillBeHeapSupplement<Document>::provideTo(document, supplementName(), adoptPtrWillBeNoop(controller)); |
| + } |
| + return *controller; |
| +} |
| + |
| +void DeviceOrientationAbsoluteController::didAddEventListener(LocalDOMWindow* window, const AtomicString& eventType) |
| +{ |
| + if (eventType != eventTypeName()) |
| + return; |
| + |
| + if (document().frame()) { |
| + String errorMessage; |
| + if (document().isSecureContext(errorMessage)) { |
| + UseCounter::count(document().frame(), UseCounter::DeviceOrientationAbsoluteSecureOrigin); |
| + } else { |
| + UseCounter::countDeprecation(document().frame(), UseCounter::DeviceOrientationAbsoluteInsecureOrigin); |
| + // FIXME: add rappor logging of insecure origins as in DeviceOrientationController. |
|
haraken
2015/10/28 18:18:37
FIXME => TODO
timvolodine
2015/10/29 13:49:18
Done.
|
| + if (document().frame()->settings()->strictPowerfulFeatureRestrictions()) |
| + return; |
| + } |
| + } |
| + |
| + // 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.
|
| + |
| + DeviceSingleWindowEventController::didAddEventListener(window, eventType); |
| +} |
| + |
| +DeviceOrientationDispatcher& DeviceOrientationAbsoluteController::dispatcherInstance() const |
| +{ |
| + return DeviceOrientationDispatcher::instance(true); |
| +} |
| + |
| +const AtomicString& DeviceOrientationAbsoluteController::eventTypeName() const |
| +{ |
| + return EventTypeNames::deviceorientationabsolute; |
| +} |
| + |
| +DEFINE_TRACE(DeviceOrientationAbsoluteController) |
| +{ |
| + DeviceOrientationController::trace(visitor); |
| + WillBeHeapSupplement<Document>::trace(visitor); |
|
haraken
2015/10/28 18:18:37
This is not needed. DeviceOrientationAbsoluteContr
timvolodine
2015/10/29 13:49:18
Done.
|
| +} |
| + |
| +} // namespace blink |