Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: chrome/browser/chromeos/input_method/input_method_util.cc

Issue 150723006: Make input_methods.txt to be able to specify indicator string. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more consistent Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 6946a8b59bd787791343836784b99b25b4ca2264..956ce4007ca391f3ae93585524ac10d5e98443e6 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -30,17 +30,6 @@ const struct {
const char* input_method_id;
const char* indicator_text;
} kMappingFromIdToIndicatorText[] = {
- // To distinguish from "xkb:us::eng"
- { "xkb:us:altgr-intl:eng", "EXTD" },
- { "xkb:us:dvorak:eng", "DV" },
- { "xkb:us:intl:eng", "INTL" },
- { "xkb:us:colemak:eng", "CO" },
- { "english-m", "??" },
- { "xkb:de:neo:ger", "NEO" },
- // To distinguish from "xkb:es::spa"
- { "xkb:es:cat:cat", "CAS" },
- // To distinguish from "xkb:gb::eng"
- { "xkb:gb:dvorak:eng", "DV" },
// To distinguish from "xkb:jp::jpn"
// TODO(nona): Make following variables configurable. http://crbug.com/232260.
{ "_comp_ime_fpfbhcjppmaeaijcidgiibchfbnhbeljnacl_mozc_us", "\xe3\x81\x82" },
@@ -390,11 +379,17 @@ base::string16 InputMethodUtil::GetInputMethodShortName(
const InputMethodDescriptor& input_method) const {
// For the status area, we use two-letter, upper-case language code like
// "US" and "JP".
- base::string16 text;
+ // Use the indicator string if set.
+ if (!input_method.indicator().empty()) {
+ return base::UTF8ToUTF16(input_method.indicator());
+ }
+
+ base::string16 text;
// Check special cases first.
for (size_t i = 0; i < kMappingFromIdToIndicatorTextLen; ++i) {
- if (kMappingFromIdToIndicatorText[i].input_method_id == input_method.id()) {
+ if (kMappingFromIdToIndicatorText[i].input_method_id ==
+ input_method.id()) {
text = base::UTF8ToUTF16(kMappingFromIdToIndicatorText[i].indicator_text);
break;
}
@@ -423,7 +418,7 @@ base::string16 InputMethodUtil::GetInputMethodShortName(
text = StringToUpperASCII(base::UTF8ToUTF16(language_code)).substr(
0, kMaxLanguageNameLen);
}
- DCHECK(!text.empty());
+ DCHECK(!text.empty()) << input_method.id();
return text;
}
@@ -663,6 +658,7 @@ InputMethodDescriptor InputMethodUtil::GetFallbackInputMethodDescriptor() {
languages.push_back("en-US");
return InputMethodDescriptor("xkb:us::eng",
"",
+ "US",
layouts,
languages,
true, // login keyboard.

Powered by Google App Engine
This is Rietveld 408576698