Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: Source/modules/device_light/DeviceLightDispatcher.h

Issue 315023006: Revert of Generalize and refactor DeviceSensorEvent* architecture to support multi-event type targets. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/DeviceEventDispatcherBase.h" 8 #include "core/frame/DeviceSensorEventDispatcher.h"
9 #include "public/platform/WebDeviceLightListener.h" 9 #include "public/platform/WebDeviceLightListener.h"
10 #include "wtf/RefPtr.h" 10 #include "wtf/RefPtr.h"
11 11
12 namespace WebCore { 12 namespace WebCore {
13 13
14 class DeviceLightController; 14 class DeviceLightController;
15 15
16 // This class listens to device light data and notifies all registered controlle rs. 16 // This class listens to device light data and dispatches it to all
17 class DeviceLightDispatcher FINAL : public DeviceEventDispatcherBase, public bli nk::WebDeviceLightListener { 17 // listening controllers
18 class DeviceLightDispatcher FINAL : public DeviceSensorEventDispatcher, public b link::WebDeviceLightListener {
18 public: 19 public:
19 static DeviceLightDispatcher& instance(); 20 static DeviceLightDispatcher& instance();
20 21
21 double latestDeviceLightData() const; 22 double latestDeviceLightData() const;
22 23
23 // Inherited from WebDeviceLightListener. 24 // This method is called every time new device light data is available.
24 virtual void didChangeDeviceLight(double) OVERRIDE; 25 virtual void didChangeDeviceLight(double) OVERRIDE;
26 void addDeviceLightController(DeviceLightController*);
27 void removeDeviceLightController(DeviceLightController*);
25 28
26 private: 29 private:
27 DeviceLightDispatcher(); 30 DeviceLightDispatcher();
28 virtual ~DeviceLightDispatcher(); 31 virtual ~DeviceLightDispatcher();
29 32
30 // Inherited from DeviceEventDispatcherBase.
31 virtual void startListening() OVERRIDE; 33 virtual void startListening() OVERRIDE;
32 virtual void stopListening() OVERRIDE; 34 virtual void stopListening() OVERRIDE;
33 35
34 double m_lastDeviceLightData; 36 double m_lastDeviceLightData;
35 }; 37 };
36 38
37 } // namespace WebCore 39 } // namespace WebCore
38 40
39 #endif // DeviceLightDispatcher_h 41 #endif // DeviceLightDispatcher_h
OLDNEW
« no previous file with comments | « Source/modules/device_light/DeviceLightController.cpp ('k') | Source/modules/device_light/DeviceLightDispatcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698