diff options
author | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 10:12:21 +0000 |
---|---|---|
committer | yusukes@google.com <yusukes@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-18 10:12:21 +0000 |
commit | 1e8e765e76578341934e7285afa6b4e12b4f8c6e (patch) | |
tree | 9d6f8f21cf5a5b75938b40a6431343ae74672330 /chrome/browser/chromeos/options | |
parent | e713a43daff36ba4317c7585a1a6ea056f49cb8c (diff) | |
download | chromium_src-1e8e765e76578341934e7285afa6b4e12b4f8c6e.zip chromium_src-1e8e765e76578341934e7285afa6b4e12b4f8c6e.tar.gz chromium_src-1e8e765e76578341934e7285afa6b4e12b4f8c6e.tar.bz2 |
Added input_method_util.h.
- Moved all functions in language_menu_l10n_util.h to the new file.
- Moved static methods in language_library.h and language_config_model.h to the file.
BUG=none
TEST=try bot passed
Review URL: http://codereview.chromium.org/2810008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/options')
4 files changed, 27 insertions, 364 deletions
diff --git a/chrome/browser/chromeos/options/language_config_model.cc b/chrome/browser/chromeos/options/language_config_model.cc index 6d9076f..b10ca2b 100644 --- a/chrome/browser/chromeos/options/language_config_model.cc +++ b/chrome/browser/chromeos/options/language_config_model.cc @@ -8,13 +8,12 @@ #include <functional> #include <utility> -#include "app/l10n_util_collator.h" +#include "app/l10n_util.h" #include "base/utf_string_conversions.h" -#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/cros/cros_library.h" #include "chrome/browser/chromeos/cros/language_library.h" +#include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/preferences.h" -#include "chrome/browser/chromeos/status/language_menu_l10n_util.h" #include "chrome/common/notification_type.h" #include "chrome/common/pref_names.h" @@ -26,34 +25,6 @@ namespace { // defined in app/l10_util.cc. const char kDefaultLanguageCode[] = "en-US"; -// The list of language that do not have associated input methods. For -// these languages, we associate input methods here. -const struct ExtraLanguage { - const char* language_code; - const char* input_method_id; -} kExtraLanguages[] = { - { "id", "xkb:us::eng" }, // For Indonesian, use US keyboard layout. - // The code "fil" comes from app/l10_util.cc. - { "fil", "xkb:us::eng" }, // For Filipino, use US keyboard layout. - // The code "es-419" comes from app/l10_util.cc. - // For Spanish in Latin America, use Spanish keyboard layout. - { "es-419", "xkb:es::spa" }, -}; - -// The list defines pairs of language code and the default input method -// id. The list is used for reordering input method ids. -// -// TODO(satorux): We may need to handle secondary, and ternary input -// methods, rather than handling the default input method only. -const struct LanguageDefaultInputMethodId { - const char* language_code; - const char* input_method_id; -} kLanguageDefaultInputMethodIds[] = { - { "en-US", "xkb:us::eng", }, // US - English - { "fr", "xkb:fr::fra", }, // France - French - { "de", "xkb:de::ger", }, // Germany - German -}; - } // namespace AddLanguageComboboxModel::AddLanguageComboboxModel( @@ -73,7 +44,7 @@ std::wstring AddLanguageComboboxModel::GetItemAt(int index) { return l10n_util::GetString( IDS_OPTIONS_SETTINGS_LANGUAGES_ADD_LANGUAGE_COMBOBOX); } - return LanguageConfigModel::MaybeRewriteLanguageName( + return input_method::MaybeRewriteLanguageName( GetLanguageNameAt(GetLanguageIndex(index))); } @@ -127,12 +98,11 @@ void LanguageConfigModel::Init() { size_t LanguageConfigModel::CountNumActiveInputMethods( const std::string& language_code) { int num_selected_active_input_methods = 0; - std::pair<LanguageCodeToIdsMap::const_iterator, - LanguageCodeToIdsMap::const_iterator> range = - language_code_to_ids_map_.equal_range(language_code); - for (LanguageCodeToIdsMap::const_iterator iter = range.first; - iter != range.second; ++iter) { - if (InputMethodIsActivated(iter->second)) { + std::vector<std::string> input_method_ids; + input_method::GetInputMethodIdsByLanguageCode( + language_code, false /* keyboard_layout_only */, &input_method_ids); + for (size_t i = 0; i < input_method_ids.size(); ++i) { + if (InputMethodIsActivated(input_method_ids[i])) { ++num_selected_active_input_methods; } } @@ -153,7 +123,7 @@ size_t LanguageConfigModel::AddLanguageCode( // acceptable as the language list is about 40 item long at most. In // theory, we could find the position to insert rather than sorting, but // it would be complex as we need to use unicode string comparator. - SortLanguageCodesByNames(&preferred_language_codes_); + input_method::SortLanguageCodesByNames(&preferred_language_codes_); // Find the language code just added in the sorted language codes. const int added_at = std::distance(preferred_language_codes_.begin(), @@ -173,7 +143,8 @@ void LanguageConfigModel::UpdateInputMethodPreferences( // Note: Since |new_input_method_ids| is alphabetically sorted and the sort // function below uses stable sort, the relateve order of input methods that // belong to the same language (e.g. "mozc" and "xkb:jp::jpn") is maintained. - SortInputMethodIdsByNames(id_to_language_code_map_, &new_input_method_ids); + input_method::SortInputMethodIdsByNames( + id_to_language_code_map_, &new_input_method_ids); preload_engines_.SetValue(UTF8ToWide(JoinString(new_input_method_ids, ','))); } @@ -256,16 +227,12 @@ void LanguageConfigModel::GetInputMethodIdsFromLanguageCode( std::vector<std::string>* input_method_ids) const { DCHECK(input_method_ids); input_method_ids->clear(); + input_method::GetInputMethodIdsByLanguageCode( + language_code, false /* keyboard_layout_only */, input_method_ids); - std::pair<LanguageCodeToIdsMap::const_iterator, - LanguageCodeToIdsMap::const_iterator> range = - language_code_to_ids_map_.equal_range(language_code); - for (LanguageCodeToIdsMap::const_iterator iter = range.first; - iter != range.second; ++iter) { - input_method_ids->push_back(iter->second); - } // Reorder the input methods. - ReorderInputMethodIdsForLanguageCode(language_code, input_method_ids); + input_method::ReorderInputMethodIdsForLanguageCode( + language_code, input_method_ids); } void LanguageConfigModel::NotifyPrefChanged() { @@ -282,7 +249,7 @@ void LanguageConfigModel::NotifyPrefChanged() { preferred_language_codes_.clear(); preferred_language_codes_.assign( language_code_set.begin(), language_code_set.end()); - LanguageConfigModel::SortLanguageCodesByNames(&preferred_language_codes_); + input_method::SortLanguageCodesByNames(&preferred_language_codes_); } void LanguageConfigModel::Observe(NotificationType type, @@ -293,129 +260,6 @@ void LanguageConfigModel::Observe(NotificationType type, } } -std::wstring LanguageConfigModel::MaybeRewriteLanguageName( - const std::wstring& language_name) { - // "t" is used as the language code for input methods that don't fall - // under any other languages. - if (language_name == L"t") { - return l10n_util::GetString( - IDS_OPTIONS_SETTINGS_LANGUAGES_OTHERS); - } - return language_name; -} - -std::wstring LanguageConfigModel::GetLanguageDisplayNameFromCode( - const std::string& language_code) { - return MaybeRewriteLanguageName(UTF16ToWide( - l10n_util::GetDisplayNameForLocale( - language_code, g_browser_process->GetApplicationLocale(), - true))); -} - -namespace { - -// The comparator is used for sorting language codes by their -// corresponding language names, using the ICU collator. -struct CompareLanguageCodesByLanguageName - : std::binary_function<const std::string&, const std::string&, bool> { - explicit CompareLanguageCodesByLanguageName(icu::Collator* collator) - : collator_(collator) { - } - - // Calling GetLanguageDisplayNameFromCode() in the comparator is not - // efficient, but acceptable as the function is cheap, and the language - // list is short (about 40 at most). - bool operator()(const std::string& s1, const std::string& s2) const { - const std::wstring key1 = - LanguageConfigModel::GetLanguageDisplayNameFromCode(s1); - const std::wstring key2 = - LanguageConfigModel::GetLanguageDisplayNameFromCode(s2); - return l10n_util::StringComparator<std::wstring>(collator_)(key1, key2); - } - - icu::Collator* collator_; -}; - -// The comparator is used for sorting input method ids by their -// corresponding language names, using the ICU collator. -struct CompareInputMethodIdsByLanguageName - : std::binary_function<const std::string&, const std::string&, bool> { - CompareInputMethodIdsByLanguageName( - icu::Collator* collator, - const std::map<std::string, std::string>& id_to_language_code_map) - : comparator_(collator), - id_to_language_code_map_(id_to_language_code_map) { - } - - bool operator()(const std::string& s1, const std::string& s2) const { - std::string language_code_1; - std::map<std::string, std::string>::const_iterator iter = - id_to_language_code_map_.find(s1); - if (iter != id_to_language_code_map_.end()) { - language_code_1 = iter->second; - } - std::string language_code_2; - iter = id_to_language_code_map_.find(s2); - if (iter != id_to_language_code_map_.end()) { - language_code_2 = iter->second; - } - return comparator_(language_code_1, language_code_2); - } - - const CompareLanguageCodesByLanguageName comparator_; - const std::map<std::string, std::string>& id_to_language_code_map_; -}; - -} // namespace - -void LanguageConfigModel::SortLanguageCodesByNames( - std::vector<std::string>* language_codes) { - // We should build collator outside of the comparator. We cannot have - // scoped_ptr<> in the comparator for a subtle STL reason. - UErrorCode error = U_ZERO_ERROR; - icu::Locale locale(g_browser_process->GetApplicationLocale().c_str()); - scoped_ptr<icu::Collator> collator( - icu::Collator::createInstance(locale, error)); - if (U_FAILURE(error)) { - collator.reset(); - } - std::sort(language_codes->begin(), language_codes->end(), - CompareLanguageCodesByLanguageName(collator.get())); -} - -void LanguageConfigModel::SortInputMethodIdsByNames( - const std::map<std::string, std::string>& id_to_language_code_map, - std::vector<std::string>* input_method_ids) { - UErrorCode error = U_ZERO_ERROR; - icu::Locale locale(g_browser_process->GetApplicationLocale().c_str()); - scoped_ptr<icu::Collator> collator( - icu::Collator::createInstance(locale, error)); - if (U_FAILURE(error)) { - collator.reset(); - } - std::stable_sort(input_method_ids->begin(), input_method_ids->end(), - CompareInputMethodIdsByLanguageName( - collator.get(), id_to_language_code_map)); -} - -void LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - const std::string& language_code, - std::vector<std::string>* input_method_ids) { - for (size_t i = 0; i < arraysize(kLanguageDefaultInputMethodIds); ++i) { - if (language_code == kLanguageDefaultInputMethodIds[i].language_code) { - std::vector<std::string>::iterator iter = - std::find(input_method_ids->begin(), input_method_ids->end(), - kLanguageDefaultInputMethodIds[i].input_method_id); - // If it's not on the top of |input_method_id|, swap it with the top one. - if (iter != input_method_ids->end() && - iter != input_method_ids->begin()) { - std::swap(*input_method_ids->begin(), *iter); - } - break; // Don't have to check other language codes. - } - } -} - void LanguageConfigModel::InitInputMethodIdMapsAndVectors() { // The two sets are used to build lists without duplication. std::set<std::string> supported_language_code_set; @@ -429,7 +273,7 @@ void LanguageConfigModel::InitInputMethodIdMapsAndVectors() { for (size_t i = 0; i < supported_input_methods->size(); ++i) { const InputMethodDescriptor& input_method = supported_input_methods->at(i); const std::string language_code = - InputMethodLibrary::GetLanguageCodeFromDescriptor(input_method); + input_method::GetLanguageCodeFromDescriptor(input_method); AddInputMethodToMaps(language_code, input_method); // Add the language code and the input method id to the sets. supported_language_code_set.insert(language_code); @@ -440,9 +284,10 @@ void LanguageConfigModel::InitInputMethodIdMapsAndVectors() { } // Go through the languages listed in kExtraLanguages. - for (size_t i = 0; i < arraysize(kExtraLanguages); ++i) { - const char* language_code = kExtraLanguages[i].language_code; - const char* input_method_id = kExtraLanguages[i].input_method_id; + for (size_t i = 0; i < arraysize(input_method::kExtraLanguages); ++i) { + const char* language_code = input_method::kExtraLanguages[i].language_code; + const char* input_method_id = + input_method::kExtraLanguages[i].input_method_id; std::map<std::string, const InputMethodDescriptor*>::const_iterator iter = id_to_descriptor_map.find(input_method_id); // If the associated input method descriptor is found, add the @@ -469,10 +314,8 @@ void LanguageConfigModel::AddInputMethodToMaps( id_to_language_code_map_.insert( std::make_pair(input_method.id, language_code)); id_to_display_name_map_.insert( - std::make_pair(input_method.id, LanguageMenuL10nUtil::GetStringUTF8( - input_method.display_name))); - language_code_to_ids_map_.insert( - std::make_pair(language_code, input_method.id)); + std::make_pair(input_method.id, + input_method::GetStringUTF8(input_method.display_name))); } } // namespace chromeos diff --git a/chrome/browser/chromeos/options/language_config_model.h b/chrome/browser/chromeos/options/language_config_model.h index a0440d4..cb01b65 100644 --- a/chrome/browser/chromeos/options/language_config_model.h +++ b/chrome/browser/chromeos/options/language_config_model.h @@ -132,41 +132,6 @@ class LanguageConfigModel : public NotificationObserver { return supported_language_codes_; } - // Rewrites the language name and returns the modified version if - // necessary. Otherwise, returns the given language name as is. - // In particular, this rewrites the special language name used for input - // methods that don't fall under any other languages. - static std::wstring MaybeRewriteLanguageName( - const std::wstring& language_name); - - // Converts a language code to a language display name, using the - // current application locale. MaybeRewriteLanguageName() is called - // internally. - // Examples: "fr" => "French" - // "en-US" => "English (United States)" - static std::wstring GetLanguageDisplayNameFromCode( - const std::string& language_code); - - // Sorts the given language codes by their corresponding language names, - // using the unicode string comparator. Uses unstable sorting. - static void SortLanguageCodesByNames( - std::vector<std::string>* language_codes); - - // Sorts the given input method ids by their corresponding language names, - // using the unicode string comparator. Uses stable sorting. - static void SortInputMethodIdsByNames( - const std::map<std::string, std::string>& id_to_language_code_map, - std::vector<std::string>* input_method_ids); - - // Reorders the given input method ids for the language code. For - // example, if |language_codes| is "fr" and |input_method_ids| contains - // ["xkb:be::fra", and "xkb:fr::fra"], the list is reordered to - // ["xkb:fr::fra", and "xkb:be::fra"], so that French keyboard layout - // comes before Belgian keyboard layout. - static void ReorderInputMethodIdsForLanguageCode( - const std::string& language_code, - std::vector<std::string>* input_method_ids); - private: // Initializes id_to_{code,display_name}_map_ maps, // as well as supported_{language_codes,input_method_ids}_ vectors. @@ -186,9 +151,6 @@ class LanguageConfigModel : public NotificationObserver { std::vector<std::string> supported_language_codes_; // List of supported IME IDs like "pinyin" and "m17n:ar:kbd". std::vector<std::string> supported_input_method_ids_; - // Map from language code to associated input method IDs. - typedef std::multimap<std::string, std::string> LanguageCodeToIdsMap; - LanguageCodeToIdsMap language_code_to_ids_map_; DISALLOW_COPY_AND_ASSIGN(LanguageConfigModel); }; diff --git a/chrome/browser/chromeos/options/language_config_model_unittest.cc b/chrome/browser/chromeos/options/language_config_model_unittest.cc index 758488d..e9b593d 100644 --- a/chrome/browser/chromeos/options/language_config_model_unittest.cc +++ b/chrome/browser/chromeos/options/language_config_model_unittest.cc @@ -15,148 +15,6 @@ namespace chromeos { -TEST(LanguageConfigModelTest, MaybeRewriteLanguageName) { - EXPECT_EQ(L"English", - LanguageConfigModel::MaybeRewriteLanguageName(L"English")); - EXPECT_EQ(l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_OTHERS), - LanguageConfigModel::MaybeRewriteLanguageName(L"t")); -} - -TEST(LanguageConfigModelTest, GetLanguageDisplayNameFromCode) { - EXPECT_EQ(L"French", - LanguageConfigModel::GetLanguageDisplayNameFromCode("fr")); - // MaybeRewriteLanguageName() should be applied. - EXPECT_EQ(l10n_util::GetString(IDS_OPTIONS_SETTINGS_LANGUAGES_OTHERS), - LanguageConfigModel::GetLanguageDisplayNameFromCode("t")); -} - -TEST(LanguageConfigModelTest, SortLanguageCodesByNames) { - std::vector<std::string> language_codes; - // Check if this function can handle an empty list. - LanguageConfigModel::SortLanguageCodesByNames(&language_codes); - - language_codes.push_back("ja"); - language_codes.push_back("fr"); - language_codes.push_back("t"); - LanguageConfigModel::SortLanguageCodesByNames(&language_codes); - ASSERT_EQ(3, static_cast<int>(language_codes.size())); - ASSERT_EQ("fr", language_codes[0]); // French - ASSERT_EQ("ja", language_codes[1]); // Japanese - ASSERT_EQ("t", language_codes[2]); // Others - - // Add a duplicate entry and see if it works. - language_codes.push_back("ja"); - LanguageConfigModel::SortLanguageCodesByNames(&language_codes); - ASSERT_EQ(4, static_cast<int>(language_codes.size())); - ASSERT_EQ("fr", language_codes[0]); // French - ASSERT_EQ("ja", language_codes[1]); // Japanese - ASSERT_EQ("ja", language_codes[2]); // Japanese - ASSERT_EQ("t", language_codes[3]); // Others -} - -TEST(LanguageConfigModelTest, SortInputMethodIdsByNames) { - std::map<std::string, std::string> id_to_language_code_map; - id_to_language_code_map.insert(std::make_pair("mozc", "ja")); - id_to_language_code_map.insert(std::make_pair("mozc-jp", "ja")); - id_to_language_code_map.insert(std::make_pair("xkb:jp::jpn", "ja")); - id_to_language_code_map.insert(std::make_pair("xkb:fr::fra", "fr")); - id_to_language_code_map.insert(std::make_pair("m17n:latn-pre", "t")); - - std::vector<std::string> input_method_ids; - // Check if this function can handle an empty list. - LanguageConfigModel::SortInputMethodIdsByNames(id_to_language_code_map, - &input_method_ids); - - input_method_ids.push_back("mozc"); // Japanese - input_method_ids.push_back("xkb:fr::fra"); // French - input_method_ids.push_back("m17n:latn-pre"); // Others - LanguageConfigModel::SortInputMethodIdsByNames(id_to_language_code_map, - &input_method_ids); - ASSERT_EQ(3, static_cast<int>(input_method_ids.size())); - ASSERT_EQ("xkb:fr::fra", input_method_ids[0]); // French - ASSERT_EQ("mozc", input_method_ids[1]); // Japanese - ASSERT_EQ("m17n:latn-pre", input_method_ids[2]); // Others - - // Add a duplicate entry and see if it works. - // Note that SortInputMethodIdsByNames uses std::stable_sort. - input_method_ids.push_back("xkb:jp::jpn"); // also Japanese - LanguageConfigModel::SortInputMethodIdsByNames(id_to_language_code_map, - &input_method_ids); - ASSERT_EQ(4, static_cast<int>(input_method_ids.size())); - ASSERT_EQ("xkb:fr::fra", input_method_ids[0]); // French - ASSERT_EQ("mozc", input_method_ids[1]); // Japanese - ASSERT_EQ("xkb:jp::jpn", input_method_ids[2]); // Japanese - ASSERT_EQ("m17n:latn-pre", input_method_ids[3]); // Others - - input_method_ids.push_back("mozc-jp"); // also Japanese - LanguageConfigModel::SortInputMethodIdsByNames(id_to_language_code_map, - &input_method_ids); - ASSERT_EQ(5, static_cast<int>(input_method_ids.size())); - ASSERT_EQ("xkb:fr::fra", input_method_ids[0]); // French - ASSERT_EQ("mozc", input_method_ids[1]); // Japanese - ASSERT_EQ("xkb:jp::jpn", input_method_ids[2]); // Japanese - ASSERT_EQ("mozc-jp", input_method_ids[3]); // Japanese - ASSERT_EQ("m17n:latn-pre", input_method_ids[4]); // Others -} - -TEST(LanguageConfigModelTest, ReorderInputMethodIdsForLanguageCode_DE) { - std::vector<std::string> input_method_ids; - input_method_ids.push_back("xkb:ch::ger"); // Switzerland - German - input_method_ids.push_back("xkb:de::ger"); // Germany - German - LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - "de", &input_method_ids); - // The list should be reordered. - ASSERT_EQ(2, static_cast<int>(input_method_ids.size())); - EXPECT_EQ("xkb:de::ger", input_method_ids[0]); - EXPECT_EQ("xkb:ch::ger", input_method_ids[1]); -} - -TEST(LanguageConfigModelTest, ReorderInputMethodIdsForLanguageCode_FR) { - std::vector<std::string> input_method_ids; - input_method_ids.push_back("xkb:be::fra"); // Belgium - French - input_method_ids.push_back("xkb:fr::fra"); // France - French - LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - "fr", &input_method_ids); - // The list should be reordered. - ASSERT_EQ(2, static_cast<int>(input_method_ids.size())); - EXPECT_EQ("xkb:fr::fra", input_method_ids[0]); - EXPECT_EQ("xkb:be::fra", input_method_ids[1]); -} - -TEST(LanguageConfigModelTest, ReorderInputMethodIdsForLanguageCode_EN_US) { - std::vector<std::string> input_method_ids; - input_method_ids.push_back("xkb:us:dvorak:eng"); // US - Dvorak - English - input_method_ids.push_back("xkb:us::eng"); // US - English - LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - "en-US", &input_method_ids); - // The list should be reordered. - ASSERT_EQ(2, static_cast<int>(input_method_ids.size())); - EXPECT_EQ("xkb:us::eng", input_method_ids[0]); - EXPECT_EQ("xkb:us:dvorak:eng", input_method_ids[1]); -} - -TEST(LanguageConfigModelTest, ReorderInputMethodIdsForLanguageCode_FI) { - std::vector<std::string> input_method_ids; - input_method_ids.push_back("xkb:fi::fin"); // Finland - Finnish - LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - "fi", &input_method_ids); - // There is no rule for reordering for Finnish. - ASSERT_EQ(1, static_cast<int>(input_method_ids.size())); - EXPECT_EQ("xkb:fi::fin", input_method_ids[0]); -} - -TEST(LanguageConfigModelTest, ReorderInputMethodIdsForLanguageCode_Noop) { - std::vector<std::string> input_method_ids; - input_method_ids.push_back("xkb:fr::fra"); // France - French - input_method_ids.push_back("xkb:be::fra"); // Belgium - French - // If the list is already sorted, nothing should happen. - LanguageConfigModel::ReorderInputMethodIdsForLanguageCode( - "fr", &input_method_ids); - ASSERT_EQ(2, static_cast<int>(input_method_ids.size())); - EXPECT_EQ("xkb:fr::fra", input_method_ids[0]); - EXPECT_EQ("xkb:be::fra", input_method_ids[1]); -} - TEST(AddLanguageComboboxModelTest, AddLanguageComboboxModel) { std::vector<std::string> language_codes; language_codes.push_back("de"); diff --git a/chrome/browser/chromeos/options/language_config_view.cc b/chrome/browser/chromeos/options/language_config_view.cc index fddf73a..e4cb32c 100644 --- a/chrome/browser/chromeos/options/language_config_view.cc +++ b/chrome/browser/chromeos/options/language_config_view.cc @@ -9,6 +9,7 @@ #include "app/l10n_util.h" #include "base/utf_string_conversions.h" #include "chrome/browser/browser_process.h" +#include "chrome/browser/chromeos/input_method/input_method_util.h" #include "chrome/browser/chromeos/options/language_chewing_config_view.h" #include "chrome/browser/chromeos/options/language_hangul_config_view.h" #include "chrome/browser/chromeos/options/language_mozc_config_view.h" @@ -238,8 +239,8 @@ void LanguageConfigView::OnSelectionChanged() { std::wstring LanguageConfigView::GetText(int row, int column_id) { if (row >= 0 && row < static_cast<int>( model.num_preferred_language_codes())) { - return LanguageConfigModel:: - GetLanguageDisplayNameFromCode(model.preferred_language_code_at(row)); + return input_method::GetLanguageDisplayNameFromCode( + model.preferred_language_code_at(row)); } NOTREACHED(); return L""; @@ -523,8 +524,7 @@ void LanguageConfigView::AddUiLanguageSection(const std::string& language_code, const string16 language_name16 = l10n_util::GetDisplayNameForLocale( language_code, application_locale, true); const std::wstring language_name - = LanguageConfigModel::MaybeRewriteLanguageName( - UTF16ToWide(language_name16)); + = input_method::MaybeRewriteLanguageName(UTF16ToWide(language_name16)); views::Label* language_name_label = new views::Label(language_name); language_name_label->SetFont( language_name_label->font().DeriveFont(0, gfx::Font::BOLD)); |