• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3 // found in the LICENSE file.
4 
5 #ifndef BatteryDispatcher_h
6 #define BatteryDispatcher_h
7 
8 #include "core/frame/PlatformEventDispatcher.h"
9 #include "modules/battery/BatteryManager.h"
10 #include "modules/battery/BatteryStatus.h"
11 #include "public/platform/WebBatteryStatusListener.h"
12 
13 namespace blink {
14 
15 class WebBatteryStatus;
16 
17 class BatteryDispatcher FINAL : public PlatformEventDispatcher, public WebBatteryStatusListener {
18 public:
19     static BatteryDispatcher& instance();
20     virtual ~BatteryDispatcher();
21 
22     BatteryStatus* latestData();
23 
24     // Inherited from WebBatteryStatusListener.
25     virtual void updateBatteryStatus(const WebBatteryStatus&) OVERRIDE;
26 
27 private:
28     BatteryDispatcher();
29 
30     // Inherited from PlatformEventDispatcher.
31     virtual void startListening() OVERRIDE;
32     virtual void stopListening() OVERRIDE;
33 
34     Persistent<BatteryStatus> m_batteryStatus;
35 };
36 
37 } // namespace blink
38 
39 #endif // BatteryDispatcher_h
40