Chromium Code Reviews| 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 4944bdc67716ff8f87506bb711707037868c8cfb..451a595c4d88c45d40b191f9c6dfa9ef8189b4b4 100644 |
| --- a/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| +++ b/chrome/browser/chromeos/input_method/input_method_manager_impl.cc |
| @@ -112,8 +112,7 @@ InputMethodCategory GetInputMethodCategory(const std::string& input_method_id, |
| InputMethodManagerImpl::StateImpl::StateImpl(InputMethodManagerImpl* manager, |
| Profile* profile) |
| - : profile(profile), manager_(manager) { |
| -} |
| + : profile(profile), manager_(manager), menu_activated(false) {} |
| InputMethodManagerImpl::StateImpl::~StateImpl() { |
| } |
| @@ -128,6 +127,7 @@ void InputMethodManagerImpl::StateImpl::InitFrom(const StateImpl& other) { |
| enabled_extension_imes = other.enabled_extension_imes; |
| extra_input_methods = other.extra_input_methods; |
| + menu_activated = other.menu_activated; |
| } |
| bool InputMethodManagerImpl::StateImpl::IsActive() const { |
| @@ -856,7 +856,7 @@ InputMethodManagerImpl::InputMethodManagerImpl( |
| util_(delegate_.get()), |
| component_extension_ime_manager_(new ComponentExtensionIMEManager()), |
| enable_extension_loading_(enable_extension_loading), |
| - is_ime_menu_activated_(false) { |
| + menu_activated_(false) { |
| // TODO(mohsen): Revisit using FakeImeKeyboard with mash when InputController |
| // work is ready. http://crbug.com/601981 |
| if (base::SysInfo::IsRunningOnChromeOS() && !chrome::IsRunningInMash()) |
| @@ -927,15 +927,6 @@ void InputMethodManagerImpl::SetUISessionState(UISessionState new_ui_session) { |
| ui_session_ = new_ui_session; |
| if (ui_session_ == STATE_TERMINATING && candidate_window_controller_.get()) |
| candidate_window_controller_.reset(); |
| - |
| - // The expanded IME menu is only supportive with 'normal' screen type. It |
| - // should be deactivated when the screen type is not 'normal', and be |
| - // re-activated when changing back. |
| - if (is_ime_menu_activated_ && ui_session_ != STATE_TERMINATING) { |
| - FOR_EACH_OBSERVER( |
| - InputMethodManager::ImeMenuObserver, ime_menu_observers_, |
| - ImeMenuActivationChanged(ui_session_ == STATE_BROWSER_SCREEN)); |
| - } |
| } |
| void InputMethodManagerImpl::OnUserAddingStarted() { |
| @@ -1185,12 +1176,14 @@ void InputMethodManagerImpl::CandidateWindowClosed() { |
| void InputMethodManagerImpl::ImeMenuActivationChanged(bool is_active) { |
| // Saves the state that whether the expanded IME menu has been activated by |
| - // users. This method is only called when the preference is changing. |
| - is_ime_menu_activated_ = is_active; |
| + // users. This method is only called when the preference is changing or the |
| + // active user changed. |
|
Shu Chen
2016/08/29 08:20:08
revert this comment change.
Azure Wei
2016/08/29 08:27:47
Done.
|
| + menu_activated_ = is_active; |
| + state_->menu_activated = menu_activated_; |
| FOR_EACH_OBSERVER(InputMethodManager::ImeMenuObserver, ime_menu_observers_, |
| - ImeMenuActivationChanged(is_active)); |
| + ImeMenuActivationChanged(menu_activated_)); |
| UMA_HISTOGRAM_BOOLEAN("InputMethod.ImeMenu.ActivationChanged", |
| - is_ime_menu_activated_); |
| + menu_activated_); |
|
Shu Chen
2016/08/29 08:20:08
void InputMethodManagerImpl::ImeMenuActivationChan
Azure Wei
2016/08/29 08:27:47
Done.
|
| } |
| void InputMethodManagerImpl::NotifyImeMenuListChanged() { |
| @@ -1214,5 +1207,12 @@ void InputMethodManagerImpl::NotifyImeMenuItemsChanged( |
| ImeMenuItemsChanged(engine_id, items)); |
| } |
| +void InputMethodManagerImpl::MaybeNotifyImeMenuActivationChanged() { |
| + bool is_active = state_->menu_activated; |
| + if (menu_activated_ != is_active) { |
| + ImeMenuActivationChanged(is_active); |
| + } |
| +} |
| + |
| } // namespace input_method |
| } // namespace chromeos |