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

Side by Side Diff: base/system_monitor/system_monitor.h

Issue 11821050: Move power event handling logic from ui/ to base/ on Windows (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: use scoped_ptr Created 7 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/system_monitor/system_monitor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Remove an existing observer. 127 // Remove an existing observer.
128 // Can be called from any thread. 128 // Can be called from any thread.
129 // Must not be called from within a notification callback. 129 // Must not be called from within a notification callback.
130 void RemovePowerObserver(PowerObserver* obs); 130 void RemovePowerObserver(PowerObserver* obs);
131 void RemoveDevicesChangedObserver(DevicesChangedObserver* obs); 131 void RemoveDevicesChangedObserver(DevicesChangedObserver* obs);
132 132
133 // The ProcessFoo() style methods are a broken pattern and should not 133 // The ProcessFoo() style methods are a broken pattern and should not
134 // be copied. Any significant addition to this class is blocked on 134 // be copied. Any significant addition to this class is blocked on
135 // refactoring to improve the state of affairs. See http://crbug.com/149059 135 // refactoring to improve the state of affairs. See http://crbug.com/149059
136 136
137 #if defined(OS_WIN)
138 // Windows-specific handling of a WM_POWERBROADCAST message.
139 // Embedders of this API should hook their top-level window
140 // message loop and forward WM_POWERBROADCAST through this call.
141 void ProcessWmPowerBroadcastMessage(int event_id);
142 #endif
143
144 // Cross-platform handling of a power event. 137 // Cross-platform handling of a power event.
145 void ProcessPowerMessage(PowerEvent event_id); 138 void ProcessPowerMessage(PowerEvent event_id);
146 139
147 // Cross-platform handling of a device change event. 140 // Cross-platform handling of a device change event.
148 void ProcessDevicesChanged(DeviceType device_type); 141 void ProcessDevicesChanged(DeviceType device_type);
149 142
150 private: 143 private:
151 #if defined(OS_MACOSX) 144 #if defined(OS_MACOSX)
152 void PlatformInit(); 145 void PlatformInit();
153 void PlatformDestroy(); 146 void PlatformDestroy();
154 #endif 147 #endif
155 148
149 #if defined(OS_WIN)
150 // Represents a message-only window for power message handling on Windows.
151 // Only allow SystemMonitor to create it.
152 class PowerMessageWindow;
vandebo (ex-Chrome) 2013/02/23 01:14:53 style guide says this should go on line 144.
Hongbo Min 2013/02/23 03:42:01 Done.
153 scoped_ptr<PowerMessageWindow> power_message_window_;
vandebo (ex-Chrome) 2013/02/23 01:14:53 style guide says this should go on line 185.
Hongbo Min 2013/02/23 03:42:01 Done.
154 #endif
155
156 // Platform-specific method to check whether the system is currently 156 // Platform-specific method to check whether the system is currently
157 // running on battery power. Returns true if running on batteries, 157 // running on battery power. Returns true if running on batteries,
158 // false otherwise. 158 // false otherwise.
159 bool IsBatteryPower(); 159 bool IsBatteryPower();
160 160
161 // Checks the battery status and notifies observers if the battery 161 // Checks the battery status and notifies observers if the battery
162 // status has changed. 162 // status has changed.
163 void BatteryCheck(); 163 void BatteryCheck();
164 164
165 // Functions to trigger notifications. 165 // Functions to trigger notifications.
(...skipping 16 matching lines...) Expand all
182 // Holds pointers to system event notification observers. 182 // Holds pointers to system event notification observers.
183 std::vector<id> notification_observers_; 183 std::vector<id> notification_observers_;
184 #endif 184 #endif
185 185
186 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); 186 DISALLOW_COPY_AND_ASSIGN(SystemMonitor);
187 }; 187 };
188 188
189 } // namespace base 189 } // namespace base
190 190
191 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ 191 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_
OLDNEW
« no previous file with comments | « no previous file | base/system_monitor/system_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698