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

Unified Diff: content/child/power_monitor_broadcast_source.h

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing windows unit test errors Created 7 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/child/child_thread.cc ('k') | content/child/power_monitor_broadcast_source.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/power_monitor_broadcast_source.h
diff --git a/content/child/power_monitor_broadcast_source.h b/content/child/power_monitor_broadcast_source.h
new file mode 100644
index 0000000000000000000000000000000000000000..c2553f8d46d45f8471a8c0dd291183c995904bff
--- /dev/null
+++ b/content/child/power_monitor_broadcast_source.h
@@ -0,0 +1,44 @@
+// Copyright (c) 2013 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_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_
+#define CONTENT_CHILD_POWER_MONITOR_BROADCAST_SOURCE_H_
+
+#include "base/power_monitor/power_monitor_source.h"
+#include "content/common/content_export.h"
+#include "ipc/ipc_channel.h"
+#include "ipc/ipc_channel_proxy.h"
+
+namespace content {
+
+class PowerMessageFilter;
+
+// Receives Power Monitor IPC messages sent from the browser process and relays
+// them to the PowerMonitor of the current process.
+class CONTENT_EXPORT PowerMonitorBroadcastSource :
+ public base::PowerMonitorSource {
+ public:
+ explicit PowerMonitorBroadcastSource();
+ virtual ~PowerMonitorBroadcastSource();
+
+ IPC::ChannelProxy::MessageFilter* GetMessageFilter();
+
+ private:
+ friend class PowerMessageFilter;
+
+ virtual bool IsOnBatteryPowerImpl() OVERRIDE;
+
+ void OnPowerStateChange(bool on_battery_power);
+ void OnSuspend();
+ void OnResume();
+
+ bool last_reported_battery_power_state_;
+ scoped_refptr<PowerMessageFilter> message_filter_;
+
+ DISALLOW_COPY_AND_ASSIGN(PowerMonitorBroadcastSource);
+};
+
+} // namespace content
+
+#endif // CONTENT_CHILD_POWER_MONITOR_MESSAGE_FILTER_H_
« no previous file with comments | « content/child/child_thread.cc ('k') | content/child/power_monitor_broadcast_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698