Index: base/system_monitor/system_monitor.h |
diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h |
index 6620d27b42d109a65ceb86aaefe730f5e75dd07f..b60fb11740593208e295967722bd2c229b0f52a1 100644 |
--- a/base/system_monitor/system_monitor.h |
+++ b/base/system_monitor/system_monitor.h |
@@ -134,13 +134,6 @@ class BASE_EXPORT SystemMonitor { |
// be copied. Any significant addition to this class is blocked on |
// refactoring to improve the state of affairs. See http://crbug.com/149059 |
-#if defined(OS_WIN) |
- // Windows-specific handling of a WM_POWERBROADCAST message. |
- // Embedders of this API should hook their top-level window |
- // message loop and forward WM_POWERBROADCAST through this call. |
- void ProcessWmPowerBroadcastMessage(int event_id); |
-#endif |
- |
// Cross-platform handling of a power event. |
void ProcessPowerMessage(PowerEvent event_id); |
@@ -148,11 +141,36 @@ class BASE_EXPORT SystemMonitor { |
void ProcessDevicesChanged(DeviceType device_type); |
private: |
-#if defined(OS_MACOSX) |
+#if defined(OS_MACOSX) || defined(OS_WIN) |
vandebo (ex-Chrome)
2013/02/21 19:47:17
Remove change - you don't have PlatformInit/Desotr
Hongbo Min
2013/02/22 06:55:43
Done.
|
void PlatformInit(); |
void PlatformDestroy(); |
#endif |
+#if defined(OS_WIN) |
+ // Represents a message-only window for power message handling on Windows. |
+ // Only allow SystemMonitor to create it. |
+ class PowerMessageWindow { |
vandebo (ex-Chrome)
2013/02/21 19:47:17
Brett's point was that this can be an anonymous cl
Hongbo Min
2013/02/22 06:55:43
The problem is, if we just declare the class here
vandebo (ex-Chrome)
2013/02/23 01:14:53
Good point. Put it in system_monitor_win.cc and u
|
+ private: |
+ friend class SystemMonitor; |
vandebo (ex-Chrome)
2013/02/21 19:47:17
Looks like won't need this friend declaration afte
Hongbo Min
2013/02/22 06:55:43
Actually, no need to make ctor and dtor as private
|
+ |
+ PowerMessageWindow(); |
+ ~PowerMessageWindow(); |
+ void ProcessWmPowerBroadcastMessage(int event_id); |
+ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, |
+ WPARAM wparam, LPARAM lparam); |
+ static LRESULT CALLBACK WndProcThunk(HWND hwnd, |
+ UINT message, |
+ WPARAM wparam, |
+ LPARAM lparam); |
+ // Instance of the module containing the window procedure. |
+ HMODULE instance_; |
+ // A hidden message-only window. |
+ HWND message_hwnd_; |
+ }; |
+ |
+ PowerMessageWindow power_message_window_; |
+#endif |
+ |
// Platform-specific method to check whether the system is currently |
// running on battery power. Returns true if running on batteries, |
// false otherwise. |