OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/power_monitor/power_monitor_device_source.h" | 5 #include "base/power_monitor/power_monitor_device_source.h" |
6 | 6 |
7 #include "base/threading/thread_task_runner_handle.h" | |
8 | |
9 namespace base { | 7 namespace base { |
10 | 8 |
11 PowerMonitorDeviceSource::PowerMonitorDeviceSource() { | 9 PowerMonitorDeviceSource::PowerMonitorDeviceSource() { |
12 DCHECK(ThreadTaskRunnerHandle::IsSet()); | |
13 | |
14 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
15 PlatformInit(); | 11 PlatformInit(); |
16 #endif | 12 #endif |
17 | 13 |
18 #if defined(OS_WIN) || defined(OS_MACOSX) | 14 #if defined(OS_WIN) || defined(OS_MACOSX) |
19 // Provide the correct battery status if possible. Others platforms, such as | 15 // Provide the correct battery status if possible. Others platforms, such as |
20 // Android and ChromeOS, will update their status once their backends are | 16 // Android and ChromeOS, will update their status once their backends are |
21 // actually initialized. | 17 // actually initialized. |
22 SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl()); | 18 SetInitialOnBatteryPowerState(IsOnBatteryPowerImpl()); |
23 #endif | 19 #endif |
24 } | 20 } |
25 | 21 |
26 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { | 22 PowerMonitorDeviceSource::~PowerMonitorDeviceSource() { |
27 #if defined(OS_MACOSX) | 23 #if defined(OS_MACOSX) |
28 PlatformDestroy(); | 24 PlatformDestroy(); |
29 #endif | 25 #endif |
30 } | 26 } |
31 | 27 |
32 } // namespace base | 28 } // namespace base |
OLD | NEW |