Index: base/power_monitor/power_monitor_device_source.cc |
diff --git a/base/power_monitor/power_monitor_device_source.cc b/base/power_monitor/power_monitor_device_source.cc |
index d194ffa624bca9413c81acf35f5949f47c4d03cb..d7060c2a228c12f4b3f4acb70b86c486aa526db1 100644 |
--- a/base/power_monitor/power_monitor_device_source.cc |
+++ b/base/power_monitor/power_monitor_device_source.cc |
@@ -5,27 +5,22 @@ |
#include "base/power_monitor/power_monitor_device_source.h" |
#include "base/threading/thread_task_runner_handle.h" |
-#include "base/time/time.h" |
-#include "build/build_config.h" |
namespace base { |
-#if defined(ENABLE_BATTERY_MONITORING) |
-// The amount of time (in ms) to wait before running the initial |
-// battery check. |
-static int kDelayedBatteryCheckMs = 10 * 1000; |
-#endif // defined(ENABLE_BATTERY_MONITORING) |
- |
PowerMonitorDeviceSource::PowerMonitorDeviceSource() { |
DCHECK(ThreadTaskRunnerHandle::IsSet()); |
-#if defined(ENABLE_BATTERY_MONITORING) |
- delayed_battery_check_.Start(FROM_HERE, |
- base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this, |
- &PowerMonitorDeviceSource::BatteryCheck); |
-#endif // defined(ENABLE_BATTERY_MONITORING) |
+ |
#if defined(OS_MACOSX) |
PlatformInit(); |
#endif |
+ |
+#if defined(OS_WIN) || defined(OS_MACOSX) |
+ // Provide the correct battery status if possible. Others platforms, such as |
+ // Android and ChromeOS, will update their status once their backends are |
+ // actually initialized. |
+ SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl()); |
+#endif |
} |
PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { |
@@ -34,8 +29,4 @@ PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { |
#endif |
} |
-void PowerMonitorDeviceSource::BatteryCheck() { |
- ProcessPowerEvent(PowerMonitorSource::POWER_STATE_EVENT); |
-} |
- |
} // namespace base |