| 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 "modules/battery/BatteryDispatcher.h" | 5 #include "modules/battery/BatteryDispatcher.h" |
| 6 | 6 |
| 7 #include "platform/mojo/MojoHelper.h" | 7 #include "platform/mojo/MojoHelper.h" |
| 8 #include "public/platform/Platform.h" | 8 #include "public/platform/Platform.h" |
| 9 #include "public/platform/ServiceRegistry.h" | 9 #include "public/platform/ServiceRegistry.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 : m_hasLatestData(false) | 22 : m_hasLatestData(false) |
| 23 { | 23 { |
| 24 } | 24 } |
| 25 | 25 |
| 26 void BatteryDispatcher::queryNextStatus() | 26 void BatteryDispatcher::queryNextStatus() |
| 27 { | 27 { |
| 28 m_monitor->QueryNextStatus( | 28 m_monitor->QueryNextStatus( |
| 29 sameThreadBindForMojo(&BatteryDispatcher::onDidChange, this)); | 29 sameThreadBindForMojo(&BatteryDispatcher::onDidChange, this)); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void BatteryDispatcher::onDidChange(device::BatteryStatusPtr batteryStatus) | 32 void BatteryDispatcher::onDidChange(device::blink::BatteryStatusPtr batteryStatu
s) |
| 33 { | 33 { |
| 34 queryNextStatus(); | 34 queryNextStatus(); |
| 35 | 35 |
| 36 ASSERT(batteryStatus); | 36 ASSERT(batteryStatus); |
| 37 | 37 |
| 38 updateBatteryStatus(BatteryStatus( | 38 updateBatteryStatus(BatteryStatus( |
| 39 batteryStatus->charging, | 39 batteryStatus->charging, |
| 40 batteryStatus->charging_time, | 40 batteryStatus->charging_time, |
| 41 batteryStatus->discharging_time, | 41 batteryStatus->discharging_time, |
| 42 batteryStatus->level)); | 42 batteryStatus->level)); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 57 queryNextStatus(); | 57 queryNextStatus(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 void BatteryDispatcher::stopListening() | 60 void BatteryDispatcher::stopListening() |
| 61 { | 61 { |
| 62 m_monitor.reset(); | 62 m_monitor.reset(); |
| 63 m_hasLatestData = false; | 63 m_hasLatestData = false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 } // namespace blink | 66 } // namespace blink |
| OLD | NEW |