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

Unified Diff: content/renderer/battery_status_dispatcher.h

Issue 10024013: chromeos: Add support for the battery status API on chromeos. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/public/browser/power_supply_status.h ('k') | content/renderer/battery_status_dispatcher.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/battery_status_dispatcher.h
diff --git a/content/renderer/battery_status_dispatcher.h b/content/renderer/battery_status_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..7e613bfde839503d8dca553f8991de03a8fa3f2a
--- /dev/null
+++ b/content/renderer/battery_status_dispatcher.h
@@ -0,0 +1,48 @@
+// Copyright (c) 2012 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 CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_
+#define CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_
+
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "content/public/renderer/render_process_observer.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebBatteryMonitor.h"
+
+namespace WebKit {
+class WebBatteryMonitorClient;
+class WebBatteryStatus;
+}
+
+namespace content {
+
+class BatteryStatusDispatcher : public RenderProcessObserver,
+ public WebKit::WebBatteryMonitor {
+ public:
+ BatteryStatusDispatcher();
+ virtual ~BatteryStatusDispatcher();
+
+ private:
+ void OnBatteryStatusUpdated(const WebKit::WebBatteryStatus& battery_status);
+
+ void StopUpdates();
+
+ // RenderProcessObserver implementation.
+ virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
+
+ // WebKit::WebBatteryMonitor implementation.
+ virtual void start(WebKit::WebBatteryMonitorClient* client);
+ virtual void stop(WebKit::WebBatteryMonitorClient* client);
+
+ typedef std::vector<WebKit::WebBatteryMonitorClient*>
+ WebBatteryMonitorClientList;
+ WebBatteryMonitorClientList client_list_;
+
+ DISALLOW_COPY_AND_ASSIGN(BatteryStatusDispatcher);
+};
+
+} // namespace content
+
+#endif // CONTENT_RENDERER_BATTERY_STATUS_DISPATCHER_H_
« no previous file with comments | « content/public/browser/power_supply_status.h ('k') | content/renderer/battery_status_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698