| Index: Source/modules/device_light/DeviceLightController.cpp
|
| diff --git a/Source/modules/device_light/DeviceLightController.cpp b/Source/modules/device_light/DeviceLightController.cpp
|
| index 36e09cedfe518ea105e169d6c7817ec3389a9775..ea6b76ea8a502ff1b6c67e353a56b9617fc75ebe 100644
|
| --- a/Source/modules/device_light/DeviceLightController.cpp
|
| +++ b/Source/modules/device_light/DeviceLightController.cpp
|
| @@ -15,9 +15,7 @@
|
| namespace WebCore {
|
|
|
| DeviceLightController::DeviceLightController(Document& document)
|
| - : DeviceSensorEventController(document.page())
|
| - , DOMWindowLifecycleObserver(document.domWindow())
|
| - , m_document(document)
|
| + : DeviceSingleWindowEventController(document)
|
| {
|
| }
|
|
|
| @@ -26,11 +24,6 @@ DeviceLightController::~DeviceLightController()
|
| stopUpdating();
|
| }
|
|
|
| -void DeviceLightController::didChangeDeviceLight(double value)
|
| -{
|
| - dispatchDeviceEvent(DeviceLightEvent::create(EventTypeNames::devicelight, value));
|
| -}
|
| -
|
| const char* DeviceLightController::supplementName()
|
| {
|
| return "DeviceLightController";
|
| @@ -51,55 +44,31 @@ bool DeviceLightController::hasLastData()
|
| return DeviceLightDispatcher::instance().latestDeviceLightData() >= 0;
|
| }
|
|
|
| -PassRefPtrWillBeRawPtr<Event> DeviceLightController::getLastEvent()
|
| -{
|
| - return DeviceLightEvent::create(EventTypeNames::devicelight,
|
| - DeviceLightDispatcher::instance().latestDeviceLightData());
|
| -}
|
| -
|
| void DeviceLightController::registerWithDispatcher()
|
| {
|
| - DeviceLightDispatcher::instance().addDeviceLightController(this);
|
| + DeviceLightDispatcher::instance().addController(this);
|
| }
|
|
|
| void DeviceLightController::unregisterWithDispatcher()
|
| {
|
| - DeviceLightDispatcher::instance().removeDeviceLightController(this);
|
| -}
|
| -
|
| -bool DeviceLightController::isNullEvent(Event* event)
|
| -{
|
| - DeviceLightEvent* lightEvent = toDeviceLightEvent(event);
|
| - return lightEvent->value() == std::numeric_limits<double>::infinity();
|
| -}
|
| -
|
| -Document* DeviceLightController::document()
|
| -{
|
| - return &m_document;
|
| + DeviceLightDispatcher::instance().removeController(this);
|
| }
|
|
|
| -void DeviceLightController::didAddEventListener(DOMWindow* window, const AtomicString& eventType)
|
| +PassRefPtrWillBeRawPtr<Event> DeviceLightController::lastEvent() const
|
| {
|
| - if (eventType == EventTypeNames::devicelight && RuntimeEnabledFeatures::deviceLightEnabled()) {
|
| - if (page() && page()->visibilityState() == PageVisibilityStateVisible)
|
| - startUpdating();
|
| - m_hasEventListener = true;
|
| - }
|
| + return DeviceLightEvent::create(EventTypeNames::devicelight,
|
| + DeviceLightDispatcher::instance().latestDeviceLightData());
|
| }
|
|
|
| -void DeviceLightController::didRemoveEventListener(DOMWindow* window, const AtomicString& eventType)
|
| +bool DeviceLightController::isNullEvent(Event* event) const
|
| {
|
| - if (eventType != EventTypeNames::devicelight || window->hasEventListeners(EventTypeNames::devicelight))
|
| - return;
|
| -
|
| - stopUpdating();
|
| - m_hasEventListener = false;
|
| + DeviceLightEvent* lightEvent = toDeviceLightEvent(event);
|
| + return lightEvent->value() == std::numeric_limits<double>::infinity();
|
| }
|
|
|
| -void DeviceLightController::didRemoveAllEventListeners(DOMWindow* window)
|
| +const AtomicString& DeviceLightController::eventTypeName() const
|
| {
|
| - stopUpdating();
|
| - m_hasEventListener = false;
|
| + return EventTypeNames::devicelight;
|
| }
|
|
|
| } // namespace WebCore
|
|
|