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

Unified Diff: chrome/browser/ui/webui/chromeos/login/l10n_util.cc

Issue 398543002: Add language and keyboard layout pickers to public session pods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Base the list of keyboard layouts offered on the resolved locale, not the selected locale. Created 6 years, 5 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/ui/webui/chromeos/login/l10n_util.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
index 6d1cf7b61a7c1b1cfd5fdb374e9e1909e2b83004..a56918bd53fab0ae9e27826612221b7f536a2ad9 100644
--- a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
+++ b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
@@ -404,4 +404,36 @@ scoped_ptr<base::ListValue> GetLoginKeyboardLayouts(
return input_methods_list.Pass();
}
+scoped_ptr<base::ListValue> GetKeyboardLayoutsForLocale(
+ const std::string& locale) {
+ input_method::InputMethodUtil* util =
+ input_method::InputMethodManager::Get()->GetInputMethodUtil();
+ std::vector<std::string> layouts = util->GetHardwareInputMethodIds();
+ std::vector<std::string> layouts_from_locale;
+ util->GetInputMethodIdsFromLanguageCode(
+ l10n_util::GetApplicationLocale(locale),
+ input_method::kKeyboardLayoutsOnly,
+ &layouts_from_locale);
+ layouts.insert(layouts.end(), layouts_from_locale.begin(),
+ layouts_from_locale.end());
+
+ std::string selected;
+ if (!layouts_from_locale.empty()) {
+ selected =
+ util->GetInputMethodDescriptorFromId(layouts_from_locale[0])->id();
+ }
+
+ scoped_ptr<base::ListValue> input_methods_list(new base::ListValue);
+ std::set<std::string> input_methods_added;
+ for (std::vector<std::string>::const_iterator it = layouts.begin();
+ it != layouts.end(); ++it) {
+ const input_method::InputMethodDescriptor* ime =
+ util->GetInputMethodDescriptorFromId(*it);
+ if (!InsertString(ime->id(), input_methods_added))
+ continue;
+ input_methods_list->Append(CreateInputMethodsEntry(*ime, selected));
+ }
+ return input_methods_list.Pass();
+}
+
} // namespace chromeos
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/l10n_util.h ('k') | chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698