Chromium Code Reviews| Index: chrome/browser/chromeos/input_method/input_method_util.cc |
| diff --git a/chrome/browser/chromeos/input_method/input_method_util.cc b/chrome/browser/chromeos/input_method/input_method_util.cc |
| index f91cb1a42984a6a01128d3f533c785794dc9aa4e..0f13b7aa35c728ac0a808aca48ce14a915597883 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_util.cc |
| +++ b/chrome/browser/chromeos/input_method/input_method_util.cc |
| @@ -432,8 +432,9 @@ base::string16 InputMethodUtil::GetInputMethodMediumName( |
| return GetInputMethodShortName(input_method); |
| } |
| -base::string16 InputMethodUtil::GetInputMethodLongName( |
| - const InputMethodDescriptor& input_method) const { |
| +base::string16 InputMethodUtil::GetInputMethodLongNameInternal( |
| + const InputMethodDescriptor& input_method, bool strip) const { |
| + LOG(ERROR) << "-----" << input_method.id(); |
|
Nikita (slow)
2014/09/29 19:03:19
nit: debug code
Shu Chen
2014/09/30 01:11:15
Done.
|
| if (!input_method.name().empty() && !IsKeyboardLayout(input_method.id())) { |
| // If the descriptor has a name, use it. |
| return base::UTF8ToUTF16(input_method.name()); |
| @@ -441,25 +442,18 @@ base::string16 InputMethodUtil::GetInputMethodLongName( |
| // We don't show language here. Name of keyboard layout or input method |
| // usually imply (or explicitly include) its language. |
| - |
| // Special case for German, French and Dutch: these languages have multiple |
| // keyboard layouts and share the same layout of keyboard (Belgian). We need |
| - // to show explicitly the language for the layout. For Arabic, Amharic, and |
| - // Indic languages: they share "Standard Input Method". |
| - const base::string16 standard_input_method_text = |
| - delegate_->GetLocalizedString( |
| - IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD); |
| + // to show explicitly the language for the layout. |
| DCHECK(!input_method.language_codes().empty()); |
| const std::string language_code = input_method.language_codes().at(0); |
| - base::string16 text = TranslateString(input_method.id()); |
| - if (text == standard_input_method_text || |
| - language_code == "de" || |
| - language_code == "fr" || |
| - language_code == "nl") { |
| + base::string16 text = (strip || input_method.name().empty()) |
| + ? TranslateString(input_method.id()) |
| + : base::UTF8ToUTF16(input_method.name()); |
| + if (language_code == "de" || language_code == "fr" || language_code == "nl") { |
| const base::string16 language_name = delegate_->GetDisplayLanguageName( |
| language_code); |
| - |
| text = language_name + base::UTF8ToUTF16(" - ") + text; |
| } |
| @@ -467,6 +461,17 @@ base::string16 InputMethodUtil::GetInputMethodLongName( |
| return text; |
| } |
| + |
| +base::string16 InputMethodUtil::GetInputMethodLongNameStripped( |
| + const InputMethodDescriptor& input_method) const { |
| + return GetInputMethodLongNameInternal(input_method, true); |
|
Nikita (slow)
2014/09/29 19:03:18
nit: true /* strip */
Shu Chen
2014/09/30 01:11:15
Done.
|
| +} |
| + |
| +base::string16 InputMethodUtil::GetInputMethodLongName( |
| + const InputMethodDescriptor& input_method) const { |
| + return GetInputMethodLongNameInternal(input_method, true); |
|
Nikita (slow)
2014/09/29 19:03:18
Should the strip parameter be false here?
Shu Chen
2014/09/30 01:11:15
Done.
|
| +} |
| + |
| const InputMethodDescriptor* InputMethodUtil::GetInputMethodDescriptorFromId( |
| const std::string& input_method_id) const { |
| InputMethodIdToDescriptorMap::const_iterator iter = |