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

Side by Side Diff: base/system_monitor_win.cc

Issue 4288: Make the SystemMonitor observer list thread safe.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 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
« no previous file with comments | « base/system_monitor_unittest.cc ('k') | base/time_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 "base/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;
11 switch (event_id) { 11 switch (event_id) {
12 case PBT_APMPOWERSTATUSCHANGE: 12 case PBT_APMPOWERSTATUSCHANGE:
13 power_event = PowerStateEvent; 13 power_event = POWER_STATE_EVENT;
14 break; 14 break;
15 case PBT_APMRESUMEAUTOMATIC: 15 case PBT_APMRESUMEAUTOMATIC:
16 power_event = ResumeEvent; 16 power_event = RESUME_EVENT;
17 break; 17 break;
18 case PBT_APMSUSPEND: 18 case PBT_APMSUSPEND:
19 power_event = SuspendEvent; 19 power_event = SUSPEND_EVENT;
20 break; 20 break;
21 default: 21 default:
22 DCHECK(false); 22 DCHECK(false);
23 } 23 }
24 ProcessPowerMessage(power_event); 24 ProcessPowerMessage(power_event);
25 } 25 }
26 26
27 // Function to query the system to see if it is currently running on 27 // Function to query the system to see if it is currently running on
28 // battery power. Returns true if running on battery. 28 // battery power. Returns true if running on battery.
29 bool SystemMonitor::IsBatteryPower() { 29 bool SystemMonitor::IsBatteryPower() {
30 SYSTEM_POWER_STATUS status; 30 SYSTEM_POWER_STATUS status;
31 if (!GetSystemPowerStatus(&status)) { 31 if (!GetSystemPowerStatus(&status)) {
32 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError(); 32 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
33 return false; 33 return false;
34 } 34 }
35 return (status.ACLineStatus == 0); 35 return (status.ACLineStatus == 0);
36 } 36 }
37 37
38 38
39 39
40 } // namespace base 40 } // namespace base
OLDNEW
« no previous file with comments | « base/system_monitor_unittest.cc ('k') | base/time_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698