OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 129 |
130 // Converts a language code to a language display name, using the | 130 // Converts a language code to a language display name, using the |
131 // current application locale. MaybeRewriteLanguageName() is called | 131 // current application locale. MaybeRewriteLanguageName() is called |
132 // internally. | 132 // internally. |
133 // Examples: "fr" => "French" | 133 // Examples: "fr" => "French" |
134 // "en-US" => "English (United States)" | 134 // "en-US" => "English (United States)" |
135 static std::wstring GetLanguageDisplayNameFromCode( | 135 static std::wstring GetLanguageDisplayNameFromCode( |
136 const std::string& language_code); | 136 const std::string& language_code); |
137 | 137 |
138 // Sorts the given language codes by their corresponding language names, | 138 // Sorts the given language codes by their corresponding language names, |
139 // using the unicode string comparator. | 139 // using the unicode string comparator. Uses unstable sorting. |
140 static void SortLanguageCodesByNames( | 140 static void SortLanguageCodesByNames( |
141 std::vector<std::string>* language_codes); | 141 std::vector<std::string>* language_codes); |
142 | 142 |
| 143 // Sorts the given input method ids by their corresponding language names, |
| 144 // using the unicode string comparator. Uses stable sorting. |
| 145 static void SortInputMethodIdsByNames( |
| 146 const std::map<std::string, std::string>& id_to_language_code_map, |
| 147 std::vector<std::string>* input_method_ids); |
| 148 |
143 // Reorders the given input method ids for the language code. For | 149 // Reorders the given input method ids for the language code. For |
144 // example, if |language_codes| is "fr" and |input_method_ids| contains | 150 // example, if |language_codes| is "fr" and |input_method_ids| contains |
145 // ["xkb:be::fra", and "xkb:fr::fra"], the list is reordered to | 151 // ["xkb:be::fra", and "xkb:fr::fra"], the list is reordered to |
146 // ["xkb:fr::fra", and "xkb:be::fra"], so that French keyboard layout | 152 // ["xkb:fr::fra", and "xkb:be::fra"], so that French keyboard layout |
147 // comes before Belgian keyboard layout. | 153 // comes before Belgian keyboard layout. |
148 static void ReorderInputMethodIdsForLanguageCode( | 154 static void ReorderInputMethodIdsForLanguageCode( |
149 const std::string& language_code, | 155 const std::string& language_code, |
150 std::vector<std::string>* input_method_ids); | 156 std::vector<std::string>* input_method_ids); |
151 | 157 |
152 // Shows the language config dialog in a new window. | 158 // Shows the language config dialog in a new window. |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Map from language code to associated input method IDs. | 264 // Map from language code to associated input method IDs. |
259 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; | 265 typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; |
260 LanguageCodeToIdsMap language_code_to_ids_map_; | 266 LanguageCodeToIdsMap language_code_to_ids_map_; |
261 | 267 |
262 DISALLOW_COPY_AND_ASSIGN(LanguageConfigView); | 268 DISALLOW_COPY_AND_ASSIGN(LanguageConfigView); |
263 }; | 269 }; |
264 | 270 |
265 } // namespace chromeos | 271 } // namespace chromeos |
266 | 272 |
267 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ | 273 #endif // CHROME_BROWSER_CHROMEOS_OPTIONS_LANGUAGE_CONFIG_VIEW_H_ |
OLD | NEW |