Index: Source/modules/device_light/DeviceLightDispatcher.h |
diff --git a/Source/modules/device_light/DeviceLightDispatcher.h b/Source/modules/device_light/DeviceLightDispatcher.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e1430f69986cc7dde42db8fa552ccbdc576275b2 |
--- /dev/null |
+++ b/Source/modules/device_light/DeviceLightDispatcher.h |
@@ -0,0 +1,43 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef DeviceLightDispatcher_h |
+#define DeviceLightDispatcher_h |
+ |
+// TODO(riju) make DeviceSensorEventDispatcher.h common to all Device Apis |
+// by extracting it out of device_orientation |
+#include "modules/device_orientation/DeviceSensorEventDispatcher.h" |
+#include "public/platform/WebDeviceLightListener.h" |
+#include "wtf/RefPtr.h" |
+ |
+namespace WebCore { |
+ |
+class DeviceLightController; |
+ |
+// This class listens to device light data and dispatches it to all |
+// listening controllers |
+class DeviceLightDispatcher : public DeviceSensorEventDispatcher, public blink::WebDeviceLightListener { |
Inactive
2014/03/07 19:29:52
Can be marked as FINAL
riju_
2014/03/10 16:17:26
Done.
|
+public: |
+ static DeviceLightDispatcher& instance(); |
+ |
+ double latestDeviceLightData(); |
+ |
+ // This method is called every time new device light data is available. |
+ virtual void didChangeDeviceLight(const double&) OVERRIDE; |
Inactive
2014/03/07 19:29:52
const double& -> double?
riju_
2014/03/10 16:17:26
Done.
|
+ void addDeviceLightController(DeviceLightController*); |
+ void removeDeviceLightController(DeviceLightController*); |
+ |
+private: |
+ DeviceLightDispatcher(); |
+ ~DeviceLightDispatcher(); |
Inactive
2014/03/07 19:29:52
virtual
riju_
2014/03/10 16:17:26
Done.
|
+ |
+ virtual void startListening() OVERRIDE; |
+ virtual void stopListening() OVERRIDE; |
+ |
+ double m_lastDeviceLightData; |
+}; |
+ |
+} // namespace WebCore |
+ |
+#endif // DeviceLightDispatcher_h |