diff options
Diffstat (limited to 'chrome')
7 files changed, 29 insertions, 27 deletions
diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc index ec5aefc..ab90ac68 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc @@ -10,8 +10,10 @@ #include "base/bind.h" #include "base/location.h" #include "base/memory/scoped_ptr.h" +#include "base/prefs/pref_service.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" +#include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/input_method/candidate_window_controller.h" #include "chrome/browser/chromeos/input_method/component_extension_ime_manager_impl.h" #include "chrome/browser/chromeos/input_method/input_method_engine_ibus.h" @@ -669,6 +671,24 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( } } +void InputMethodManagerImpl::SetInputMethodDefault() { + // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty + // and US dvorak keyboard layouts. + if (g_browser_process && g_browser_process->local_state()) { + const std::string locale = g_browser_process->GetApplicationLocale(); + // If the preferred keyboard for the login screen has been saved, use it. + PrefService* prefs = g_browser_process->local_state(); + std::string initial_input_method_id = + prefs->GetString(chromeos::language_prefs::kPreferredKeyboardLayout); + if (initial_input_method_id.empty()) { + // If kPreferredKeyboardLayout is not specified, use the hardware layout. + initial_input_method_id = + GetInputMethodUtil()->GetHardwareInputMethodId(); + } + EnableLayouts(locale, initial_input_method_id); + } +} + bool InputMethodManagerImpl::SwitchToNextInputMethod() { // Sanity checks. if (active_input_method_ids_.empty()) { diff --git a/chrome/browser/chromeos/input_method/input_method_manager_impl.h b/chrome/browser/chromeos/input_method/input_method_manager_impl.h index 24919ca..fdb24cc 100644 --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.h +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.h @@ -85,6 +85,7 @@ class InputMethodManagerImpl : public InputMethodManager, virtual void GetInputMethodExtensions( InputMethodDescriptors* result) OVERRIDE; virtual void SetEnabledExtensionImes(std::vector<std::string>* ids) OVERRIDE; + virtual void SetInputMethodDefault() OVERRIDE; virtual bool SwitchToNextInputMethod() OVERRIDE; virtual bool SwitchToPreviousInputMethod( const ui::Accelerator& accelerator) OVERRIDE; diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc b/chrome/browser/chromeos/input_method/mock_input_method_manager.cc index b5210d1..906097c 100644 --- a/chrome/browser/chromeos/input_method/mock_input_method_manager.cc +++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.cc @@ -113,6 +113,9 @@ void MockInputMethodManager::SetEnabledExtensionImes( std::vector<std::string>* ids) { } +void MockInputMethodManager::SetInputMethodDefault() { +} + bool MockInputMethodManager::SwitchToNextInputMethod() { return true; } diff --git a/chrome/browser/chromeos/input_method/mock_input_method_manager.h b/chrome/browser/chromeos/input_method/mock_input_method_manager.h index 371521e..e532791 100644 --- a/chrome/browser/chromeos/input_method/mock_input_method_manager.h +++ b/chrome/browser/chromeos/input_method/mock_input_method_manager.h @@ -58,6 +58,7 @@ class MockInputMethodManager : public InputMethodManager { virtual void GetInputMethodExtensions( InputMethodDescriptors* result) OVERRIDE; virtual void SetEnabledExtensionImes(std::vector<std::string>* ids) OVERRIDE; + virtual void SetInputMethodDefault() OVERRIDE; virtual bool SwitchToNextInputMethod() OVERRIDE; virtual bool SwitchToPreviousInputMethod( const ui::Accelerator& accelerator) OVERRIDE; diff --git a/chrome/browser/chromeos/login/login_display_host_impl.cc b/chrome/browser/chromeos/login/login_display_host_impl.cc index e2eccef..8001931 100644 --- a/chrome/browser/chromeos/login/login_display_host_impl.cc +++ b/chrome/browser/chromeos/login/login_display_host_impl.cc @@ -861,18 +861,9 @@ void ShowLoginWizard(const std::string& first_screen_name) { // Set up keyboards. For example, when |locale| is "en-US", enable US qwerty // and US dvorak keyboard layouts. if (g_browser_process && g_browser_process->local_state()) { - const std::string locale = g_browser_process->GetApplicationLocale(); - // If the preferred keyboard for the login screen has been saved, use it. - PrefService* prefs = g_browser_process->local_state(); - std::string initial_input_method_id = - prefs->GetString(chromeos::language_prefs::kPreferredKeyboardLayout); - if (initial_input_method_id.empty()) { - // If kPreferredKeyboardLayout is not specified, use the hardware layout. - initial_input_method_id = - manager->GetInputMethodUtil()->GetHardwareInputMethodId(); - } - manager->EnableLayouts(locale, initial_input_method_id); + manager->SetInputMethodDefault(); + PrefService* prefs = g_browser_process->local_state(); // Apply owner preferences for tap-to-click and mouse buttons swap for // login screen. system::mouse_settings::SetPrimaryButtonRight( diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc index 0ea2ab1..c3cb66c 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.cc @@ -1018,21 +1018,11 @@ void SigninScreenHandler::OnDnsCleared() { ShowSigninScreenIfReady(); } -void SigninScreenHandler::SetUserInputMethodHWDefault() { - chromeos::input_method::InputMethodManager* manager = - chromeos::input_method::InputMethodManager::Get(); - manager->ChangeInputMethod( - manager->GetInputMethodUtil()->GetHardwareInputMethodId()); -} - // Update keyboard layout to least recently used by the user. void SigninScreenHandler::SetUserInputMethod(const std::string& username) { chromeos::input_method::InputMethodManager* const manager = chromeos::input_method::InputMethodManager::Get(); - const chromeos::input_method::InputMethodUtil& ime_util = - *manager->GetInputMethodUtil(); - const bool succeed = SetUserInputMethodImpl(username, manager); // This is also a case when LRU layout is set only for a few local users, @@ -1040,10 +1030,9 @@ void SigninScreenHandler::SetUserInputMethod(const std::string& username) { // Otherwise they will end up using another user's locale to log in. if (!succeed) { DLOG(INFO) << "SetUserInputMethod('" << username - << "'): failed to set user layout. Switching to default '" - << ime_util.GetHardwareInputMethodId() << "'"; + << "'): failed to set user layout. Switching to default."; - SetUserInputMethodHWDefault(); + manager->SetInputMethodDefault(); } } diff --git a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h index 33d8915..df9bf26 100644 --- a/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h +++ b/chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h @@ -387,9 +387,6 @@ class SigninScreenHandler // Update current input method (namely keyboard layout) to LRU by this user. void SetUserInputMethod(const std::string& username); - // Update current input method to HW default. - void SetUserInputMethodHWDefault(); - // Current UI state of the signin screen. UIState ui_state_; |