Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2185)

Unified Diff: base/system_monitor/system_monitor.h

Issue 8523021: Send WM_DEVICECHANGE message through SystemMonitor (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/system_monitor/system_monitor.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/system_monitor/system_monitor.h
diff --git a/base/system_monitor/system_monitor.h b/base/system_monitor/system_monitor.h
index c7799945fa53be685f26a999061f5847647cf4f0..7684523616e0bd787e3a30f5ded9c40e1f7b5371 100644
--- a/base/system_monitor/system_monitor.h
+++ b/base/system_monitor/system_monitor.h
@@ -90,15 +90,26 @@ class BASE_EXPORT SystemMonitor {
virtual ~PowerObserver() {}
};
+ class BASE_EXPORT DevicesChangedObserver {
+ public:
+ // Notification that the devices connected to the system have changed.
+ virtual void OnDevicesChanged() {}
+
+ protected:
+ virtual ~DevicesChangedObserver() {}
+ };
+
// Add a new observer.
// Can be called from any thread.
// Must not be called from within a notification callback.
- void AddObserver(PowerObserver* obs);
+ void AddPowerObserver(PowerObserver* obs);
+ void AddDevicesChangedObserver(DevicesChangedObserver* obs);
// Remove an existing observer.
// Can be called from any thread.
// Must not be called from within a notification callback.
- void RemoveObserver(PowerObserver* obs);
+ void RemovePowerObserver(PowerObserver* obs);
+ void RemoveDevicesChangedObserver(DevicesChangedObserver* obs);
#if defined(OS_WIN)
// Windows-specific handling of a WM_POWERBROADCAST message.
@@ -110,6 +121,9 @@ class BASE_EXPORT SystemMonitor {
// Cross-platform handling of a power event.
void ProcessPowerMessage(PowerEvent event_id);
+ // Cross-platform handling of a device change event.
+ void ProcessDevicesChanged();
+
private:
#if defined(OS_MACOSX)
void PlatformInit();
@@ -126,11 +140,14 @@ class BASE_EXPORT SystemMonitor {
void BatteryCheck();
// Functions to trigger notifications.
+ void NotifyDevicesChanged();
void NotifyPowerStateChange();
void NotifySuspend();
void NotifyResume();
- scoped_refptr<ObserverListThreadSafe<PowerObserver> > observer_list_;
+ scoped_refptr<ObserverListThreadSafe<PowerObserver> > power_observer_list_;
+ scoped_refptr<ObserverListThreadSafe<DevicesChangedObserver> >
+ devices_changed_observer_list_;
bool battery_in_use_;
bool suspended_;
« no previous file with comments | « no previous file | base/system_monitor/system_monitor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698