| OLD | NEW |
| 1 // Copyright (c) 2009 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 "app/system_monitor.h" | 5 #include "ui/base/system_monitor/system_monitor.h" |
| 6 |
| 7 namespace ui { |
| 6 | 8 |
| 7 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { | 9 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { |
| 8 PowerEvent power_event; | 10 PowerEvent power_event; |
| 9 switch (event_id) { | 11 switch (event_id) { |
| 10 case PBT_APMPOWERSTATUSCHANGE: // The power status changed. | 12 case PBT_APMPOWERSTATUSCHANGE: // The power status changed. |
| 11 power_event = POWER_STATE_EVENT; | 13 power_event = POWER_STATE_EVENT; |
| 12 break; | 14 break; |
| 13 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend. | 15 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend. |
| 14 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend. | 16 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend. |
| 15 // We don't notify for this latter event | 17 // We don't notify for this latter event |
| (...skipping 21 matching lines...) Expand all Loading... |
| 37 // 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 |
| 38 // battery power. Returns true if running on battery. | 40 // battery power. Returns true if running on battery. |
| 39 bool SystemMonitor::IsBatteryPower() { | 41 bool SystemMonitor::IsBatteryPower() { |
| 40 SYSTEM_POWER_STATUS status; | 42 SYSTEM_POWER_STATUS status; |
| 41 if (!GetSystemPowerStatus(&status)) { | 43 if (!GetSystemPowerStatus(&status)) { |
| 42 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); | 44 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); |
| 43 return false; | 45 return false; |
| 44 } | 46 } |
| 45 return (status.ACLineStatus == 0); | 47 return (status.ACLineStatus == 0); |
| 46 } | 48 } |
| 49 |
| 50 } // namespace ui |
| OLD | NEW |