OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CHROMEOS_IME_XKEYBOARD_H_ | 5 #ifndef CHROMEOS_IME_XKEYBOARD_H_ |
6 #define CHROMEOS_IME_XKEYBOARD_H_ | 6 #define CHROMEOS_IME_XKEYBOARD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 kEscapeKey, | 29 kEscapeKey, |
30 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you | 30 // IMPORTANT: You should update kCustomizableKeys[] in .cc file, if you |
31 // add a customizable key. | 31 // add a customizable key. |
32 kNumModifierKeys, | 32 kNumModifierKeys, |
33 }; | 33 }; |
34 | 34 |
35 class InputMethodUtil; | 35 class InputMethodUtil; |
36 | 36 |
37 class CHROMEOS_EXPORT XKeyboard { | 37 class CHROMEOS_EXPORT XKeyboard { |
38 public: | 38 public: |
| 39 class Observer { |
| 40 public: |
| 41 // Called when the caps lock state has changed. |
| 42 virtual void OnCapsLockChanged(bool enabled) = 0; |
| 43 }; |
| 44 |
39 virtual ~XKeyboard() {} | 45 virtual ~XKeyboard() {} |
40 | 46 |
| 47 // Adds/removes observer. |
| 48 virtual void AddObserver(Observer* observer) = 0; |
| 49 virtual void RemoveObserver(Observer* observer) = 0; |
| 50 |
41 // Sets the current keyboard layout to |layout_name|. This function does not | 51 // Sets the current keyboard layout to |layout_name|. This function does not |
42 // change the current mapping of the modifier keys. Returns true on success. | 52 // change the current mapping of the modifier keys. Returns true on success. |
43 virtual bool SetCurrentKeyboardLayoutByName( | 53 virtual bool SetCurrentKeyboardLayoutByName( |
44 const std::string& layout_name) = 0; | 54 const std::string& layout_name) = 0; |
45 | 55 |
46 // Sets the current keyboard layout again. We have to call the function every | 56 // Sets the current keyboard layout again. We have to call the function every |
47 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See | 57 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See |
48 // xinput_hierarchy_changed_event_listener.h for details. | 58 // xinput_hierarchy_changed_event_listener.h for details. |
49 virtual bool ReapplyCurrentKeyboardLayout() = 0; | 59 virtual bool ReapplyCurrentKeyboardLayout() = 0; |
50 | 60 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 110 |
101 // Note: At this moment, classes other than InputMethodManager should not | 111 // Note: At this moment, classes other than InputMethodManager should not |
102 // instantiate the XKeyboard class. | 112 // instantiate the XKeyboard class. |
103 static XKeyboard* Create(); | 113 static XKeyboard* Create(); |
104 }; | 114 }; |
105 | 115 |
106 } // namespace input_method | 116 } // namespace input_method |
107 } // namespace chromeos | 117 } // namespace chromeos |
108 | 118 |
109 #endif // CHROMEOS_IME_XKEYBOARD_H_ | 119 #endif // CHROMEOS_IME_XKEYBOARD_H_ |
OLD | NEW |