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

Side by Side Diff: base/power_monitor/power_monitor_device_source_chromeos.cc

Issue 622693004: Make base::PowerMonitor work on Chrome OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
(Empty)
1 // Copyright 2014 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 "base/power_monitor/power_monitor.h"
6 #include "base/power_monitor/power_monitor_device_source.h"
7 #include "base/power_monitor/power_monitor_source.h"
8
9 namespace base {
10
11 namespace {
12
13 // The most-recently-seen power source.
14 bool g_on_battery = false;
15
16 } // namespace
17
18 // static
19 void PowerMonitorDeviceSource::SetPowerSource(bool on_battery) {
20 if (on_battery != g_on_battery) {
21 g_on_battery = on_battery;
22 ProcessPowerEvent(POWER_STATE_EVENT);
23 }
24 }
25
26 // static
27 void PowerMonitorDeviceSource::HandleSystemSuspending() {
28 ProcessPowerEvent(SUSPEND_EVENT);
29 }
30
31 // static
32 void PowerMonitorDeviceSource::HandleSystemResumed() {
33 ProcessPowerEvent(RESUME_EVENT);
34 }
35
36 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {
37 return g_on_battery;
38 }
39
40 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698