| Index: ash/system/ime/tray_ime_chromeos.cc
|
| diff --git a/ash/system/ime/tray_ime_chromeos.cc b/ash/system/ime/tray_ime_chromeos.cc
|
| index 537a4f1db48feed3c4c7e0b98b2d5596a50cbac1..67ec48fb453190ed43e63448900878ae01ff1e81 100644
|
| --- a/ash/system/ime/tray_ime_chromeos.cc
|
| +++ b/ash/system/ime/tray_ime_chromeos.cc
|
| @@ -29,7 +29,6 @@
|
| #include "components/strings/grit/components_strings.h"
|
| #include "ui/accessibility/ax_enums.h"
|
| #include "ui/accessibility/ax_node_data.h"
|
| -#include "ui/base/ime/chromeos/input_method_manager.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/gfx/font.h"
|
| #include "ui/gfx/image/image.h"
|
| @@ -158,12 +157,25 @@ TrayIME::TrayIME(SystemTray* system_tray)
|
| SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier();
|
| tray_notifier->AddVirtualKeyboardObserver(this);
|
| tray_notifier->AddAccessibilityObserver(this);
|
| - tray_notifier->AddIMEObserver(this);
|
| +
|
| + // May be null in tests.
|
| + InputMethodManager* input_method_manager = InputMethodManager::Get();
|
| + if (input_method_manager) {
|
| + input_method_manager->AddObserver(this);
|
| + input_method_manager->AddImeMenuObserver(this);
|
| + }
|
| + ui::ime::InputMethodMenuManager::GetInstance()->AddObserver(this);
|
| }
|
|
|
| TrayIME::~TrayIME() {
|
| + ui::ime::InputMethodMenuManager::GetInstance()->RemoveObserver(this);
|
| + InputMethodManager* input_method_manager = InputMethodManager::Get();
|
| + if (input_method_manager) {
|
| + input_method_manager->RemoveImeMenuObserver(this);
|
| + input_method_manager->RemoveObserver(this);
|
| + }
|
| +
|
| SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier();
|
| - tray_notifier->RemoveIMEObserver(this);
|
| tray_notifier->RemoveAccessibilityObserver(this);
|
| tray_notifier->RemoveVirtualKeyboardObserver(this);
|
| }
|
| @@ -265,7 +277,7 @@ void TrayIME::DestroyDetailedView() {
|
| detailed_ = NULL;
|
| }
|
|
|
| -void TrayIME::OnIMERefresh() {
|
| +void TrayIME::RefreshCurrentIme() {
|
| // Caches the current ime state.
|
| current_ime_ = ime_util::GetCurrentIME();
|
| ime_list_ = ime_util::GetAvailableIMEList();
|
| @@ -279,14 +291,34 @@ void TrayIME::OnIMERefresh() {
|
| Update();
|
| }
|
|
|
| -void TrayIME::OnIMEMenuActivationChanged(bool is_active) {
|
| +// InputMethodManager::Observer:
|
| +void TrayIME::InputMethodChanged(InputMethodManager* manager,
|
| + Profile* profile,
|
| + bool show_message) {
|
| + RefreshCurrentIme();
|
| +}
|
| +
|
| +// InputMethodMenuManager::Observer:
|
| +void TrayIME::ImeMenuActivationChanged(bool is_active) {
|
| is_visible_ = !is_active;
|
| if (is_visible_)
|
| - OnIMERefresh();
|
| + RefreshCurrentIme();
|
| else
|
| Update();
|
| }
|
|
|
| +void TrayIME::ImeMenuListChanged() {}
|
| +
|
| +void TrayIME::ImeMenuItemsChanged(
|
| + const std::string& engine_id,
|
| + const std::vector<InputMethodManager::MenuItem>& items) {}
|
| +
|
| +// ui::ime::InputMethodMenuManager::Observer:
|
| +void TrayIME::InputMethodMenuItemChanged(
|
| + ui::ime::InputMethodMenuManager* manager) {
|
| + RefreshCurrentIme();
|
| +}
|
| +
|
| bool TrayIME::IsIMEManaged() {
|
| return !ime_managed_message_.empty();
|
| }
|
|
|