| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "device/battery/battery_monitor_impl.h" | 5 #include "device/battery/battery_monitor_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) { | 48 void BatteryMonitorImpl::DidChange(const BatteryStatus& battery_status) { |
| 49 status_ = battery_status; | 49 status_ = battery_status; |
| 50 status_to_report_ = true; | 50 status_to_report_ = true; |
| 51 | 51 |
| 52 if (!callback_.is_null()) | 52 if (!callback_.is_null()) |
| 53 ReportStatus(); | 53 ReportStatus(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 void BatteryMonitorImpl::ReportStatus() { | 56 void BatteryMonitorImpl::ReportStatus() { |
| 57 callback_.Run(status_.Clone()); | 57 callback_.Run(status_.Clone()); |
| 58 callback_.reset(); | 58 callback_.Reset(); |
| 59 | 59 |
| 60 status_to_report_ = false; | 60 status_to_report_ = false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace device | 63 } // namespace device |
| OLD | NEW |