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_ |