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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 // Converts an input method ID to a display name of the IME. Returns | 50 // Converts an input method ID to a display name of the IME. Returns |
51 // an empty strng when |input_method_id| is unknown. | 51 // an empty strng when |input_method_id| is unknown. |
52 // Examples: "pinyin" => "Pinyin" | 52 // Examples: "pinyin" => "Pinyin" |
53 std::string GetInputMethodDisplayNameFromId( | 53 std::string GetInputMethodDisplayNameFromId( |
54 const std::string& input_method_id) const; | 54 const std::string& input_method_id) const; |
55 | 55 |
56 base::string16 GetInputMethodShortName( | 56 base::string16 GetInputMethodShortName( |
57 const InputMethodDescriptor& input_method) const; | 57 const InputMethodDescriptor& input_method) const; |
58 base::string16 GetInputMethodMediumName( | 58 base::string16 GetInputMethodMediumName( |
59 const InputMethodDescriptor& input_method) const; | 59 const InputMethodDescriptor& input_method) const; |
| 60 base::string16 GetInputMethodLongNameStripped( |
| 61 const InputMethodDescriptor& input_method) const; |
60 base::string16 GetInputMethodLongName( | 62 base::string16 GetInputMethodLongName( |
61 const InputMethodDescriptor& input_method) const; | 63 const InputMethodDescriptor& input_method) const; |
62 | 64 |
63 // Converts an input method ID to an input method descriptor. Returns NULL | 65 // Converts an input method ID to an input method descriptor. Returns NULL |
64 // when |input_method_id| is unknown. | 66 // when |input_method_id| is unknown. |
65 // Example: "pinyin" => { id: "pinyin", display_name: "Pinyin", | 67 // Example: "pinyin" => { id: "pinyin", display_name: "Pinyin", |
66 // keyboard_layout: "us", language_code: "zh" } | 68 // keyboard_layout: "us", language_code: "zh" } |
67 const InputMethodDescriptor* GetInputMethodDescriptorFromId( | 69 const InputMethodDescriptor* GetInputMethodDescriptorFromId( |
68 const std::string& input_method_id) const; | 70 const std::string& input_method_id) const; |
69 | 71 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // "xkb:us::eng" => "us" | 172 // "xkb:us::eng" => "us" |
171 // "xkb:us:dvorak:eng" => "us(dvorak)" | 173 // "xkb:us:dvorak:eng" => "us(dvorak)" |
172 // "xkb:gb::eng" => "gb" | 174 // "xkb:gb::eng" => "gb" |
173 // "pinyin" => "us" (because Pinyin uses US keyboard layout) | 175 // "pinyin" => "us" (because Pinyin uses US keyboard layout) |
174 std::string GetKeyboardLayoutName(const std::string& input_method_id) const; | 176 std::string GetKeyboardLayoutName(const std::string& input_method_id) const; |
175 | 177 |
176 private: | 178 private: |
177 bool TranslateStringInternal(const std::string& english_string, | 179 bool TranslateStringInternal(const std::string& english_string, |
178 base::string16 *out_string) const; | 180 base::string16 *out_string) const; |
179 | 181 |
| 182 // Get long name of the given input method. |strip| is to specify whether to |
| 183 // strip the 'keyboard' from the long name, as some UI (e.g. OOBE) doesn't |
| 184 // want it. |
| 185 base::string16 GetInputMethodLongNameInternal( |
| 186 const InputMethodDescriptor& input_method, bool strip) const; |
| 187 |
180 // Map from language code to associated input method IDs, etc. | 188 // Map from language code to associated input method IDs, etc. |
181 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; | 189 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; |
182 | 190 |
183 LanguageCodeToIdsMap language_code_to_ids_; | 191 LanguageCodeToIdsMap language_code_to_ids_; |
184 InputMethodIdToDescriptorMap id_to_descriptor_; | 192 InputMethodIdToDescriptorMap id_to_descriptor_; |
185 std::map<std::string, std::string> xkb_layout_to_indicator_; | 193 std::map<std::string, std::string> xkb_layout_to_indicator_; |
186 | 194 |
187 typedef base::hash_map<std::string, int> HashType; | 195 typedef base::hash_map<std::string, int> HashType; |
188 HashType english_to_resource_id_; | 196 HashType english_to_resource_id_; |
189 | 197 |
190 InputMethodDelegate* delegate_; | 198 InputMethodDelegate* delegate_; |
191 | 199 |
192 base::ThreadChecker thread_checker_; | 200 base::ThreadChecker thread_checker_; |
193 std::vector<std::string> hardware_layouts_; | 201 std::vector<std::string> hardware_layouts_; |
194 std::vector<std::string> hardware_login_layouts_; | 202 std::vector<std::string> hardware_login_layouts_; |
195 std::vector<std::string> cached_hardware_layouts_; | 203 std::vector<std::string> cached_hardware_layouts_; |
196 | 204 |
197 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); | 205 DISALLOW_COPY_AND_ASSIGN(InputMethodUtil); |
198 }; | 206 }; |
199 | 207 |
200 } // namespace input_method | 208 } // namespace input_method |
201 } // namespace chromeos | 209 } // namespace chromeos |
202 | 210 |
203 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ | 211 #endif // CHROME_BROWSER_CHROMEOS_INPUT_METHOD_INPUT_METHOD_UTIL_H_ |
OLD | NEW |