| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/power_monitor/power_monitor.h" | 5 #include "base/power_monitor/power_monitor.h" |
| 6 #include "base/power_monitor/power_monitor_source.h" | 6 #include "base/power_monitor/power_monitor_source.h" |
| 7 | 7 |
| 8 namespace base { | 8 namespace base { |
| 9 | 9 |
| 10 static PowerMonitor* g_power_monitor = NULL; | 10 static PowerMonitor* g_power_monitor = NULL; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return source_.get(); | 38 return source_.get(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 bool PowerMonitor::IsOnBatteryPower() { | 41 bool PowerMonitor::IsOnBatteryPower() { |
| 42 return source_->IsOnBatteryPower(); | 42 return source_->IsOnBatteryPower(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void PowerMonitor::NotifyPowerStateChange(bool battery_in_use) { | 45 void PowerMonitor::NotifyPowerStateChange(bool battery_in_use) { |
| 46 DVLOG(1) << "PowerStateChange: " << (battery_in_use ? "On" : "Off") | 46 DVLOG(1) << "PowerStateChange: " << (battery_in_use ? "On" : "Off") |
| 47 << " battery"; | 47 << " battery"; |
| 48 observers_->Notify(&PowerObserver::OnPowerStateChange, battery_in_use); | 48 observers_->Notify(FROM_HERE, &PowerObserver::OnPowerStateChange, |
| 49 battery_in_use); |
| 49 } | 50 } |
| 50 | 51 |
| 51 void PowerMonitor::NotifySuspend() { | 52 void PowerMonitor::NotifySuspend() { |
| 52 DVLOG(1) << "Power Suspending"; | 53 DVLOG(1) << "Power Suspending"; |
| 53 observers_->Notify(&PowerObserver::OnSuspend); | 54 observers_->Notify(FROM_HERE, &PowerObserver::OnSuspend); |
| 54 } | 55 } |
| 55 | 56 |
| 56 void PowerMonitor::NotifyResume() { | 57 void PowerMonitor::NotifyResume() { |
| 57 DVLOG(1) << "Power Resuming"; | 58 DVLOG(1) << "Power Resuming"; |
| 58 observers_->Notify(&PowerObserver::OnResume); | 59 observers_->Notify(FROM_HERE, &PowerObserver::OnResume); |
| 59 } | 60 } |
| 60 | 61 |
| 61 } // namespace base | 62 } // namespace base |
| OLD | NEW |