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

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

Issue 484353005: ChromeOS: "Add New User" screen should enable all hardware keyboards. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added browser test for login UI IM. Created 6 years, 3 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/gaia_screen_handler.cc
diff --git a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
index 0c0dbe0d0642238446f31f044bed2ff61de95ca8..dab8ff042c36d1413eed71e78f28c50566e527ba 100644
--- a/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
+++ b/chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc
@@ -12,6 +12,8 @@
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/browser_shutdown.h"
+#include "chrome/browser/chromeos/input_method/input_method_util.h"
+#include "chrome/browser/chromeos/language_preferences.h"
#include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
#include "chrome/browser/chromeos/policy/consumer_management_service.h"
#include "chrome/browser/chromeos/profiles/profile_helper.h"
@@ -22,6 +24,7 @@
#include "chrome/common/pref_names.h"
#include "chrome/grit/generated_resources.h"
#include "chromeos/chromeos_switches.h"
+#include "chromeos/ime/input_method_manager.h"
#include "chromeos/settings/cros_settings_names.h"
#include "components/user_manager/user_manager.h"
#include "content/public/browser/browser_thread.h"
@@ -105,6 +108,16 @@ void ClearDnsCache(IOThread* io_thread) {
io_thread->ClearHostCache();
}
+void PushFrontIMIfNotExists(const std::string& input_method,
+ std::vector<std::string>* input_methods) {
+ if (input_method.empty())
+ return;
+
+ if (std::find(input_methods->begin(), input_methods->end(), input_method) ==
+ input_methods->end())
+ input_methods->insert(input_methods->begin(), input_method);
+}
+
} // namespace
GaiaContext::GaiaContext()
@@ -557,9 +570,37 @@ void GaiaScreenHandler::ShowGaiaScreenIfReady() {
else
Delegate()->LoadWallpaper(populated_email_);
+ input_method::InputMethodManager* imm =
+ input_method::InputMethodManager::Get();
+
+ scoped_refptr<input_method::InputMethodManager::State> gaia_ime_state =
+ imm->GetActiveIMEState()->Clone();
+ imm->SetState(gaia_ime_state);
+
// Set Least Recently Used input method for the user.
- if (!populated_email_.empty())
- signin_screen_handler_->SetUserInputMethod(populated_email_);
+ if (!populated_email_.empty()) {
+ signin_screen_handler_->SetUserInputMethod(populated_email_,
+ gaia_ime_state.get());
+ } else {
+ std::vector<std::string> input_methods =
+ imm->GetInputMethodUtil()->GetHardwareLoginInputMethodIds();
+ const std::string owner_im = signin_screen_handler_->GetUserLRUInputMethod(
+ user_manager::UserManager::Get()->GetOwnerEmail());
+ const std::string system_im = g_browser_process->local_state()->GetString(
+ language_prefs::kPreferredKeyboardLayout);
+
+ PushFrontIMIfNotExists(owner_im, &input_methods);
+ PushFrontIMIfNotExists(system_im, &input_methods);
+
+ gaia_ime_state->EnableLoginLayouts(
+ g_browser_process->GetApplicationLocale(), input_methods);
+
+ if (!system_im.empty()) {
+ gaia_ime_state->ChangeInputMethod(system_im, false /* show_message */);
+ } else if (!owner_im.empty()) {
+ gaia_ime_state->ChangeInputMethod(owner_im, false /* show_message */);
+ }
+ }
LoadAuthExtension(!gaia_silent_load_, false, false);
signin_screen_handler_->UpdateUIState(

Powered by Google App Engine
This is Rietveld 408576698