| Index: chrome/browser/chromeos/input_method/input_method_manager.cc
|
| diff --git a/chrome/browser/chromeos/input_method/input_method_manager.cc b/chrome/browser/chromeos/input_method/input_method_manager.cc
|
| index 8f014f8ce3377d7aef23086d9c270ae11980ad2e..2eb655af231ea470cb0770102378fa0ca7a543a0 100644
|
| --- a/chrome/browser/chromeos/input_method/input_method_manager.cc
|
| +++ b/chrome/browser/chromeos/input_method/input_method_manager.cc
|
| @@ -384,8 +384,11 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
| FlushImeConfig();
|
| }
|
|
|
| - // Stop input method process if necessary.
|
| - MaybeStopInputMethodDaemon(section, config_name, value);
|
| + if (section == language_prefs::kGeneralSectionName &&
|
| + config_name == language_prefs::kPreloadEnginesConfigName) {
|
| + // Stop input method process if necessary.
|
| + MaybeStopInputMethodDaemon();
|
| + }
|
| // Change the current keyboard layout if necessary.
|
| MaybeChangeCurrentKeyboardLayout(section, config_name, value);
|
| return pending_config_requests_.empty();
|
| @@ -403,6 +406,9 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
| active_input_method_ids_.push_back(id);
|
| // TODO(yusukes): Call UpdateInputMethodSpecificHotkeys() here once IME
|
| // extension supports hotkeys.
|
| +
|
| + // Ensure that the input method daemon is running.
|
| + StartInputMethodDaemon();
|
| }
|
|
|
| virtual void RemoveActiveIme(const std::string& id) {
|
| @@ -416,6 +422,9 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
| extra_input_method_ids_.erase(id);
|
| // TODO(yusukes): Call UpdateInputMethodSpecificHotkeys() here once IME
|
| // extension supports hotkeys.
|
| +
|
| + // Stop the IME daemon if needed.
|
| + MaybeStopInputMethodDaemon();
|
| }
|
|
|
| virtual bool GetExtraDescriptor(const std::string& id,
|
| @@ -588,12 +597,9 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
|
|
| // Returns true if the given input method config value is a string list
|
| // that only contains an input method ID of a keyboard layout.
|
| - bool ContainOnlyKeyboardLayout(const ImeConfigValue& value) {
|
| - if (value.type != ImeConfigValue::kValueTypeStringList) {
|
| - return false;
|
| - }
|
| - for (size_t i = 0; i < value.string_list_value.size(); ++i) {
|
| - if (!InputMethodUtil::IsKeyboardLayout(value.string_list_value[i])) {
|
| + bool ContainOnlyKeyboardLayout(const std::vector<std::string>& value) {
|
| + for (size_t i = 0; i < value.size(); ++i) {
|
| + if (!InputMethodUtil::IsKeyboardLayout(value[i])) {
|
| return false;
|
| }
|
| }
|
| @@ -615,7 +621,8 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
| // If there is only one input method which is a keyboard layout,
|
| // we don't start the input method processes. When
|
| // |defer_ime_startup_| is true, we don't start it either.
|
| - if (ContainOnlyKeyboardLayout(value) || defer_ime_startup_) {
|
| + if (ContainOnlyKeyboardLayout(value.string_list_value) ||
|
| + defer_ime_startup_) {
|
| // Do not start the input method daemon.
|
| return;
|
| }
|
| @@ -659,21 +666,17 @@ class InputMethodManagerImpl : public HotkeyManager::Observer,
|
| // Stops input method daemon based on the |enable_auto_ime_shutdown_| flag
|
| // and input method configuration being updated.
|
| // See also: MaybeStartInputMethodDaemon().
|
| - void MaybeStopInputMethodDaemon(const std::string& section,
|
| - const std::string& config_name,
|
| - const ImeConfigValue& value) {
|
| + void MaybeStopInputMethodDaemon() {
|
| // If there is only one input method which is a keyboard layout,
|
| // and |enable_auto_ime_shutdown_| is true, we'll stop the input
|
| // method daemon.
|
| - if (section == language_prefs::kGeneralSectionName &&
|
| - config_name == language_prefs::kPreloadEnginesConfigName &&
|
| - ContainOnlyKeyboardLayout(value) &&
|
| + if (ContainOnlyKeyboardLayout(active_input_method_ids_) &&
|
| enable_auto_ime_shutdown_) {
|
| if (StopInputMethodDaemon()) {
|
| // The process is killed. Change the current keyboard layout.
|
| // We shouldn't use SetCurrentKeyboardLayoutByName() here. See
|
| // comments at ChangeCurrentInputMethod() for details.
|
| - ChangeCurrentInputMethodFromId(value.string_list_value[0]);
|
| + ChangeCurrentInputMethodFromId(active_input_method_ids_[0]);
|
| }
|
| }
|
| }
|
|
|