Index: chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
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 072a3b2b8dac7e0f5986b41a6fab648adda4cd35..4501e0b49cba7666d3c8d0ea7a14819aa4f21309 100644 |
--- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
+++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
@@ -317,6 +317,13 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal( |
// Sanity check. |
if (!InputMethodIsActivated(input_method_id)) { |
+ // For 3rd party IME, when the user just logged in, SetEnabledExtensionImes |
+ // happens after activating the 3rd party IME. |
+ // So here to record the 3rd party IME to be activated, and activate it |
+ // when SetEnabledExtensionImes happens later. |
+ if (extension_ime_util::IsExtensionIME(input_method_id)) |
+ pending_input_method_id_ = input_method_id; |
+ |
scoped_ptr<InputMethodDescriptors> input_methods(GetActiveInputMethods()); |
DCHECK(!input_methods->empty()); |
input_method_id_to_switch = input_methods->at(0).id(); |
@@ -526,6 +533,7 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( |
ids->end()); |
bool active_imes_changed = false; |
+ bool switch_to_pending = false; |
for (std::map<std::string, InputMethodDescriptor>::iterator extra_iter = |
extra_input_methods_.begin(); extra_iter != extra_input_methods_.end(); |
@@ -533,6 +541,10 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( |
if (extension_ime_util::IsComponentExtensionIME( |
extra_iter->first)) |
continue; // Do not filter component extension. |
+ |
+ if (pending_input_method_id_ == extra_iter->first) |
+ switch_to_pending = true; |
+ |
std::vector<std::string>::iterator active_iter = std::find( |
active_input_method_ids_.begin(), active_input_method_ids_.end(), |
extra_iter->first); |
@@ -553,9 +565,14 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( |
if (active_imes_changed) { |
MaybeInitializeCandidateWindowController(); |
- // If |current_input_method| is no longer in |active_input_method_ids_|, |
- // switch to the first one in |active_input_method_ids_|. |
- ChangeInputMethod(current_input_method_.id()); |
+ if (switch_to_pending) { |
+ ChangeInputMethod(pending_input_method_id_); |
+ pending_input_method_id_.clear(); |
+ } else { |
+ // If |current_input_method| is no longer in |active_input_method_ids_|, |
+ // switch to the first one in |active_input_method_ids_|. |
+ ChangeInputMethod(current_input_method_.id()); |
+ } |
} |
} |