| 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 #ifndef DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ | 5 #ifndef DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ |
| 6 #define DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ | 6 #define DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include <memory> |
| 9 |
| 9 #include "device/battery/battery_status_service.h" | 10 #include "device/battery/battery_status_service.h" |
| 10 | 11 |
| 11 namespace device { | 12 namespace device { |
| 12 | 13 |
| 13 // Platform specific manager class for fetching battery status data. | 14 // Platform specific manager class for fetching battery status data. |
| 14 class BatteryStatusManager { | 15 class BatteryStatusManager { |
| 15 public: | 16 public: |
| 16 // Creates a BatteryStatusManager object. |callback| should be called when the | 17 // Creates a BatteryStatusManager object. |callback| should be called when the |
| 17 // battery status changes. | 18 // battery status changes. |
| 18 static scoped_ptr<BatteryStatusManager> Create( | 19 static std::unique_ptr<BatteryStatusManager> Create( |
| 19 const BatteryStatusService::BatteryUpdateCallback& callback); | 20 const BatteryStatusService::BatteryUpdateCallback& callback); |
| 20 | 21 |
| 21 virtual ~BatteryStatusManager() {} | 22 virtual ~BatteryStatusManager() {} |
| 22 | 23 |
| 23 // Start listening for battery status changes. New updates are signalled | 24 // Start listening for battery status changes. New updates are signalled |
| 24 // by invoking the callback provided at construction time. | 25 // by invoking the callback provided at construction time. |
| 25 // Note that this is called in the IO thread. | 26 // Note that this is called in the IO thread. |
| 26 virtual bool StartListeningBatteryChange() = 0; | 27 virtual bool StartListeningBatteryChange() = 0; |
| 27 | 28 |
| 28 // Stop listening for battery status changes. | 29 // Stop listening for battery status changes. |
| 29 // Note that this is called in the IO thread. | 30 // Note that this is called in the IO thread. |
| 30 virtual void StopListeningBatteryChange() = 0; | 31 virtual void StopListeningBatteryChange() = 0; |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 } // namespace device | 34 } // namespace device |
| 34 | 35 |
| 35 #endif // DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ | 36 #endif // DEVICE_BATTERY_BATTERY_STATUS_MANAGER_H_ |
| OLD | NEW |