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_status_manager.h" | 5 #include "device/battery/battery_status_manager.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
| 8 #include <IOKit/ps/IOPSKeys.h> |
8 #include <IOKit/ps/IOPowerSources.h> | 9 #include <IOKit/ps/IOPowerSources.h> |
9 #include <IOKit/ps/IOPSKeys.h> | 10 |
| 11 #include <memory> |
10 #include <vector> | 12 #include <vector> |
11 | 13 |
12 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
13 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
14 #include "base/macros.h" | 16 #include "base/macros.h" |
15 #include "base/memory/scoped_ptr.h" | |
16 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 | 19 |
19 namespace device { | 20 namespace device { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback; | 24 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback; |
24 | 25 |
25 // Returns the value corresponding to |key| in the dictionary |description|. | 26 // Returns the value corresponding to |key| in the dictionary |description|. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 bool StartListeningBatteryChange() override { | 221 bool StartListeningBatteryChange() override { |
221 notifier_->Start(); | 222 notifier_->Start(); |
222 return true; | 223 return true; |
223 } | 224 } |
224 | 225 |
225 void StopListeningBatteryChange() override { | 226 void StopListeningBatteryChange() override { |
226 notifier_->Stop(); | 227 notifier_->Stop(); |
227 } | 228 } |
228 | 229 |
229 private: | 230 private: |
230 scoped_ptr<BatteryStatusObserver> notifier_; | 231 std::unique_ptr<BatteryStatusObserver> notifier_; |
231 | 232 |
232 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac); | 233 DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac); |
233 }; | 234 }; |
234 | 235 |
235 } // end namespace | 236 } // end namespace |
236 | 237 |
237 // static | 238 // static |
238 scoped_ptr<BatteryStatusManager> BatteryStatusManager::Create( | 239 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create( |
239 const BatteryStatusService::BatteryUpdateCallback& callback) { | 240 const BatteryStatusService::BatteryUpdateCallback& callback) { |
240 return scoped_ptr<BatteryStatusManager>( | 241 return std::unique_ptr<BatteryStatusManager>( |
241 new BatteryStatusManagerMac(callback)); | 242 new BatteryStatusManagerMac(callback)); |
242 } | 243 } |
243 | 244 |
244 } // namespace device | 245 } // namespace device |
OLD | NEW |