OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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_H_ | 5 #ifndef BASE_SYSTEM_MONITOR_H_ |
6 #define BASE_SYSTEM_MONITOR_H_ | 6 #define BASE_SYSTEM_MONITOR_H_ |
7 | 7 |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 | 9 |
10 // Windows HiRes timers drain the battery faster so we need to know the battery | 10 // Windows HiRes timers drain the battery faster so we need to know the battery |
11 // status. This isn't true for other platforms. | 11 // status. This isn't true for other platforms. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 public: | 65 public: |
66 // Notification of a change in power status of the computer, such | 66 // Notification of a change in power status of the computer, such |
67 // as from switching between battery and A/C power. | 67 // as from switching between battery and A/C power. |
68 virtual void OnPowerStateChange(SystemMonitor*) = 0; | 68 virtual void OnPowerStateChange(SystemMonitor*) = 0; |
69 | 69 |
70 // Notification that the system is suspending. | 70 // Notification that the system is suspending. |
71 virtual void OnSuspend(SystemMonitor*) = 0; | 71 virtual void OnSuspend(SystemMonitor*) = 0; |
72 | 72 |
73 // Notification that the system is resuming. | 73 // Notification that the system is resuming. |
74 virtual void OnResume(SystemMonitor*) = 0; | 74 virtual void OnResume(SystemMonitor*) = 0; |
75 | |
76 protected: | |
77 ~PowerObserver() {} | |
78 }; | 75 }; |
79 | 76 |
80 // Add a new observer. | 77 // Add a new observer. |
81 // Can be called from any thread. | 78 // Can be called from any thread. |
82 // Must not be called from within a notification callback. | 79 // Must not be called from within a notification callback. |
83 void AddObserver(PowerObserver* obs); | 80 void AddObserver(PowerObserver* obs); |
84 | 81 |
85 // Remove an existing observer. | 82 // Remove an existing observer. |
86 // Can be called from any thread. | 83 // Can be called from any thread. |
87 // Must not be called from within a notification callback. | 84 // Must not be called from within a notification callback. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 #if defined(ENABLE_BATTERY_MONITORING) | 120 #if defined(ENABLE_BATTERY_MONITORING) |
124 base::OneShotTimer<SystemMonitor> delayed_battery_check_; | 121 base::OneShotTimer<SystemMonitor> delayed_battery_check_; |
125 #endif | 122 #endif |
126 | 123 |
127 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); | 124 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); |
128 }; | 125 }; |
129 | 126 |
130 } | 127 } |
131 | 128 |
132 #endif // BASE_SYSTEM_MONITOR_H_ | 129 #endif // BASE_SYSTEM_MONITOR_H_ |
OLD | NEW |