Index: ui/views/win/hwnd_message_handler.cc |
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc |
index c52deb53156bbe562d5acdd2bfbb693e1f5434a2..28e0b06830dfcb936e2e72e2a58f422ec16dc6d3 100644 |
--- a/ui/views/win/hwnd_message_handler.cc |
+++ b/ui/views/win/hwnd_message_handler.cc |
@@ -8,7 +8,7 @@ |
#include <shellapi.h> |
#include "base/bind.h" |
-#include "base/system_monitor/system_monitor.h" |
+#include "base/power_monitor/power_monitor.h" |
#include "base/win/windows_version.h" |
#include "ui/base/events/event.h" |
#include "ui/base/keycodes/keyboard_code_conversion_win.h" |
@@ -40,6 +40,9 @@ |
namespace views { |
namespace { |
+// Reference the Notifier defined in the global PowerMonitor instance. |
+base::PowerMonitor::Notifier* g_power_notifier = NULL; |
vandebo (ex-Chrome)
2012/10/23 01:27:57
Set this in the constructor and assert that we get
|
+ |
// MoveLoopMouseWatcher is used to determine if the user canceled or completed a |
// move. win32 doesn't appear to offer a way to determine the result of a move, |
// so we install hooks to determine if we got a mouse up and assume the move |
@@ -1852,9 +1855,11 @@ void HWNDMessageHandler::OnPaint(HDC dc) { |
} |
LRESULT HWNDMessageHandler::OnPowerBroadcast(DWORD power_event, DWORD data) { |
- base::SystemMonitor* monitor = base::SystemMonitor::Get(); |
- if (monitor) |
- monitor->ProcessWmPowerBroadcastMessage(power_event); |
+ if (g_power_notifier == NULL) |
+ g_power_notifier = base::PowerMonitor::GetInstance()->GetNotifierOnce(); |
+ if (g_power_notifier) |
+ g_power_notifier->ProcessWmPowerBroadcastMessage(power_event); |
+ |
SetMsgHandled(FALSE); |
return 0; |
} |