Chromium Code Reviews| Index: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| diff --git a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| index 2fd3d3f74625a7ff65c66fd7f1dc518d52bc18c6..83e770f0d2a0880d6caf07d2a0746661a0bbbbed 100644 |
| --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| @@ -362,6 +362,11 @@ ImeMenuTray::~ImeMenuTray() { |
| SystemTrayNotifier* tray_notifier = WmShell::Get()->system_tray_notifier(); |
| tray_notifier->RemoveIMEObserver(this); |
| tray_notifier->RemoveVirtualKeyboardObserver(this); |
| + keyboard::KeyboardController* keyboard_controller = |
| + keyboard::KeyboardController::GetInstance(); |
| + if (keyboard_controller) { |
| + keyboard_controller->RemoveObserver(this); |
| + } |
| } |
| void ImeMenuTray::ShowImeMenuBubble() { |
| @@ -433,7 +438,13 @@ void ImeMenuTray::ShowKeyboardWithKeyset(const std::string& keyset) { |
| show_keyboard_ = true; |
| if (keyboard_controller) { |
| keyboard_controller->AddObserver(this); |
| - keyboard_controller->ShowKeyboard(false); |
| + // If the keyboard window hasn't been created yet, it means the extension |
| + // cannot receive anything to show the keyboard. Therefore, instead of |
| + // relying the extension to show the keyboard, forcibly show the keyboard |
| + // window here (which will cause the keyboard window created). |
|
bshe
2016/12/29 19:22:15
The comment here is not very clear. It looks like
Azure Wei
2017/01/03 03:37:40
Updated the comment here.
|
| + if (!keyboard_controller->IsKeyboardWindowCreated()) { |
| + keyboard_controller->ShowKeyboard(false); |
| + } |
| return; |
| } |
| @@ -549,6 +560,11 @@ void ImeMenuTray::OnKeyboardBoundsChanging(const gfx::Rect& new_bounds) {} |
| void ImeMenuTray::OnKeyboardClosed() { |
| if (InputMethodManager::Get()) |
| InputMethodManager::Get()->OverrideKeyboardUrlRef(std::string()); |
| + keyboard::KeyboardController* keyboard_controller = |
| + keyboard::KeyboardController::GetInstance(); |
| + if (keyboard_controller) |
| + keyboard_controller->RemoveObserver(this); |
| + |
| show_keyboard_ = false; |
| force_show_keyboard_ = false; |
| } |