Index: ash/system/ime_menu/ime_menu_tray.cc |
diff --git a/ash/system/ime_menu/ime_menu_tray.cc b/ash/system/ime_menu/ime_menu_tray.cc |
index bd845fac4c1a5e2a31fa5d0a1af64520421c88b8..1615c748e3e7bf35d31ca1a945dda19f0f5e815b 100644 |
--- a/ash/system/ime_menu/ime_menu_tray.cc |
+++ b/ash/system/ime_menu/ime_menu_tray.cc |
@@ -26,7 +26,6 @@ |
#include "base/metrics/histogram_macros.h" |
#include "base/strings/utf_string_conversions.h" |
#include "components/session_manager/session_manager_types.h" |
-#include "ui/base/ime/chromeos/input_method_manager.h" |
#include "ui/base/ime/ime_bridge.h" |
#include "ui/base/ime/text_input_client.h" |
#include "ui/base/l10n/l10n_util.h" |
@@ -292,15 +291,27 @@ ImeMenuTray::ImeMenuTray(Shelf* shelf) |
label_->SetElideBehavior(gfx::TRUNCATE); |
tray_container()->AddChildView(label_); |
SystemTrayNotifier* tray_notifier = Shell::Get()->system_tray_notifier(); |
- tray_notifier->AddIMEObserver(this); |
tray_notifier->AddVirtualKeyboardObserver(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); |
} |
ImeMenuTray::~ImeMenuTray() { |
if (bubble_) |
bubble_->bubble_view()->reset_delegate(); |
+ 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->RemoveVirtualKeyboardObserver(this); |
keyboard::KeyboardController* keyboard_controller = |
keyboard::KeyboardController::GetInstance(); |
@@ -442,7 +453,7 @@ bool ImeMenuTray::PerformAction(const ui::Event& event) { |
return true; |
} |
-void ImeMenuTray::OnIMERefresh() { |
+void ImeMenuTray::RefreshCurrentIme() { |
UpdateTrayLabel(); |
if (bubble_ && ime_list_view_) { |
IMEInfoList list = ime_util::GetAvailableIMEList(); |
@@ -452,7 +463,15 @@ void ImeMenuTray::OnIMERefresh() { |
} |
} |
-void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) { |
+// InputMethodManager::Observer: |
+void ImeMenuTray::InputMethodChanged(InputMethodManager* manager, |
+ Profile* profile, |
+ bool show_message) { |
+ RefreshCurrentIme(); |
+} |
+ |
+// InputMethodMenuManager::Observer: |
+void ImeMenuTray::ImeMenuActivationChanged(bool is_activated) { |
SetVisible(is_activated); |
if (is_activated) |
UpdateTrayLabel(); |
@@ -460,9 +479,20 @@ void ImeMenuTray::OnIMEMenuActivationChanged(bool is_activated) { |
HideImeMenuBubble(); |
} |
-void ImeMenuTray::BubbleViewDestroyed() { |
+void ImeMenuTray::ImeMenuListChanged() {} |
+ |
+void ImeMenuTray::ImeMenuItemsChanged( |
+ const std::string& engine_id, |
+ const std::vector<InputMethodManager::MenuItem>& items) {} |
+ |
+// ui::ime::InputMethodMenuManager::Observer: |
+void ImeMenuTray::InputMethodMenuItemChanged( |
+ ui::ime::InputMethodMenuManager* manager) { |
+ RefreshCurrentIme(); |
} |
+void ImeMenuTray::BubbleViewDestroyed() {} |
+ |
void ImeMenuTray::OnMouseEnteredView() {} |
void ImeMenuTray::OnMouseExitedView() {} |