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 CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ |
7 | 7 |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
11 #include "chrome/browser/chromeos/device_hierarchy_observer.h" | 11 #include "chrome/browser/chromeos/device_hierarchy_observer.h" |
12 | 12 |
13 typedef union _XEvent XEvent; | 13 typedef union _XEvent XEvent; |
14 | 14 |
15 namespace chromeos { | 15 namespace chromeos { |
16 | 16 |
17 // XInputHierarchyChangedEventListener listens for an XI_HierarchyChanged event, | 17 // XInputHierarchyChangedEventListener listens for an XI_HierarchyChanged event, |
18 // which is sent to Chrome when X detects a system or USB keyboard (or mouse), | 18 // which is sent to Chrome when X detects a system or USB keyboard (or mouse), |
19 // then tells X to change the current XKB keyboard layout. Start by just calling | 19 // then tells X to change the current XKB keyboard layout. Start by just calling |
20 // instance() to get it going. | 20 // instance() to get it going. |
21 class XInputHierarchyChangedEventListener : public MessageLoopForUI::Observer { | 21 class XInputHierarchyChangedEventListener |
| 22 : public base::MessageLoopForUI::Observer { |
22 public: | 23 public: |
23 static XInputHierarchyChangedEventListener* GetInstance(); | 24 static XInputHierarchyChangedEventListener* GetInstance(); |
24 | 25 |
25 void Stop(); | 26 void Stop(); |
26 | 27 |
27 void AddObserver(DeviceHierarchyObserver* observer); | 28 void AddObserver(DeviceHierarchyObserver* observer); |
28 void RemoveObserver(DeviceHierarchyObserver* observer); | 29 void RemoveObserver(DeviceHierarchyObserver* observer); |
29 | 30 |
30 private: | 31 private: |
31 // Defines the delete on exit Singleton traits we like. Best to have this | 32 // Defines the delete on exit Singleton traits we like. Best to have this |
(...skipping 21 matching lines...) Expand all Loading... |
53 int xiopcode_; | 54 int xiopcode_; |
54 | 55 |
55 ObserverList<DeviceHierarchyObserver> observer_list_; | 56 ObserverList<DeviceHierarchyObserver> observer_list_; |
56 | 57 |
57 DISALLOW_COPY_AND_ASSIGN(XInputHierarchyChangedEventListener); | 58 DISALLOW_COPY_AND_ASSIGN(XInputHierarchyChangedEventListener); |
58 }; | 59 }; |
59 | 60 |
60 } // namespace chromeos | 61 } // namespace chromeos |
61 | 62 |
62 #endif // CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ | 63 #endif // CHROME_BROWSER_CHROMEOS_XINPUT_HIERARCHY_CHANGED_EVENT_LISTENER_H_ |
OLD | NEW |