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