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

Unified Diff: base/power_monitor/power_observer.h

Issue 10959020: SystemMonitor refactoring: move power state monitor into a separate class called PowerMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Use PowerMonitor instead of SystemMonitor in XXXMain function Created 7 years, 9 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: base/power_monitor/power_observer.h
diff --git a/base/power_monitor/power_observer.h b/base/power_monitor/power_observer.h
new file mode 100644
index 0000000000000000000000000000000000000000..06ba164e071f1c026ae92a04cc10978054f51929
--- /dev/null
+++ b/base/power_monitor/power_observer.h
@@ -0,0 +1,36 @@
+// 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 BASE_POWER_MONITOR_POWER_OBSERVER_H_
+#define BASE_POWER_MONITOR_POWER_OBSERVER_H_
+
+#include "base/base_export.h"
+#include "base/compiler_specific.h"
vandebo (ex-Chrome) 2013/03/19 23:36:04 I don't think you need this.
Hongbo Min 2013/03/20 13:01:50 It is needed since OVERRIDE directive should be us
+
+namespace base {
+
+// Callbacks will be called on the thread which creates the PowerMonitor.
vandebo (ex-Chrome) 2013/03/19 23:36:04 This conflicts with the documentation in observer_
Hongbo Min 2013/03/20 13:01:50 Removed the comments.
+// During the callback, Add/RemoveObserver will block until the callbacks
+// are finished. Observers should implement quick callback functions; if
+// lengthy operations are needed, the observer should take care to invoke
+// the operation on an appropriate thread.
+class BASE_EXPORT PowerObserver {
+ public:
+ // Notification of a change in power status of the computer, such
+ // as from switching between battery and A/C power.
+ virtual void OnPowerStateChange(bool on_battery_power) {};
+
+ // Notification that the system is suspending.
+ virtual void OnSuspend() {}
+
+ // Notification that the system is resuming.
+ virtual void OnResume() {}
+
+ protected:
+ virtual ~PowerObserver() {}
+};
+
+} // namespace base
+
+#endif // BASE_POWER_MONITOR_POWER_OBSERVER_H_

Powered by Google App Engine
This is Rietveld 408576698