| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/system_monitor/system_monitor.h" | 5 #include "base/system_monitor/system_monitor.h" |
| 6 | 6 |
| 7 namespace base { | 7 namespace base { |
| 8 | 8 |
| 9 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { | 9 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { |
| 10 PowerEvent power_event; | 10 PowerEvent power_event; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 // PBT_POWERSETTINGCHANGE - user changed the power settings. | 34 // PBT_POWERSETTINGCHANGE - user changed the power settings. |
| 35 } | 35 } |
| 36 ProcessPowerMessage(power_event); | 36 ProcessPowerMessage(power_event); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // Function to query the system to see if it is currently running on | 39 // Function to query the system to see if it is currently running on |
| 40 // battery power. Returns true if running on battery. | 40 // battery power. Returns true if running on battery. |
| 41 bool SystemMonitor::IsBatteryPower() { | 41 bool SystemMonitor::IsBatteryPower() { |
| 42 SYSTEM_POWER_STATUS status; | 42 SYSTEM_POWER_STATUS status; |
| 43 if (!GetSystemPowerStatus(&status)) { | 43 if (!GetSystemPowerStatus(&status)) { |
| 44 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); | 44 DLOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); |
| 45 return false; | 45 return false; |
| 46 } | 46 } |
| 47 return (status.ACLineStatus == 0); | 47 return (status.ACLineStatus == 0); |
| 48 } | 48 } |
| 49 | 49 |
| 50 } // namespace base | 50 } // namespace base |
| OLD | NEW |