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 "modules/device_light/DeviceLightController.h" | 5 #include "modules/device_light/DeviceLightController.h" |
6 | 6 |
7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
8 #include "modules/EventModules.h" | 8 #include "modules/EventModules.h" |
9 #include "modules/device_light/DeviceLightDispatcher.h" | 9 #include "modules/device_light/DeviceLightDispatcher.h" |
10 #include "modules/device_light/DeviceLightEvent.h" | 10 #include "modules/device_light/DeviceLightEvent.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #endif | 24 #endif |
25 } | 25 } |
26 | 26 |
27 const char* DeviceLightController::supplementName() | 27 const char* DeviceLightController::supplementName() |
28 { | 28 { |
29 return "DeviceLightController"; | 29 return "DeviceLightController"; |
30 } | 30 } |
31 | 31 |
32 DeviceLightController& DeviceLightController::from(Document& document) | 32 DeviceLightController& DeviceLightController::from(Document& document) |
33 { | 33 { |
34 DeviceLightController* controller = static_cast<DeviceLightController*>(Heap
Supplement<Document>::from(document, supplementName())); | 34 DeviceLightController* controller = static_cast<DeviceLightController*>(Supp
lement<Document>::from(document, supplementName())); |
35 if (!controller) { | 35 if (!controller) { |
36 controller = new DeviceLightController(document); | 36 controller = new DeviceLightController(document); |
37 HeapSupplement<Document>::provideTo(document, supplementName(), controll
er); | 37 Supplement<Document>::provideTo(document, supplementName(), controller); |
38 } | 38 } |
39 return *controller; | 39 return *controller; |
40 } | 40 } |
41 | 41 |
42 bool DeviceLightController::hasLastData() | 42 bool DeviceLightController::hasLastData() |
43 { | 43 { |
44 return DeviceLightDispatcher::instance().latestDeviceLightData() >= 0; | 44 return DeviceLightDispatcher::instance().latestDeviceLightData() >= 0; |
45 } | 45 } |
46 | 46 |
47 void DeviceLightController::registerWithDispatcher() | 47 void DeviceLightController::registerWithDispatcher() |
(...skipping 19 matching lines...) Expand all Loading... |
67 } | 67 } |
68 | 68 |
69 const AtomicString& DeviceLightController::eventTypeName() const | 69 const AtomicString& DeviceLightController::eventTypeName() const |
70 { | 70 { |
71 return EventTypeNames::devicelight; | 71 return EventTypeNames::devicelight; |
72 } | 72 } |
73 | 73 |
74 DEFINE_TRACE(DeviceLightController) | 74 DEFINE_TRACE(DeviceLightController) |
75 { | 75 { |
76 DeviceSingleWindowEventController::trace(visitor); | 76 DeviceSingleWindowEventController::trace(visitor); |
77 HeapSupplement<Document>::trace(visitor); | 77 Supplement<Document>::trace(visitor); |
78 } | 78 } |
79 | 79 |
80 | 80 |
81 } // namespace blink | 81 } // namespace blink |
OLD | NEW |