Index: chrome/browser/chromeos/preferences.cc |
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
index f6492543705bf18d2a44a259f6b39d03a87ffb2a..7cd4f109f49dcb76eac6eba60c323f425a569e01 100644 |
--- a/chrome/browser/chromeos/preferences.cc |
+++ b/chrome/browser/chromeos/preferences.cc |
@@ -51,7 +51,8 @@ Preferences::Preferences() |
: prefs_(NULL), |
input_method_manager_(input_method::InputMethodManager::Get()), |
user_(NULL), |
- user_is_primary_(false) { |
+ user_is_primary_(false), |
+ ime_state_outdated_(true) { |
// Do not observe shell, if there is no shell instance; e.g., in some unit |
// tests. |
if (ash::Shell::HasInstance()) |
@@ -62,7 +63,8 @@ Preferences::Preferences(input_method::InputMethodManager* input_method_manager) |
: prefs_(NULL), |
input_method_manager_(input_method_manager), |
user_(NULL), |
- user_is_primary_(false) { |
+ user_is_primary_(false), |
+ ime_state_outdated_(true) { |
// Do not observe shell, if there is no shell instance; e.g., in some unit |
// tests. |
if (ash::Shell::HasInstance()) |
@@ -536,12 +538,15 @@ void Preferences::ApplyPreferences(ApplyReason reason, |
UpdateAutoRepeatRate(); |
} |
- if (reason != REASON_PREF_CHANGED && user_is_active) { |
- SetInputMethodList(); |
- } else if (pref_name == prefs::kLanguagePreloadEngines && user_is_active) { |
- SetLanguageConfigStringListAsCSV(language_prefs::kGeneralSectionName, |
- language_prefs::kPreloadEnginesConfigName, |
- preload_engines_.GetValue()); |
+ if (pref_name == prefs::kLanguagePreloadEngines) { |
+ if (reason == REASON_PREF_CHANGED && user_is_active) { |
+ SetLanguageConfigStringListAsCSV( |
+ language_prefs::kGeneralSectionName, |
+ language_prefs::kPreloadEnginesConfigName, |
+ preload_engines_.GetValue()); |
+ } else { |
+ ime_state_outdated_ = true; |
+ } |
} |
if (reason != REASON_PREF_CHANGED || |
@@ -645,9 +650,26 @@ void Preferences::OnTouchHudProjectionToggled(bool enabled) { |
touch_hud_projection_enabled_.SetValue(enabled); |
} |
+void Preferences::ActivateInputMethods(const user_manager::User* active_user) { |
+ bool just_created = false; |
+ if (!ime_state_) { |
+ ime_state_ = input_method::InputMethodManager::Get()->CreateNewState( |
+ active_user->email()); |
+ just_created = true; |
+ } |
+ input_method::InputMethodManager::Get()->SetState(ime_state_); |
+ if (just_created || ime_state_outdated_) { |
+ SetInputMethodList(); |
+ ime_state_outdated_ = false; |
+ } |
+} |
+ |
void Preferences::ActiveUserChanged(const user_manager::User* active_user) { |
if (active_user != user_) |
return; |
+ |
+ ActivateInputMethods(active_user); |
+ |
ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
} |