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 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 5 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 std::wstring GetLanguageDisplayNameFromCode(const std::string& language_code) { | 492 std::wstring GetLanguageDisplayNameFromCode(const std::string& language_code) { |
493 if (!g_browser_process) { | 493 if (!g_browser_process) { |
494 return L""; | 494 return L""; |
495 } | 495 } |
496 return MaybeRewriteLanguageName(UTF16ToWide( | 496 return MaybeRewriteLanguageName(UTF16ToWide( |
497 l10n_util::GetDisplayNameForLocale( | 497 l10n_util::GetDisplayNameForLocale( |
498 language_code, g_browser_process->GetApplicationLocale(), | 498 language_code, g_browser_process->GetApplicationLocale(), |
499 true))); | 499 true))); |
500 } | 500 } |
501 | 501 |
| 502 std::wstring GetLanguageNativeDisplayNameFromCode( |
| 503 const std::string& language_code) { |
| 504 return MaybeRewriteLanguageName(UTF16ToWide( |
| 505 l10n_util::GetDisplayNameForLocale( |
| 506 language_code, language_code, true))); |
| 507 } |
| 508 |
502 void SortLanguageCodesByNames(std::vector<std::string>* language_codes) { | 509 void SortLanguageCodesByNames(std::vector<std::string>* language_codes) { |
503 if (!g_browser_process) { | 510 if (!g_browser_process) { |
504 return; | 511 return; |
505 } | 512 } |
506 // We should build collator outside of the comparator. We cannot have | 513 // We should build collator outside of the comparator. We cannot have |
507 // scoped_ptr<> in the comparator for a subtle STL reason. | 514 // scoped_ptr<> in the comparator for a subtle STL reason. |
508 UErrorCode error = U_ZERO_ERROR; | 515 UErrorCode error = U_ZERO_ERROR; |
509 icu::Locale locale(g_browser_process->GetApplicationLocale().c_str()); | 516 icu::Locale locale(g_browser_process->GetApplicationLocale().c_str()); |
510 scoped_ptr<icu::Collator> collator( | 517 scoped_ptr<icu::Collator> collator( |
511 icu::Collator::createInstance(locale, error)); | 518 icu::Collator::createInstance(locale, error)); |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 value.string_list_value = input_method_ids; | 618 value.string_list_value = input_method_ids; |
612 InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary(); | 619 InputMethodLibrary* library = CrosLibrary::Get()->GetInputMethodLibrary(); |
613 library->SetImeConfig(kGeneralSectionName, kPreloadEnginesConfigName, value); | 620 library->SetImeConfig(kGeneralSectionName, kPreloadEnginesConfigName, value); |
614 if (!initial_input_method_id.empty()) { | 621 if (!initial_input_method_id.empty()) { |
615 library->ChangeInputMethod(initial_input_method_id); | 622 library->ChangeInputMethod(initial_input_method_id); |
616 } | 623 } |
617 } | 624 } |
618 | 625 |
619 } // namespace input_method | 626 } // namespace input_method |
620 } // namespace chromeos | 627 } // namespace chromeos |
OLD | NEW |