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 BatteryDispatcher_h | 5 #ifndef BatteryDispatcher_h |
6 #define BatteryDispatcher_h | 6 #define BatteryDispatcher_h |
7 | 7 |
8 #include "core/frame/PlatformEventDispatcher.h" | 8 #include "core/frame/PlatformEventDispatcher.h" |
9 #include "modules/battery/BatteryManager.h" | 9 #include "modules/battery/BatteryManager.h" |
10 #include "modules/battery/BatteryStatus.h" | 10 #include "modules/battery/BatteryStatus.h" |
11 #include "public/platform/WebBatteryStatusListener.h" | 11 #include "public/platform/WebBatteryStatusListener.h" |
12 | 12 |
13 namespace blink { | 13 namespace blink { |
14 | 14 |
15 class WebBatteryStatus; | 15 class WebBatteryStatus; |
16 | 16 |
17 class BatteryDispatcher FINAL : public PlatformEventDispatcher, public WebBatter
yStatusListener { | 17 class BatteryDispatcher final : public GarbageCollectedFinalized<BatteryDispatch
er>, public PlatformEventDispatcher, public WebBatteryStatusListener { |
| 18 USING_GARBAGE_COLLECTED_MIXIN(BatteryDispatcher); |
18 public: | 19 public: |
19 static BatteryDispatcher& instance(); | 20 static BatteryDispatcher& instance(); |
20 virtual ~BatteryDispatcher(); | 21 virtual ~BatteryDispatcher(); |
21 | 22 |
22 BatteryStatus* latestData(); | 23 BatteryStatus* latestData(); |
23 | 24 |
24 // Inherited from WebBatteryStatusListener. | 25 // Inherited from WebBatteryStatusListener. |
25 virtual void updateBatteryStatus(const WebBatteryStatus&) OVERRIDE; | 26 virtual void updateBatteryStatus(const WebBatteryStatus&) override; |
| 27 |
| 28 virtual void trace(Visitor*) override; |
26 | 29 |
27 private: | 30 private: |
28 BatteryDispatcher(); | 31 BatteryDispatcher(); |
29 | 32 |
30 // Inherited from PlatformEventDispatcher. | 33 // Inherited from PlatformEventDispatcher. |
31 virtual void startListening() OVERRIDE; | 34 virtual void startListening() override; |
32 virtual void stopListening() OVERRIDE; | 35 virtual void stopListening() override; |
33 | 36 |
34 Persistent<BatteryStatus> m_batteryStatus; | 37 Member<BatteryStatus> m_batteryStatus; |
35 }; | 38 }; |
36 | 39 |
37 } // namespace blink | 40 } // namespace blink |
38 | 41 |
39 #endif // BatteryDispatcher_h | 42 #endif // BatteryDispatcher_h |
OLD | NEW |