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

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: 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 57235fb6d34d9b8dbc9e904e745fca240b396242..e33ab44baae99e31c232adf2c637d61cb1b87946 100644
--- a/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
+++ b/chrome/browser/ui/webui/chromeos/login/l10n_util.cc
@@ -167,4 +167,34 @@ scoped_ptr<base::ListValue> GetLoginKeyboardLayouts(
return input_methods_list.Pass();
}
+scoped_ptr<base::ListValue> GetKeyboardLayouts(const std::string& locale) {
Alexander Alekseev 2014/07/16 19:35:50 We have similar code for the Guest session: https
bartfab (slow) 2014/07/21 14:49:13 The difference is that the code we have for guest
Alexander Alekseev 2014/07/21 17:06:56 Ah, I see what you are doing. Thank you for explan
Alexander Alekseev 2014/07/21 17:13:41 GetKeyboardLayouts() seems to be too general. We a
bartfab (slow) 2014/07/21 18:20:47 I called it GetKeyboardLayoutsForLocale(). After a
+ input_method::InputMethodUtil* util =
+ input_method::InputMethodManager::Get()->GetInputMethodUtil();
+ std::vector<std::string> layouts = util->GetHardwareLoginInputMethodIds();
Alexander Alekseev 2014/07/21 17:06:56 May be GetHardwareInputMethodIds ? (not "Login") U
bartfab (slow) 2014/07/21 18:20:47 Nice catch. Done.
+ std::vector<std::string> layouts_from_locale;
+ util->GetInputMethodIdsFromLanguageCode(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

Powered by Google App Engine
This is Rietveld 408576698