Index: chrome/browser/chromeos/preferences.cc |
diff --git a/chrome/browser/chromeos/preferences.cc b/chrome/browser/chromeos/preferences.cc |
index 1a792e0206025446cb4d1d8b25e29ea1fc4dbe42..648318f094261824d227cd0e5507074a3b511c11 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()) |
@@ -537,12 +539,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 || |
@@ -646,9 +651,26 @@ void Preferences::OnTouchHudProjectionToggled(bool enabled) { |
touch_hud_projection_enabled_.SetValue(enabled); |
} |
+void Preferences::ActivateInputMethods(const User* active_user) { |
+ bool just_created = false; |
+ if (!ime_state_) { |
Shu Chen
2014/08/04 14:55:24
I don't understand. Will there be single InputMeth
Alexander Alekseev
2014/08/06 23:39:45
No. Preferences belong to particular user, so this
|
+ 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* active_user) { |
if (active_user != user_) |
return; |
+ |
+ ActivateInputMethods(active_user); |
+ |
ApplyPreferences(REASON_ACTIVE_USER_CHANGED, ""); |
} |