Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(391)

Side by Side Diff: app/system_monitor_win.cc

Issue 431008: Make SystemMonitor not a Singleton and move it out of base (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: fix ChromeFrame build Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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.h" 5 #include "app/system_monitor.h"
6
7 namespace base {
8 6
9 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) { 7 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {
10 PowerEvent power_event; 8 PowerEvent power_event;
11 switch (event_id) { 9 switch (event_id) {
12 case PBT_APMPOWERSTATUSCHANGE: // The power status changed. 10 case PBT_APMPOWERSTATUSCHANGE: // The power status changed.
13 power_event = POWER_STATE_EVENT; 11 power_event = POWER_STATE_EVENT;
14 break; 12 break;
15 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend. 13 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend.
16 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend. 14 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend.
17 // We don't notify for this latter event 15 // We don't notify for this latter event
(...skipping 21 matching lines...) Expand all
39 // Function to query the system to see if it is currently running on 37 // Function to query the system to see if it is currently running on
40 // battery power. Returns true if running on battery. 38 // battery power. Returns true if running on battery.
41 bool SystemMonitor::IsBatteryPower() { 39 bool SystemMonitor::IsBatteryPower() {
42 SYSTEM_POWER_STATUS status; 40 SYSTEM_POWER_STATUS status;
43 if (!GetSystemPowerStatus(&status)) { 41 if (!GetSystemPowerStatus(&status)) {
44 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); 42 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
45 return false; 43 return false;
46 } 44 }
47 return (status.ACLineStatus == 0); 45 return (status.ACLineStatus == 0);
48 } 46 }
49
50
51
52 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698