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" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 | 16 |
17 static SystemMonitor* g_system_monitor = NULL; | 17 static SystemMonitor* g_system_monitor = NULL; |
18 | 18 |
19 #if defined(ENABLE_BATTERY_MONITORING) | 19 #if defined(ENABLE_BATTERY_MONITORING) |
20 // The amount of time (in ms) to wait before running the initial | 20 // The amount of time (in ms) to wait before running the initial |
21 // battery check. | 21 // battery check. |
22 static int kDelayedBatteryCheckMs = 10 * 1000; | 22 static int kDelayedBatteryCheckMs = 10 * 1000; |
23 #endif // defined(ENABLE_BATTERY_MONITORING) | 23 #endif // defined(ENABLE_BATTERY_MONITORING) |
24 | 24 |
| 25 SystemMonitor::MediaDeviceInfo::MediaDeviceInfo( |
| 26 const std::string& id, |
| 27 const string16& device_name, |
| 28 MediaDeviceType device_type, |
| 29 const FilePath::StringType& device_location) |
| 30 : unique_id(id), |
| 31 name(device_name), |
| 32 type(device_type), |
| 33 location(device_location) { |
| 34 } |
| 35 |
25 SystemMonitor::SystemMonitor() | 36 SystemMonitor::SystemMonitor() |
26 : power_observer_list_(new ObserverListThreadSafe<PowerObserver>()), | 37 : power_observer_list_(new ObserverListThreadSafe<PowerObserver>()), |
27 devices_changed_observer_list_( | 38 devices_changed_observer_list_( |
28 new ObserverListThreadSafe<DevicesChangedObserver>()), | 39 new ObserverListThreadSafe<DevicesChangedObserver>()), |
29 battery_in_use_(false), | 40 battery_in_use_(false), |
30 suspended_(false) { | 41 suspended_(false) { |
31 DCHECK(!g_system_monitor); | 42 DCHECK(!g_system_monitor); |
32 g_system_monitor = this; | 43 g_system_monitor = this; |
33 | 44 |
34 DCHECK(MessageLoop::current()); | 45 DCHECK(MessageLoop::current()); |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 void SystemMonitor::NotifyResume() { | 186 void SystemMonitor::NotifyResume() { |
176 DVLOG(1) << "Power Resuming"; | 187 DVLOG(1) << "Power Resuming"; |
177 power_observer_list_->Notify(&PowerObserver::OnResume); | 188 power_observer_list_->Notify(&PowerObserver::OnResume); |
178 } | 189 } |
179 | 190 |
180 void SystemMonitor::BatteryCheck() { | 191 void SystemMonitor::BatteryCheck() { |
181 ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); | 192 ProcessPowerMessage(SystemMonitor::POWER_STATE_EVENT); |
182 } | 193 } |
183 | 194 |
184 } // namespace base | 195 } // namespace base |
OLD | NEW |