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

Unified Diff: content/common/power_monitor_service.h

Issue 17074009: Created multi-process-friendly PowerMonitor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
Index: content/common/power_monitor_service.h
diff --git a/content/common/power_monitor_service.h b/content/common/power_monitor_service.h
new file mode 100644
index 0000000000000000000000000000000000000000..86111acfb88455c141cfd249bd670f69ada58ee7
--- /dev/null
+++ b/content/common/power_monitor_service.h
@@ -0,0 +1,44 @@
+// Copyright 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_COMMON_POWER_MONITOR_SERVICE_H_
+#define CONTENT_COMMON_POWER_MONITOR_SERVICE_H_
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "base/power_monitor/power_observer.h"
+
+#include "content/common/content_export.h"
+
+namespace IPC {
+ class Sender;
+}
+
+namespace content {
+
+// A class used to monitor the power state change and notify the observers about
+// the change event.
Ken Russell (switch to Gerrit) 2013/06/24 22:54:38 Isn't this documentation inaccurate? This class mo
bajones 2013/06/25 18:33:34 No precedent aside from my still-fuzzy understandi
+class CONTENT_EXPORT PowerMonitorService : public base::PowerObserver,
+ public base::RefCounted<PowerMonitorService> {
+public:
+ PowerMonitorService(IPC::Sender* sender);
+
+ // Implement PowerObserver.
+ virtual void OnPowerStateChange(bool on_battery_power) OVERRIDE;
+ virtual void OnSuspend() OVERRIDE;
+ virtual void OnResume() OVERRIDE;
+
+private:
+ friend class base::RefCounted<PowerMonitorService>;
+
+ virtual ~PowerMonitorService();
+
+ IPC::Sender* sender_;
+
+ DISALLOW_COPY_AND_ASSIGN(PowerMonitorService);
+};
+
+} // namespace base
+
+#endif // CONTENT_COMMON_POWER_MONITOR_CLIENT_H_

Powered by Google App Engine
This is Rietveld 408576698