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

Unified Diff: chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h

Issue 8965070: Change system settings based on when mouse/touchpad is connected/disconnected. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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
Index: chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h
===================================================================
--- chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h (revision 115229)
+++ chrome/browser/chromeos/xinput_hierarchy_changed_event_listener.h (working copy)
@@ -12,6 +12,7 @@
#include "base/memory/singleton.h"
#include "base/message_loop.h"
+#include "base/observer_list.h"
typedef union _XEvent XEvent;
@@ -27,6 +28,16 @@
void Stop();
+ // Observers receive notifications when a device has been added/removed.
+ class Observer {
xiyuan 2011/12/21 03:38:24 Think the new preferred way is to have the observe
achuithb 2011/12/21 22:15:01 Done.
+ public:
+ virtual ~Observer() {}
xiyuan 2011/12/21 03:38:24 protected?
achuithb 2011/12/21 22:15:01 Done.
+ virtual void DeviceChanged() = 0;
xiyuan 2011/12/21 03:38:24 Think DeviceTreeChanged or DeviceHierarchyChanged
achuithb 2011/12/21 22:15:01 Done.
+ };
+
+ void AddObserver(Observer* observer);
+ void RemoveObserver(Observer* observer);
+
private:
// Defines the delete on exit Singleton traits we like. Best to have this
// and const/dest private as recommended for Singletons.
@@ -59,9 +70,14 @@
// Returns true if the event was processed, false otherwise.
virtual bool ProcessedXEvent(XEvent* xevent);
+ // Notify observers that a device has been added/removed.
+ void NotifyDeviceChanged();
+
bool stopped_;
int xiopcode_;
+ ObserverList<Observer> observer_list_;
+
DISALLOW_COPY_AND_ASSIGN(XInputHierarchyChangedEventListener);
};

Powered by Google App Engine
This is Rietveld 408576698