Chromium Code Reviews| 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); |
| }; |