Chromium Code Reviews| Index: base/system_monitor/system_monitor.h |
| diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h |
| index 7684523616e0bd787e3a30f5ded9c40e1f7b5371..e5b8debae756c10b801d48b79ca6f762b6f134e8 100644 |
| --- a/base/system_monitor/system_monitor.h |
| +++ b/base/system_monitor/system_monitor.h |
| @@ -8,6 +8,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| +#include "base/file_path.h" |
|
Lei Zhang
2012/02/14 02:14:24
you can forward declare "class FilePath" and incli
vandebo (ex-Chrome)
2012/02/14 21:23:23
I tried that, but the observer code needs the full
vandebo (ex-Chrome)
2012/02/15 23:13:36
I think I was trying to declare it in the base nam
|
| #include "build/build_config.h" |
| // Windows HiRes timers drain the battery faster so we need to know the battery |
| @@ -42,6 +43,8 @@ class BASE_EXPORT SystemMonitor { |
| RESUME_EVENT // The system is being resumed. |
| }; |
| + typedef unsigned long DeviceIdType; |
| + |
| // Create SystemMonitor. Only one SystemMonitor instance per application |
| // is allowed. |
| SystemMonitor(); |
| @@ -93,8 +96,19 @@ class BASE_EXPORT SystemMonitor { |
| class BASE_EXPORT DevicesChangedObserver { |
| public: |
| // Notification that the devices connected to the system have changed. |
| + // This is only implemented on Windows currently. |
|
Lei Zhang
2012/02/14 02:14:24
Really? Is content::GamepadProvider() Windows-only
vandebo (ex-Chrome)
2012/02/14 21:23:23
The only caller of ProcessDevicesChanged is in the
|
| virtual void OnDevicesChanged() {} |
| + // When a media device is attached or detached, one of these two events |
| + // if triggered. |
| + // TODO(vandebo) Pass an appropriate device identifier or way to interact |
| + // with the devices instead of FilePath. |
| + virtual void OnMediaDeviceAttached(const DeviceIdType& id, |
| + const std::string& name, |
| + const FilePath& path) {} |
| + |
| + virtual void OnMediaDeviceDetached(const DeviceIdType& id) {} |
| + |
| protected: |
| virtual ~DevicesChangedObserver() {} |
| }; |
| @@ -123,6 +137,10 @@ class BASE_EXPORT SystemMonitor { |
| // Cross-platform handling of a device change event. |
| void ProcessDevicesChanged(); |
| + void ProcessMediaDeviceAttached(const DeviceIdType& id, |
| + const std::string& name, |
| + const FilePath& path); |
| + void ProcessMediaDeviceDetached(const DeviceIdType& id); |
| private: |
| #if defined(OS_MACOSX) |
| @@ -141,6 +159,9 @@ class BASE_EXPORT SystemMonitor { |
| // Functions to trigger notifications. |
| void NotifyDevicesChanged(); |
| + void NotifyMediaDeviceAttached(const DeviceIdType& id, |
| + const std::string& name, const FilePath& path); |
|
willchan no longer on Chromium
2012/02/14 06:43:20
Move to the next line as per chromium style guide
vandebo (ex-Chrome)
2012/02/14 21:23:23
Done.
|
| + void NotifyMediaDeviceDetached(const DeviceIdType& id); |
| void NotifyPowerStateChange(); |
| void NotifySuspend(); |
| void NotifyResume(); |