OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/system_monitor/system_monitor.h" | 5 #include "base/system_monitor/system_monitor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 DCHECK(MessageLoop::current()); | 46 DCHECK(MessageLoop::current()); |
47 #if defined(ENABLE_BATTERY_MONITORING) | 47 #if defined(ENABLE_BATTERY_MONITORING) |
48 delayed_battery_check_.Start(FROM_HERE, | 48 delayed_battery_check_.Start(FROM_HERE, |
49 base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this, | 49 base::TimeDelta::FromMilliseconds(kDelayedBatteryCheckMs), this, |
50 &SystemMonitor::BatteryCheck); | 50 &SystemMonitor::BatteryCheck); |
51 #endif // defined(ENABLE_BATTERY_MONITORING) | 51 #endif // defined(ENABLE_BATTERY_MONITORING) |
52 #if defined(OS_MACOSX) | 52 #if defined(OS_MACOSX) |
53 PlatformInit(); | 53 PlatformInit(); |
54 #endif | 54 #endif |
| 55 #if defined(OS_ANDROID) |
| 56 is_battery_charging_ = false; |
| 57 #endif // defined(OS_ANDROID) |
55 } | 58 } |
56 | 59 |
57 SystemMonitor::~SystemMonitor() { | 60 SystemMonitor::~SystemMonitor() { |
58 #if defined(OS_MACOSX) | 61 #if defined(OS_MACOSX) |
59 PlatformDestroy(); | 62 PlatformDestroy(); |
60 #endif | 63 #endif |
61 DCHECK_EQ(this, g_system_monitor); | 64 DCHECK_EQ(this, g_system_monitor); |
62 g_system_monitor = NULL; | 65 g_system_monitor = NULL; |
63 } | 66 } |
64 | 67 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 void SystemMonitor::NotifyResume() { | 196 void SystemMonitor::NotifyResume() { |
194 DVLOG(1) << "Power Resuming"; | 197 DVLOG(1) << "Power Resuming"; |
195 power_observer_list_->Notify(&PowerObserver::OnResume); | 198 power_observer_list_->Notify(&PowerObserver::OnResume); |
196 } | 199 } |
197 | 200 |
198 void SystemMonitor::BatteryCheck() { | 201 void SystemMonitor::BatteryCheck() { |
199 ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); | 202 ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); |
200 } | 203 } |
201 | 204 |
202 } // namespace base | 205 } // namespace base |
OLD | NEW |