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

Unified 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: add message only window into base/ 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/system_monitor/system_monitor_win.cc » ('j') | base/system_monitor/system_monitor_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..fc19269059df80e111b31ee90270d24d273acfd8 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,38 @@ class BASE_EXPORT SystemMonitor {
void ProcessDevicesChanged(DeviceType device_type);
private:
-#if defined(OS_MACOSX)
+#if defined(OS_MACOSX) || defined(OS_WIN)
void PlatformInit();
void PlatformDestroy();
#endif
+#if defined(OS_WIN)
+ // Represents a message-only window for power message handling on Windows. It
+ // has the same life cycle as the SystemMonitor does.
+ class PowerMessageWindow {
+ public:
+ PowerMessageWindow(SystemMonitor* monitor);
vandebo (ex-Chrome) 2013/02/20 22:30:40 explicit
Hongbo Min 2013/02/21 07:39:08 No monitor parameter passed to ctor now.
+ ~PowerMessageWindow();
+
+ private:
+ void InitMessageHWND();
+ 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);
+ SystemMonitor* monitor_;
+ // Instance of the module containing the window procedure.
+ HMODULE instance_;
+ // A hidden message-only window.
+ HWND message_hwnd_;
+ };
+
+ scoped_ptr<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.
« no previous file with comments | « no previous file | base/system_monitor/system_monitor_win.cc » ('j') | base/system_monitor/system_monitor_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698