OLD | NEW |
(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 |
OLD | NEW |