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) | |
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) && document().frame()->set tings()->strictPowerfulFeatureRestrictions()) | |
46 return; | |
47 // 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).
| |
48 } | |
49 | |
50 // FIXME: add rappor url logging as in DeviceOrientationController. | |
51 | |
52 DeviceSingleWindowEventController::didAddEventListener(window, eventType); | |
53 } | |
54 | |
55 DeviceOrientationDispatcher& DeviceOrientationAbsoluteController::dispatcherInst ance() const | |
56 { | |
57 return DeviceOrientationDispatcher::instance<true>(); | |
58 } | |
59 | |
60 const AtomicString& DeviceOrientationAbsoluteController::eventTypeName() const | |
61 { | |
62 return EventTypeNames::deviceorientationabsolute; | |
63 } | |
64 | |
65 DEFINE_TRACE(DeviceOrientationAbsoluteController) | |
66 { | |
67 DeviceOrientationController::trace(visitor); | |
68 WillBeHeapSupplement<Document>::trace(visitor); | |
69 } | |
70 | |
71 } // namespace blink | |
OLD | NEW |