| Index: services/device/battery/battery_status_manager_mac.cc
|
| diff --git a/device/battery/battery_status_manager_mac.cc b/services/device/battery/battery_status_manager_mac.cc
|
| similarity index 88%
|
| rename from device/battery/battery_status_manager_mac.cc
|
| rename to services/device/battery/battery_status_manager_mac.cc
|
| index 00d088057e9b74b5748f5158c480e9e038bbf20a..e2eb88906639f0f8ab5259e0ea89f6fa8b9108c3 100644
|
| --- a/device/battery/battery_status_manager_mac.cc
|
| +++ b/services/device/battery/battery_status_manager_mac.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "device/battery/battery_status_manager.h"
|
| +#include "services/device/battery/battery_status_manager.h"
|
|
|
| #include <CoreFoundation/CoreFoundation.h>
|
| #include <IOKit/ps/IOPSKeys.h>
|
| @@ -55,15 +55,14 @@ bool CFStringsAreEqual(CFStringRef string1, CFStringRef string2) {
|
| }
|
|
|
| void UpdateNumberBatteriesHistogram(int count) {
|
| - UMA_HISTOGRAM_CUSTOM_COUNTS(
|
| - "BatteryStatus.NumberBatteriesMac", count, 1, 5, 6);
|
| + UMA_HISTOGRAM_CUSTOM_COUNTS("BatteryStatus.NumberBatteriesMac", count, 1, 5,
|
| + 6);
|
| }
|
|
|
| void FetchBatteryStatus(CFDictionaryRef description,
|
| mojom::BatteryStatus* status) {
|
| - CFStringRef current_state =
|
| - base::mac::GetValueFromDictionary<CFStringRef>(description,
|
| - CFSTR(kIOPSPowerSourceStateKey));
|
| + CFStringRef current_state = base::mac::GetValueFromDictionary<CFStringRef>(
|
| + description, CFSTR(kIOPSPowerSourceStateKey));
|
|
|
| bool on_battery_power =
|
| CFStringsAreEqual(current_state, CFSTR(kIOPSBatteryPowerValue));
|
| @@ -92,9 +91,10 @@ void FetchBatteryStatus(CFDictionaryRef description,
|
|
|
| // Battery is charging: set the charging time if it's available, otherwise
|
| // set to +infinity.
|
| - status->charging_time = charging_time != -1
|
| - ? base::TimeDelta::FromMinutes(charging_time).InSeconds()
|
| - : std::numeric_limits<double>::infinity();
|
| + status->charging_time =
|
| + charging_time != -1
|
| + ? base::TimeDelta::FromMinutes(charging_time).InSeconds()
|
| + : std::numeric_limits<double>::infinity();
|
| } else {
|
| // Battery is not charging.
|
| // Set chargingTime to +infinity if the battery is not charged. Otherwise
|
| @@ -124,15 +124,14 @@ std::vector<mojom::BatteryStatus> GetInternalBatteriesStates() {
|
| CFIndex count = CFArrayGetCount(power_sources_list);
|
|
|
| for (CFIndex i = 0; i < count; ++i) {
|
| - CFDictionaryRef description = IOPSGetPowerSourceDescription(info,
|
| - CFArrayGetValueAtIndex(power_sources_list, i));
|
| + CFDictionaryRef description = IOPSGetPowerSourceDescription(
|
| + info, CFArrayGetValueAtIndex(power_sources_list, i));
|
|
|
| if (!description)
|
| continue;
|
|
|
| - CFStringRef transport_type =
|
| - base::mac::GetValueFromDictionary<CFStringRef>(description,
|
| - CFSTR(kIOPSTransportTypeKey));
|
| + CFStringRef transport_type = base::mac::GetValueFromDictionary<CFStringRef>(
|
| + description, CFSTR(kIOPSTransportTypeKey));
|
|
|
| bool internal_source =
|
| CFStringsAreEqual(transport_type, CFSTR(kIOPSInternalType));
|
| @@ -175,9 +174,8 @@ class BatteryStatusObserver {
|
| if (notifier_run_loop_source_)
|
| return;
|
|
|
| - notifier_run_loop_source_.reset(
|
| - IOPSNotificationCreateRunLoopSource(CallOnBatteryStatusChanged,
|
| - static_cast<void*>(&callback_)));
|
| + notifier_run_loop_source_.reset(IOPSNotificationCreateRunLoopSource(
|
| + CallOnBatteryStatusChanged, static_cast<void*>(&callback_)));
|
| if (!notifier_run_loop_source_) {
|
| LOG(ERROR) << "Failed to create battery status notification run loop";
|
| // Make sure to execute to callback with the default values.
|
| @@ -224,9 +222,7 @@ class BatteryStatusManagerMac : public BatteryStatusManager {
|
| return true;
|
| }
|
|
|
| - void StopListeningBatteryChange() override {
|
| - notifier_->Stop();
|
| - }
|
| + void StopListeningBatteryChange() override { notifier_->Stop(); }
|
|
|
| private:
|
| std::unique_ptr<BatteryStatusObserver> notifier_;
|
| @@ -234,7 +230,7 @@ class BatteryStatusManagerMac : public BatteryStatusManager {
|
| DISALLOW_COPY_AND_ASSIGN(BatteryStatusManagerMac);
|
| };
|
|
|
| -} // end namespace
|
| +} // end namespace
|
|
|
| // static
|
| std::unique_ptr<BatteryStatusManager> BatteryStatusManager::Create(
|
|
|