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

Side by Side Diff: app/system_monitor_win.cc

Issue 6361002: Move SystemMonitor to src/chrome/common.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 months 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 | « app/system_monitor_unittest.cc ('k') | chrome/browser/browser_main.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "app/system_monitor.h"
6
7 void SystemMonitor::ProcessWmPowerBroadcastMessage(int event_id) {
8 PowerEvent power_event;
9 switch (event_id) {
10 case PBT_APMPOWERSTATUSCHANGE: // The power status changed.
11 power_event = POWER_STATE_EVENT;
12 break;
13 case PBT_APMRESUMEAUTOMATIC: // Resume from suspend.
14 //case PBT_APMRESUMESUSPEND: // User-initiated resume from suspend.
15 // We don't notify for this latter event
16 // because if it occurs it is always sent as a
17 // second event after PBT_APMRESUMEAUTOMATIC.
18 power_event = RESUME_EVENT;
19 break;
20 case PBT_APMSUSPEND: // System has been suspended.
21 power_event = SUSPEND_EVENT;
22 break;
23 default:
24 return;
25
26 // Other Power Events:
27 // PBT_APMBATTERYLOW - removed in Vista.
28 // PBT_APMOEMEVENT - removed in Vista.
29 // PBT_APMQUERYSUSPEND - removed in Vista.
30 // PBT_APMQUERYSUSPENDFAILED - removed in Vista.
31 // PBT_APMRESUMECRITICAL - removed in Vista.
32 // PBT_POWERSETTINGCHANGE - user changed the power settings.
33 }
34 ProcessPowerMessage(power_event);
35 }
36
37 // Function to query the system to see if it is currently running on
38 // battery power. Returns true if running on battery.
39 bool SystemMonitor::IsBatteryPower() {
40 SYSTEM_POWER_STATUS status;
41 if (!GetSystemPowerStatus(&status)) {
42 LOG(ERROR) << "GetSystemPowerStatus failed: " << GetLastError();
43 return false;
44 }
45 return (status.ACLineStatus == 0);
46 }
OLDNEW
« no previous file with comments | « app/system_monitor_unittest.cc ('k') | chrome/browser/browser_main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698