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.
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"
13 // The most-recently-seen power source.
14 bool g_on_battery
= false;
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
);
27 void PowerMonitorDeviceSource::HandleSystemSuspending() {
28 ProcessPowerEvent(SUSPEND_EVENT
);
32 void PowerMonitorDeviceSource::HandleSystemResumed() {
33 ProcessPowerEvent(RESUME_EVENT
);
36 bool PowerMonitorDeviceSource::IsOnBatteryPowerImpl() {