| 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 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" | 5 #include "chrome/browser/ui/webui/options/chromeos/cros_language_options_handler
.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Build the list of display names, and build the language map. | 178 // Build the list of display names, and build the language map. |
| 179 for (std::set<std::string>::const_iterator iter = language_codes.begin(); | 179 for (std::set<std::string>::const_iterator iter = language_codes.begin(); |
| 180 iter != language_codes.end(); ++iter) { | 180 iter != language_codes.end(); ++iter) { |
| 181 // Exclude the language which is not in |base_langauge_codes| even it has | 181 // Exclude the language which is not in |base_langauge_codes| even it has |
| 182 // input methods. | 182 // input methods. |
| 183 if (std::find(base_language_codes.begin(), | 183 if (std::find(base_language_codes.begin(), |
| 184 base_language_codes.end(), | 184 base_language_codes.end(), |
| 185 *iter) == base_language_codes.end()) { | 185 *iter) == base_language_codes.end()) { |
| 186 continue; | 186 continue; |
| 187 } | 187 } |
| 188 input_method::InputMethodUtil* input_method_util = | |
| 189 input_method::GetInputMethodManager()->GetInputMethodUtil(); | |
| 190 const string16 display_name = | 188 const string16 display_name = |
| 191 input_method_util->GetLanguageDisplayNameFromCode(*iter); | 189 l10n_util::GetDisplayNameForLocale(*iter, app_locale, true); |
| 192 const string16 native_display_name = | 190 const string16 native_display_name = |
| 193 input_method::InputMethodUtil::GetLanguageNativeDisplayNameFromCode( | 191 l10n_util::GetDisplayNameForLocale(*iter, *iter, true); |
| 194 *iter); | 192 |
| 195 display_names.push_back(display_name); | 193 display_names.push_back(display_name); |
| 196 language_map[display_name] = | 194 language_map[display_name] = |
| 197 std::make_pair(*iter, native_display_name); | 195 std::make_pair(*iter, native_display_name); |
| 198 } | 196 } |
| 199 DCHECK_EQ(display_names.size(), language_map.size()); | 197 DCHECK_EQ(display_names.size(), language_map.size()); |
| 200 | 198 |
| 201 // Build the list of display names, and build the language map. | 199 // Build the list of display names, and build the language map. |
| 202 for (size_t i = 0; i < base_language_codes.size(); ++i) { | 200 for (size_t i = 0; i < base_language_codes.size(); ++i) { |
| 203 // Skip this language if it was already added. | 201 // Skip this language if it was already added. |
| 204 if (language_codes.find(base_language_codes[i]) != language_codes.end()) | 202 if (language_codes.find(base_language_codes[i]) != language_codes.end()) |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( | 335 void CrosLanguageOptionsHandler::InputMethodOptionsOpenCallback( |
| 338 const ListValue* args) { | 336 const ListValue* args) { |
| 339 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); | 337 const std::string input_method_id = UTF16ToASCII(ExtractStringValue(args)); |
| 340 const std::string action = base::StringPrintf( | 338 const std::string action = base::StringPrintf( |
| 341 "InputMethodOptions_Open_%s", input_method_id.c_str()); | 339 "InputMethodOptions_Open_%s", input_method_id.c_str()); |
| 342 content::RecordComputedAction(action); | 340 content::RecordComputedAction(action); |
| 343 } | 341 } |
| 344 | 342 |
| 345 } // namespace options | 343 } // namespace options |
| 346 } // namespace chromeos | 344 } // namespace chromeos |
| OLD | NEW |