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_INPUT_METHOD_INPUT_METHOD_UTIL_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ |
6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ | 6 #define CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ |
7 | 7 |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 // Returns true if the given input method id is supported. | 134 // Returns true if the given input method id is supported. |
135 bool IsValidInputMethodId(const std::string& input_method_id) const; | 135 bool IsValidInputMethodId(const std::string& input_method_id) const; |
136 | 136 |
137 // Returns true if the given input method id is for a keyboard layout. | 137 // Returns true if the given input method id is for a keyboard layout. |
138 static bool IsKeyboardLayout(const std::string& input_method_id); | 138 static bool IsKeyboardLayout(const std::string& input_method_id); |
139 | 139 |
140 // Sets the list of component extension IMEs. | 140 // Sets the list of component extension IMEs. |
141 void SetComponentExtensions(const InputMethodDescriptors& imes); | 141 void SetComponentExtensions(const InputMethodDescriptors& imes); |
142 | 142 |
| 143 // Initializes the extension based xkb IMEs for testing. |
| 144 void InitXkbInputMethodsForTesting(); |
| 145 |
143 // Returns the fallback input method descriptor (the very basic US | 146 // Returns the fallback input method descriptor (the very basic US |
144 // keyboard). This function is mostly used for testing, but may be used | 147 // keyboard). This function is mostly used for testing, but may be used |
145 // as the fallback, when there is no other choice. | 148 // as the fallback, when there is no other choice. |
146 static InputMethodDescriptor GetFallbackInputMethodDescriptor(); | 149 static InputMethodDescriptor GetFallbackInputMethodDescriptor(); |
147 | 150 |
148 protected: | 151 protected: |
149 // protected: for unit testing as well. | 152 // protected: for unit testing as well. |
150 bool GetInputMethodIdsFromLanguageCodeInternal( | 153 bool GetInputMethodIdsFromLanguageCodeInternal( |
151 const std::multimap<std::string, std::string>& language_code_to_ids, | 154 const std::multimap<std::string, std::string>& language_code_to_ids, |
152 const std::string& normalized_language_code, | 155 const std::string& normalized_language_code, |
(...skipping 30 matching lines...) Expand all Loading... |
183 std::string, InputMethodDescriptor> InputMethodIdToDescriptorMap; | 186 std::string, InputMethodDescriptor> InputMethodIdToDescriptorMap; |
184 // Map from XKB layout ID to associated input method descriptor. | 187 // Map from XKB layout ID to associated input method descriptor. |
185 typedef std::map<std::string, InputMethodDescriptor> XkbIdToDescriptorMap; | 188 typedef std::map<std::string, InputMethodDescriptor> XkbIdToDescriptorMap; |
186 // Map from component extention IME id to associated input method descriptor. | 189 // Map from component extention IME id to associated input method descriptor. |
187 typedef std::map<std::string, InputMethodDescriptor> ComponentExtIMEMap; | 190 typedef std::map<std::string, InputMethodDescriptor> ComponentExtIMEMap; |
188 | 191 |
189 LanguageCodeToIdsMap language_code_to_ids_; | 192 LanguageCodeToIdsMap language_code_to_ids_; |
190 std::map<std::string, std::string> id_to_language_code_; | 193 std::map<std::string, std::string> id_to_language_code_; |
191 InputMethodIdToDescriptorMap id_to_descriptor_; | 194 InputMethodIdToDescriptorMap id_to_descriptor_; |
192 XkbIdToDescriptorMap xkb_id_to_descriptor_; | 195 XkbIdToDescriptorMap xkb_id_to_descriptor_; |
193 ComponentExtIMEMap component_extension_ime_id_to_descriptor_; | 196 std::map<std::string, std::string> xkb_layout_to_indicator_; |
194 | 197 |
195 typedef base::hash_map<std::string, int> HashType; | 198 typedef base::hash_map<std::string, int> HashType; |
196 HashType english_to_resource_id_; | 199 HashType english_to_resource_id_; |
197 | 200 |
198 InputMethodDelegate* delegate_; | 201 InputMethodDelegate* delegate_; |
199 | 202 |
200 base::ThreadChecker thread_checker_; | 203 base::ThreadChecker thread_checker_; |
201 std::vector<std::string> hardware_layouts_; | 204 std::vector<std::string> hardware_layouts_; |
202 std::vector<std::string> hardware_login_layouts_; | 205 std::vector<std::string> hardware_login_layouts_; |
203 | 206 |
204 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); | 207 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); |
205 }; | 208 }; |
206 | 209 |
207 } // namespace input_method | 210 } // namespace input_method |
208 } // namespace chromeos | 211 } // namespace chromeos |
209 | 212 |
210 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ | 213 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ |
OLD | NEW |