| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 5 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
| 6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/base_api.h" | 9 #include "base/base_api.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 bool BatteryPower() const { | 59 bool BatteryPower() const { |
| 60 // Using a lock here is not necessary for just a bool. | 60 // Using a lock here is not necessary for just a bool. |
| 61 return battery_in_use_; | 61 return battery_in_use_; |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Callbacks will be called on the thread which creates the SystemMonitor. | 64 // Callbacks will be called on the thread which creates the SystemMonitor. |
| 65 // During the callback, Add/RemoveObserver will block until the callbacks | 65 // During the callback, Add/RemoveObserver will block until the callbacks |
| 66 // are finished. Observers should implement quick callback functions; if | 66 // are finished. Observers should implement quick callback functions; if |
| 67 // lengthy operations are needed, the observer should take care to invoke | 67 // lengthy operations are needed, the observer should take care to invoke |
| 68 // the operation on an appropriate thread. | 68 // the operation on an appropriate thread. |
| 69 class PowerObserver { | 69 class BASE_API PowerObserver { |
| 70 public: | 70 public: |
| 71 // Notification of a change in power status of the computer, such | 71 // Notification of a change in power status of the computer, such |
| 72 // as from switching between battery and A/C power. | 72 // as from switching between battery and A/C power. |
| 73 virtual void OnPowerStateChange(bool on_battery_power) {} | 73 virtual void OnPowerStateChange(bool on_battery_power) {} |
| 74 | 74 |
| 75 // Notification that the system is suspending. | 75 // Notification that the system is suspending. |
| 76 virtual void OnSuspend() {} | 76 virtual void OnSuspend() {} |
| 77 | 77 |
| 78 // Notification that the system is resuming. | 78 // Notification that the system is resuming. |
| 79 virtual void OnResume() {} | 79 virtual void OnResume() {} |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 IONotificationPortRef notification_port_ref_; | 134 IONotificationPortRef notification_port_ref_; |
| 135 io_object_t notifier_object_; | 135 io_object_t notifier_object_; |
| 136 #endif | 136 #endif |
| 137 | 137 |
| 138 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); | 138 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 } // namespace base | 141 } // namespace base |
| 142 | 142 |
| 143 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 143 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
| OLD | NEW |