| 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 #ifndef DeviceLightDispatcher_h | 5 #ifndef DeviceLightDispatcher_h |
| 6 #define DeviceLightDispatcher_h | 6 #define DeviceLightDispatcher_h |
| 7 | 7 |
| 8 #include "core/frame/PlatformEventDispatcher.h" | 8 #include "core/frame/PlatformEventDispatcher.h" |
| 9 #include "platform/heap/Handle.h" |
| 9 #include "public/platform/WebDeviceLightListener.h" | 10 #include "public/platform/WebDeviceLightListener.h" |
| 10 #include "wtf/RefPtr.h" | 11 #include "wtf/RefPtr.h" |
| 11 | 12 |
| 12 namespace blink { | 13 namespace blink { |
| 13 | 14 |
| 14 class DeviceLightController; | 15 class DeviceLightController; |
| 15 | 16 |
| 16 // This class listens to device light data and notifies all registered controlle
rs. | 17 // This class listens to device light data and notifies all registered controlle
rs. |
| 17 class DeviceLightDispatcher FINAL : public PlatformEventDispatcher, public WebDe
viceLightListener { | 18 class DeviceLightDispatcher final : public GarbageCollectedFinalized<DeviceLight
Dispatcher>, public PlatformEventDispatcher, public WebDeviceLightListener { |
| 19 USING_GARBAGE_COLLECTED_MIXIN(DeviceLightDispatcher); |
| 18 public: | 20 public: |
| 19 static DeviceLightDispatcher& instance(); | 21 static DeviceLightDispatcher& instance(); |
| 22 virtual ~DeviceLightDispatcher(); |
| 20 | 23 |
| 21 double latestDeviceLightData() const; | 24 double latestDeviceLightData() const; |
| 22 | 25 |
| 23 // Inherited from WebDeviceLightListener. | 26 // Inherited from WebDeviceLightListener. |
| 24 virtual void didChangeDeviceLight(double) OVERRIDE; | 27 virtual void didChangeDeviceLight(double) override; |
| 28 |
| 29 virtual void trace(Visitor*) override; |
| 25 | 30 |
| 26 private: | 31 private: |
| 27 DeviceLightDispatcher(); | 32 DeviceLightDispatcher(); |
| 28 virtual ~DeviceLightDispatcher(); | |
| 29 | 33 |
| 30 // Inherited from PlatformEventDispatcher. | 34 // Inherited from PlatformEventDispatcher. |
| 31 virtual void startListening() OVERRIDE; | 35 virtual void startListening() override; |
| 32 virtual void stopListening() OVERRIDE; | 36 virtual void stopListening() override; |
| 33 | 37 |
| 34 double m_lastDeviceLightData; | 38 double m_lastDeviceLightData; |
| 35 }; | 39 }; |
| 36 | 40 |
| 37 } // namespace blink | 41 } // namespace blink |
| 38 | 42 |
| 39 #endif // DeviceLightDispatcher_h | 43 #endif // DeviceLightDispatcher_h |
| OLD | NEW |