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

Side by Side Diff: ui/base/system_monitor/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 | « ui/base/system_monitor/system_monitor_unittest.cc ('k') | views/widget/widget_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) 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
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
OLDNEW
« no previous file with comments | « ui/base/system_monitor/system_monitor_unittest.cc ('k') | views/widget/widget_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698