| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 ProcessPowerEventHelper(power_event); | 48 ProcessPowerEventHelper(power_event); |
| 49 } | 49 } |
| 50 | 50 |
| 51 } // namespace | 51 } // namespace |
| 52 | 52 |
| 53 // Function to query the system to see if it is currently running on | 53 // Function to query the system to see if it is currently running on |
| 54 // battery power. Returns true if running on battery. | 54 // battery power. Returns true if running on battery. |
| 55 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { | 55 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() { |
| 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 DPLOG(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 (!MessageLoopForUI::IsCurrent()) { | 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 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |