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/IOPSKeys.h> |
9 #include <IOKit/ps/IOPowerSources.h> | 9 #include <IOKit/ps/IOPowerSources.h> |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/mac/foundation_util.h" | 14 #include "base/mac/foundation_util.h" |
15 #include "base/mac/scoped_cftyperef.h" | 15 #include "base/mac/scoped_cftyperef.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/metrics/histogram.h" | 17 #include "base/metrics/histogram_macros.h" |
18 #include "base/time/time.h" | 18 #include "base/time/time.h" |
19 | 19 |
20 namespace device { | 20 namespace device { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback; | 24 typedef BatteryStatusService::BatteryUpdateCallback BatteryCallback; |
25 | 25 |
26 // Returns the value corresponding to |key| in the dictionary |description|. | 26 // Returns the value corresponding to |key| in the dictionary |description|. |
27 // Returns |default_value| if the dictionary does not contain |key|, the | 27 // Returns |default_value| if the dictionary does not contain |key|, the |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } // end namespace | 236 } // end namespace |
237 | 237 |
238 // static | 238 // static |
239 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create( | 239 std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create( |
240 const BatteryStatusService::BatteryUpdateCallback& callback) { | 240 const BatteryStatusService::BatteryUpdateCallback& callback) { |
241 return std::unique_ptr<BatteryStatusManager>( | 241 return std::unique_ptr<BatteryStatusManager>( |
242 new BatteryStatusManagerMac(callback)); | 242 new BatteryStatusManagerMac(callback)); |
243 } | 243 } |
244 | 244 |
245 } // namespace device | 245 } // namespace device |
OLD | NEW |