Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2115)

Unified Diff: ash/common/system/chromeos/ime_menu/ime_menu_tray.cc

Issue 2603663002: Make IME extensions decide when to show the keyboard. (Closed)
Patch Set: Addressed comments. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_manager_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..db6d2a0a6d772bcb04292a40f902ad5ffbadc3ff 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,10 @@ 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() {
@@ -447,7 +451,14 @@ 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 to be created).
+ // Otherwise, the extension will show keyboard by calling private api. The
+ // native side could just skip showing the keyboard.
+ if (!keyboard_controller->IsKeyboardWindowCreated())
+ keyboard_controller->ShowKeyboard(false);
return;
}
@@ -563,6 +574,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;
}
« no previous file with comments | « no previous file | chrome/browser/chromeos/input_method/input_method_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698