| 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_SERVICE_H_ | 5 #ifndef SERVICES_DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ |
| 6 #define DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ | 6 #define SERVICES_DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback_list.h" | 10 #include "base/callback_list.h" |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 13 #include "device/battery/battery_export.h" | 13 #include "services/device/public/interfaces/battery_status.mojom.h" |
| 14 #include "device/battery/battery_status.mojom.h" | |
| 15 | 14 |
| 16 namespace base { | 15 namespace base { |
| 17 class SingleThreadTaskRunner; | 16 class SingleThreadTaskRunner; |
| 18 } | 17 } |
| 19 | 18 |
| 20 namespace device { | 19 namespace device { |
| 21 class BatteryStatusManager; | 20 class BatteryStatusManager; |
| 22 | 21 |
| 23 class DEVICE_BATTERY_EXPORT BatteryStatusService { | 22 class BatteryStatusService { |
| 24 public: | 23 public: |
| 25 typedef base::Callback<void(const mojom::BatteryStatus&)> | 24 typedef base::Callback<void(const mojom::BatteryStatus&)> |
| 26 BatteryUpdateCallback; | 25 BatteryUpdateCallback; |
| 27 typedef base::CallbackList<void(const mojom::BatteryStatus&)> | 26 typedef base::CallbackList<void(const mojom::BatteryStatus&)> |
| 28 BatteryUpdateCallbackList; | 27 BatteryUpdateCallbackList; |
| 29 typedef BatteryUpdateCallbackList::Subscription BatteryUpdateSubscription; | 28 typedef BatteryUpdateCallbackList::Subscription BatteryUpdateSubscription; |
| 30 | 29 |
| 31 // Returns the BatteryStatusService singleton. | 30 // Returns the BatteryStatusService singleton. |
| 32 static BatteryStatusService* GetInstance(); | 31 static BatteryStatusService* GetInstance(); |
| 33 | 32 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 BatteryUpdateCallback update_callback_; | 65 BatteryUpdateCallback update_callback_; |
| 67 mojom::BatteryStatus status_; | 66 mojom::BatteryStatus status_; |
| 68 bool status_updated_; | 67 bool status_updated_; |
| 69 bool is_shutdown_; | 68 bool is_shutdown_; |
| 70 | 69 |
| 71 DISALLOW_COPY_AND_ASSIGN(BatteryStatusService); | 70 DISALLOW_COPY_AND_ASSIGN(BatteryStatusService); |
| 72 }; | 71 }; |
| 73 | 72 |
| 74 } // namespace device | 73 } // namespace device |
| 75 | 74 |
| 76 #endif // DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ | 75 #endif // SERVICES_DEVICE_BATTERY_BATTERY_STATUS_SERVICE_H_ |
| OLD | NEW |