Commit 1b933903 authored by shuchen@chromium.org's avatar shuchen@chromium.org

Fix the issue that 3rd party IME cannot be activated after user login.

BUG=401402
TEST=Verified on linux_chromeos.

Review URL: https://codereview.chromium.org/442403004

Cr-Commit-Position: refs/heads/master@{#288293}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288293 0039d316-1c4b-4281-b951-d872f2087c98
parent a15f8d88
...@@ -317,6 +317,13 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal( ...@@ -317,6 +317,13 @@ bool InputMethodManagerImpl::ChangeInputMethodInternal(
// Sanity check. // Sanity check.
if (!InputMethodIsActivated(input_method_id)) { 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()); scoped_ptr<InputMethodDescriptors> input_methods(GetActiveInputMethods());
DCHECK(!input_methods->empty()); DCHECK(!input_methods->empty());
input_method_id_to_switch = input_methods->at(0).id(); input_method_id_to_switch = input_methods->at(0).id();
...@@ -526,6 +533,7 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( ...@@ -526,6 +533,7 @@ void InputMethodManagerImpl::SetEnabledExtensionImes(
ids->end()); ids->end());
bool active_imes_changed = false; bool active_imes_changed = false;
bool switch_to_pending = false;
for (std::map<std::string, InputMethodDescriptor>::iterator extra_iter = for (std::map<std::string, InputMethodDescriptor>::iterator extra_iter =
extra_input_methods_.begin(); extra_iter != extra_input_methods_.end(); extra_input_methods_.begin(); extra_iter != extra_input_methods_.end();
...@@ -533,6 +541,10 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( ...@@ -533,6 +541,10 @@ void InputMethodManagerImpl::SetEnabledExtensionImes(
if (extension_ime_util::IsComponentExtensionIME( if (extension_ime_util::IsComponentExtensionIME(
extra_iter->first)) extra_iter->first))
continue; // Do not filter component extension. 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( std::vector<std::string>::iterator active_iter = std::find(
active_input_method_ids_.begin(), active_input_method_ids_.end(), active_input_method_ids_.begin(), active_input_method_ids_.end(),
extra_iter->first); extra_iter->first);
...@@ -553,9 +565,14 @@ void InputMethodManagerImpl::SetEnabledExtensionImes( ...@@ -553,9 +565,14 @@ void InputMethodManagerImpl::SetEnabledExtensionImes(
if (active_imes_changed) { if (active_imes_changed) {
MaybeInitializeCandidateWindowController(); MaybeInitializeCandidateWindowController();
// If |current_input_method| is no longer in |active_input_method_ids_|, if (switch_to_pending) {
// switch to the first one in |active_input_method_ids_|. ChangeInputMethod(pending_input_method_id_);
ChangeInputMethod(current_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());
}
} }
} }
......
...@@ -185,6 +185,9 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -185,6 +185,9 @@ class InputMethodManagerImpl : public InputMethodManager,
// those created by extension. // those created by extension.
std::map<std::string, InputMethodDescriptor> extra_input_methods_; std::map<std::string, InputMethodDescriptor> extra_input_methods_;
// The pending input method id for delayed 3rd party IME enabling.
std::string pending_input_method_id_;
// The candidate window. This will be deleted when the APP_TERMINATING // The candidate window. This will be deleted when the APP_TERMINATING
// message is sent. // message is sent.
scoped_ptr<CandidateWindowController> candidate_window_controller_; scoped_ptr<CandidateWindowController> candidate_window_controller_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment