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 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 5 #ifndef BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 6 #define BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/base_export.h" | 12 #include "base/base_export.h" |
13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
14 #include "base/tuple.h" | 14 #include "base/tuple.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 | 16 |
17 // Windows HiRes timers drain the battery faster so we need to know the battery | 17 // Windows HiRes timers drain the battery faster so we need to know the battery |
18 // status. This isn't true for other platforms. | 18 // status. This isn't true for other platforms. |
19 #if defined(OS_WIN) | 19 #if defined(OS_WIN) |
20 #define ENABLE_BATTERY_MONITORING 1 | 20 #define ENABLE_BATTERY_MONITORING 1 |
21 #else | 21 #else |
22 #undef ENABLE_BATTERY_MONITORING | 22 #undef ENABLE_BATTERY_MONITORING |
23 #endif // !OS_WIN | 23 #endif // !OS_WIN |
24 | 24 |
25 #include "base/observer_list_threadsafe.h" | 25 #include "base/observer_list_threadsafe.h" |
26 #if defined(ENABLE_BATTERY_MONITORING) | 26 #if defined(ENABLE_BATTERY_MONITORING) |
27 #include "base/timer.h" | 27 #include "base/timer.h" |
28 #endif // defined(ENABLE_BATTERY_MONITORING) | 28 #endif // defined(ENABLE_BATTERY_MONITORING) |
29 | 29 |
30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) && !defined(OS_IOS) |
31 #include <IOKit/pwr_mgt/IOPMLib.h> | 31 #include <IOKit/pwr_mgt/IOPMLib.h> |
32 #include <IOKit/IOMessage.h> | 32 #include <IOKit/IOMessage.h> |
33 #endif // OS_MACOSX | 33 #endif // OS_MACOSX && !OS_IOS |
34 | |
35 #if defined(OS_IOS) | |
36 #include <objc/runtime.h> // For id. | |
Mark Mentovai
2012/07/10 17:06:05
This comment isn’t useful. We #include headers all
rohitrao (ping after 24h)
2012/07/10 17:17:42
Done.
| |
37 #endif // OS_IOS | |
34 | 38 |
35 class FilePath; | 39 class FilePath; |
36 | 40 |
37 namespace base { | 41 namespace base { |
38 | 42 |
39 // Class for monitoring various system-related subsystems | 43 // Class for monitoring various system-related subsystems |
40 // such as power management, network status, etc. | 44 // such as power management, network status, etc. |
41 // TODO(mbelshe): Add support beyond just power management. | 45 // TODO(mbelshe): Add support beyond just power management. |
42 class BASE_EXPORT SystemMonitor { | 46 class BASE_EXPORT SystemMonitor { |
43 public: | 47 public: |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
182 scoped_refptr<ObserverListThreadSafe<PowerObserver> > power_observer_list_; | 186 scoped_refptr<ObserverListThreadSafe<PowerObserver> > power_observer_list_; |
183 scoped_refptr<ObserverListThreadSafe<DevicesChangedObserver> > | 187 scoped_refptr<ObserverListThreadSafe<DevicesChangedObserver> > |
184 devices_changed_observer_list_; | 188 devices_changed_observer_list_; |
185 bool battery_in_use_; | 189 bool battery_in_use_; |
186 bool suspended_; | 190 bool suspended_; |
187 | 191 |
188 #if defined(ENABLE_BATTERY_MONITORING) | 192 #if defined(ENABLE_BATTERY_MONITORING) |
189 base::OneShotTimer<SystemMonitor> delayed_battery_check_; | 193 base::OneShotTimer<SystemMonitor> delayed_battery_check_; |
190 #endif | 194 #endif |
191 | 195 |
196 #if defined(OS_IOS) | |
197 // Holds pointers to system event notification observers. | |
198 std::vector<id> notification_observers_; | |
199 #endif | |
200 | |
192 MediaDeviceMap media_device_map_; | 201 MediaDeviceMap media_device_map_; |
193 | 202 |
194 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); | 203 DISALLOW_COPY_AND_ASSIGN(SystemMonitor); |
195 }; | 204 }; |
196 | 205 |
197 } // namespace base | 206 } // namespace base |
198 | 207 |
199 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ | 208 #endif // BASE_SYSTEM_MONITOR_SYSTEM_MONITOR_H_ |
OLD | NEW |