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 66d9e2918dcd57b6d46023decf14dd3d9e805554..8ce5f398cb3237adc168514dd1791e9253aaf605 100644 |
| --- a/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| +++ b/ash/common/system/chromeos/ime_menu/ime_menu_tray.cc |
| @@ -363,6 +363,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); |
| + } |
|
stevenjb
2017/01/06 16:59:39
nit: no {}
Azure Wei
2017/01/07 07:03:32
Done.
|
| } |
| void ImeMenuTray::ShowImeMenuBubble() { |
| @@ -447,7 +452,15 @@ 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). |
|
stevenjb
2017/01/06 16:59:39
window to be created
Azure Wei
2017/01/07 07:03:32
Done.
|
| + // Otherwise, the extension will show keyboard by calling private api. The |
| + // native side could just skip to show keyboard. |
|
stevenjb
2017/01/06 16:59:39
skip showing the keyboard
Azure Wei
2017/01/07 07:03:32
Done.
|
| + if (!keyboard_controller->IsKeyboardWindowCreated()) { |
| + keyboard_controller->ShowKeyboard(false); |
| + } |
|
stevenjb
2017/01/06 16:59:39
nit: no {}
Azure Wei
2017/01/07 07:03:32
Done.
|
| return; |
| } |
| @@ -563,6 +576,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; |
| } |