Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_IME_KEYBOARD_H_ | 5 #ifndef CHROMEOS_IME_IME_KEYBOARD_H_ |
| 6 #define CHROMEOS_IME_IME_KEYBOARD_H_ | 6 #define CHROMEOS_IME_IME_KEYBOARD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 kControlKey, // Customizable. | 25 kControlKey, // Customizable. |
| 26 kAltKey, // Customizable. | 26 kAltKey, // Customizable. |
| 27 kVoidKey, | 27 kVoidKey, |
| 28 kCapsLockKey, | 28 kCapsLockKey, |
| 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 const char *kISOLevel5ShiftLayoutIds[] = { | |
| 36 "ca(multix)", | |
| 37 "de(neo)", | |
| 38 }; | |
| 39 | |
| 40 const char *kAltGrLayoutIds[] = { | |
| 41 "be", | |
| 42 "be", | |
| 43 "be", | |
| 44 "bg", | |
| 45 "bg(phonetic)", | |
| 46 "br", | |
| 47 "ca", | |
| 48 "ca(eng)", | |
| 49 "ca(multix)", | |
| 50 "ch", | |
| 51 "ch(fr)", | |
| 52 "cz", | |
| 53 "de", | |
| 54 "de(neo)", | |
| 55 "dk", | |
| 56 "ee", | |
| 57 "es", | |
| 58 "es(cat)", | |
| 59 "fi", | |
| 60 "fr", | |
| 61 "gb(dvorak)", | |
| 62 "gb(extd)", | |
| 63 "gr", | |
| 64 "hr", | |
| 65 "il", | |
| 66 "it", | |
| 67 "latam", | |
| 68 "lt", | |
| 69 "no", | |
| 70 "pl", | |
| 71 "pt", | |
| 72 "ro", | |
| 73 "se", | |
| 74 "si", | |
| 75 "sk", | |
| 76 "tr", | |
| 77 "ua", | |
| 78 "us(altgr-intl)", | |
| 79 "us(intl)", | |
| 80 }; | |
|
Shu Chen
2014/10/28 07:10:44
Please move the white lists into ime_keyboard.cc f
FengYuan
2014/10/28 08:02:47
Done.
| |
| 81 | |
| 35 class InputMethodUtil; | 82 class InputMethodUtil; |
| 36 | 83 |
| 37 class CHROMEOS_EXPORT ImeKeyboard { | 84 class CHROMEOS_EXPORT ImeKeyboard { |
| 38 public: | 85 public: |
| 39 class Observer { | 86 class Observer { |
| 40 public: | 87 public: |
| 41 // Called when the caps lock state has changed. | 88 // Called when the caps lock state has changed. |
| 42 virtual void OnCapsLockChanged(bool enabled) = 0; | 89 virtual void OnCapsLockChanged(bool enabled) = 0; |
| 43 }; | 90 }; |
| 44 | 91 |
| 45 virtual ~ImeKeyboard() {} | 92 virtual ~ImeKeyboard() {} |
| 46 | 93 |
| 47 // Adds/removes observer. | 94 // Adds/removes observer. |
| 48 virtual void AddObserver(Observer* observer) = 0; | 95 virtual void AddObserver(Observer* observer) = 0; |
|
Shu Chen
2014/10/28 07:10:44
remove "= 0". Same for the rests.
FengYuan
2014/10/28 08:02:47
Done.
| |
| 49 virtual void RemoveObserver(Observer* observer) = 0; | 96 virtual void RemoveObserver(Observer* observer) = 0; |
| 50 | 97 |
| 51 // Sets the current keyboard layout to |layout_name|. This function does not | 98 // Sets the current keyboard layout to |layout_name|. This function does not |
| 52 // change the current mapping of the modifier keys. Returns true on success. | 99 // change the current mapping of the modifier keys. Returns true on success. |
| 53 virtual bool SetCurrentKeyboardLayoutByName( | 100 virtual bool SetCurrentKeyboardLayoutByName( |
| 54 const std::string& layout_name) = 0; | 101 const std::string& layout_name) = 0; |
| 55 | 102 |
| 56 // Sets the current keyboard layout again. We have to call the function every | 103 // Sets the current keyboard layout again. We have to call the function every |
| 57 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See | 104 // time when "XI_HierarchyChanged" XInput2 event is sent to Chrome. See |
| 58 // xinput_hierarchy_changed_event_listener.h for details. | 105 // xinput_hierarchy_changed_event_listener.h for details. |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 static CHROMEOS_EXPORT bool GetAutoRepeatRateForTesting( | 151 static CHROMEOS_EXPORT bool GetAutoRepeatRateForTesting( |
| 105 AutoRepeatRate* out_rate); | 152 AutoRepeatRate* out_rate); |
| 106 | 153 |
| 107 // Returns false if |layout_name| contains a bad character. | 154 // Returns false if |layout_name| contains a bad character. |
| 108 static CHROMEOS_EXPORT bool CheckLayoutNameForTesting( | 155 static CHROMEOS_EXPORT bool CheckLayoutNameForTesting( |
| 109 const std::string& layout_name); | 156 const std::string& layout_name); |
| 110 | 157 |
| 111 // Note: At this moment, classes other than InputMethodManager should not | 158 // Note: At this moment, classes other than InputMethodManager should not |
| 112 // instantiate the ImeKeyboard class. | 159 // instantiate the ImeKeyboard class. |
| 113 static ImeKeyboard* Create(); | 160 static ImeKeyboard* Create(); |
| 161 | |
| 162 bool caps_lock_is_enabled_; | |
| 163 std::string last_layout_; | |
| 164 | |
| 165 protected: | |
| 166 ObserverList<Observer> observers_; | |
| 114 }; | 167 }; |
| 115 | 168 |
| 169 | |
| 116 } // namespace input_method | 170 } // namespace input_method |
| 117 } // namespace chromeos | 171 } // namespace chromeos |
| 118 | 172 |
| 119 #endif // CHROMEOS_IME_IME_KEYBOARD_H_ | 173 #endif // CHROMEOS_IME_IME_KEYBOARD_H_ |
| OLD | NEW |