OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "base/power_monitor/power_monitor.h" | 5 #include "base/power_monitor/power_monitor.h" |
6 #include "base/power_monitor/power_monitor_device_source.h" | 6 #include "base/power_monitor/power_monitor_device_source.h" |
7 #include "base/power_monitor/power_monitor_source.h" | 7 #include "base/power_monitor/power_monitor_source.h" |
8 #include "base/win/wrapped_window_proc.h" | 8 #include "base/win/wrapped_window_proc.h" |
9 | 9 |
10 namespace base { | 10 namespace base { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 SYSTEM_POWER_STATUS status; | 56 SYSTEM_POWER_STATUS status; |
57 if (!GetSystemPowerStatus(&status)) { | 57 if (!GetSystemPowerStatus(&status)) { |
58 DLOG_GETLASTERROR(ERROR) << "GetSystemPowerStatus failed"; | 58 DLOG_GETLASTERROR(ERROR) << "GetSystemPowerStatus failed"; |
59 return false; | 59 return false; |
60 } | 60 } |
61 return (status.ACLineStatus == 0); | 61 return (status.ACLineStatus == 0); |
62 } | 62 } |
63 | 63 |
64 PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow() | 64 PowerMonitorDeviceSource::PowerMessageWindow::PowerMessageWindow() |
65 : instance_(NULL), message_hwnd_(NULL) { | 65 : instance_(NULL), message_hwnd_(NULL) { |
66 if (MessageLoop::current()->type() != MessageLoop::TYPE_UI) { | 66 if (!MessageLoopForUI::IsCurrent()) { |
67 // Creating this window in (e.g.) a renderer inhibits shutdown on Windows. | 67 // Creating this window in (e.g.) a renderer inhibits shutdown on Windows. |
68 // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031 | 68 // See http://crbug.com/230122. TODO(vandebo): http://crbug.com/236031 |
69 DLOG(ERROR) | 69 DLOG(ERROR) |
70 << "Cannot create windows on non-UI thread, power monitor disabled!"; | 70 << "Cannot create windows on non-UI thread, power monitor disabled!"; |
71 return; | 71 return; |
72 } | 72 } |
73 WNDCLASSEX window_class; | 73 WNDCLASSEX window_class; |
74 base::win::InitializeWindowClass( | 74 base::win::InitializeWindowClass( |
75 kWindowClassName, | 75 kWindowClassName, |
76 &base::win::WrappedWindowProc< | 76 &base::win::WrappedWindowProc< |
(...skipping 24 matching lines...) Expand all Loading... |
101 switch (message) { | 101 switch (message) { |
102 case WM_POWERBROADCAST: | 102 case WM_POWERBROADCAST: |
103 ProcessWmPowerBroadcastMessage(wparam); | 103 ProcessWmPowerBroadcastMessage(wparam); |
104 return TRUE; | 104 return TRUE; |
105 default: | 105 default: |
106 return ::DefWindowProc(hwnd, message, wparam, lparam); | 106 return ::DefWindowProc(hwnd, message, wparam, lparam); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 } // namespace base | 110 } // namespace base |
OLD | NEW |