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..27b458c0fd0e271314ef7cd088196dab6ce04bc0 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/device_orientation/DeviceOrientationAbsoluteController.cpp |
@@ -0,0 +1,71 @@ |
+// 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) |
+{ |
+ 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) && document().frame()->settings()->strictPowerfulFeatureRestrictions()) |
+ return; |
+ // FIXME: add user counters as in DeviceOrientationController. |
Rick Byers
2015/10/22 16:00:52
Do you actually want separate use counters here?
timvolodine
2015/10/27 16:38:35
Yes, well, I think it may actually be interesting
Rick Byers
2015/10/27 18:35:07
Ok. Adding the UseCounter should be trivial. If
timvolodine
2015/10/28 17:48:08
Done. (rappor logging is a todo).
|
+ } |
+ |
+ // FIXME: add rappor url logging as in DeviceOrientationController. |
+ |
+ 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); |
+} |
+ |
+} // namespace blink |