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

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

Issue 10056001: chromeos: Remove old status-area related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 8 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 5df029bdf85e3e6a6fa9f8888112877bc0c3b883..fc2f88049696bc5c462db48aae4a7f2801312c2c 100644
--- a/chrome/browser/chromeos/input_method/input_method_util.cc
+++ b/chrome/browser/chromeos/input_method/input_method_util.cc
@@ -15,6 +15,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/chromeos/input_method/input_method_manager.h"
#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/pref_names.h"
@@ -61,6 +62,13 @@ const struct {
const size_t kMappingFromIdToIndicatorTextLen =
ARRAYSIZE_UNSAFE(kMappingFromIdToIndicatorText);
+
+string16 GetLanguageName(const std::string& language_code) {
+ const string16 language_name = l10n_util::GetDisplayNameForLocale(
+ language_code, g_browser_process->GetApplicationLocale(), true);
+ return language_name;
+}
+
}
namespace chromeos {
@@ -411,6 +419,40 @@ string16 InputMethodUtil::GetInputMethodShortName(
return text;
}
+string16 InputMethodUtil::GetInputMethodLongName(
+ const InputMethodDescriptor& input_method) const {
+ if (!input_method.name().empty()) {
+ // If the descriptor has a name, use it.
+ return UTF8ToUTF16(input_method.name());
+ }
+
+ // We don't show language here. Name of keyboard layout or input method
+ // usually imply (or explicitly include) its language.
+
+ input_method::InputMethodManager* manager =
+ input_method::InputMethodManager::GetInstance();
+
+ // 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 string16 standard_input_method_text = l10n_util::GetStringUTF16(
+ IDS_OPTIONS_SETTINGS_LANGUAGES_M17N_STANDARD_INPUT_METHOD);
+ const std::string language_code = input_method.language_code();
+
+ string16 text =
+ manager->GetInputMethodUtil()->TranslateString(input_method.id());
+ if (text == standard_input_method_text ||
+ language_code == "de" ||
+ language_code == "fr" ||
+ language_code == "nl") {
+ text = GetLanguageName(language_code) + UTF8ToUTF16(" - ") + text;
+ }
+
+ DCHECK(!text.empty());
+ return text;
+}
+
const InputMethodDescriptor* InputMethodUtil::GetInputMethodDescriptorFromId(
const std::string& input_method_id) const {
InputMethodIdToDescriptorMap::const_iterator iter

Powered by Google App Engine
This is Rietveld 408576698