OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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 CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_ |
| 6 #define CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/compiler_specific.h" |
| 11 #include "content/public/renderer/render_process_observer.h" |
| 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBatteryMonitor.h" |
| 13 |
| 14 namespace WebKit { |
| 15 class WebBatteryMonitorClient; |
| 16 class WebBatteryStatus; |
| 17 } |
| 18 |
| 19 namespace content { |
| 20 |
| 21 class BatteryStatusDispatcher : public RenderProcessObserver, |
| 22 public WebKit::WebBatteryMonitor { |
| 23 public: |
| 24 BatteryStatusDispatcher(); |
| 25 virtual ~BatteryStatusDispatcher(); |
| 26 |
| 27 private: |
| 28 void OnBatteryStatusUpdated(const WebKit::WebBatteryStatus& battery_status); |
| 29 |
| 30 void StopUpdates(); |
| 31 |
| 32 // RenderProcessObserver implementation. |
| 33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| 34 |
| 35 // WebKit::WebBatteryMonitor implementation. |
| 36 virtual void start(WebKit::WebBatteryMonitorClient* client); |
| 37 virtual void stop(WebKit::WebBatteryMonitorClient* client); |
| 38 |
| 39 typedef std::vector<WebKit::WebBatteryMonitorClient*> |
| 40 WebBatteryMonitorClientList; |
| 41 WebBatteryMonitorClientList client_list_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher); |
| 44 }; |
| 45 |
| 46 } // namespace content |
| 47 |
| 48 #endif // CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_ |
OLD | NEW |