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

Unified Diff: ui/keyboard/keyboard_controller.cc

Issue 487253003: Keep virtual keyboard visibility the same after enable an IME in a different extension (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit and rebase Created 6 years, 4 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 | « ui/keyboard/keyboard_controller.h ('k') | ui/keyboard/keyboard_layout_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/keyboard/keyboard_controller.cc
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 029a5a43d4b1b6d68eec05dd36221290907ce83c..02bd0b7b8a0e5ab01b56bde82e02c2dc0b529576 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -206,6 +206,7 @@ class WindowBoundsChangeObserver : public aura::WindowObserver {
virtual void OnWindowBoundsChanged(aura::Window* window,
const gfx::Rect& old_bounds,
const gfx::Rect& new_bounds) OVERRIDE;
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
};
void WindowBoundsChangeObserver::OnWindowBoundsChanged(aura::Window* window,
@@ -215,6 +216,11 @@ void WindowBoundsChangeObserver::OnWindowBoundsChanged(aura::Window* window,
controller->UpdateWindowInsets(window);
}
+void WindowBoundsChangeObserver::OnWindowDestroyed(aura::Window* window) {
+ if (window->HasObserver(this))
+ window->RemoveObserver(this);
+}
+
// static
KeyboardController* KeyboardController::instance_ = NULL;
@@ -288,7 +294,10 @@ void KeyboardController::NotifyKeyboardBoundsChanging(
// the render process crashed.
if (view) {
aura::Window *window = view->GetNativeView();
- if (window != keyboard_window &&
+ // If virtual keyboard failed to load, a widget that displays error
+ // message will be created and adds as a child of the virtual keyboard
+ // window. We want to avoid add BoundsChangedObserver to that window.
+ if (GetFrameWindow(window) != keyboard_window &&
window->GetRootWindow() == root_window) {
gfx::Rect window_bounds = window->GetBoundsInScreen();
gfx::Rect intersect = gfx::IntersectRects(window_bounds,
@@ -360,8 +369,12 @@ void KeyboardController::OnWindowHierarchyChanged(
}
void KeyboardController::Reload() {
- if (proxy_->HasKeyboardWindow())
+ if (proxy_->HasKeyboardWindow()) {
+ // A reload should never try to show virtual keyboard. If keyboard is not
+ // visible before reload, it should keep invisible after reload.
+ show_on_resize_ = false;
proxy_->ReloadKeyboardIfNeeded();
+ }
}
void KeyboardController::OnTextInputStateChanged(
@@ -453,8 +466,12 @@ void KeyboardController::ShowKeyboardInternal() {
proxy_->ReloadKeyboardIfNeeded();
- if (keyboard_visible_ || proxy_->GetKeyboardWindow()->bounds().height() == 0)
+ if (keyboard_visible_) {
return;
+ } else if (proxy_->GetKeyboardWindow()->bounds().height() == 0) {
+ show_on_resize_ = true;
+ return;
+ }
keyboard_visible_ = true;
« no previous file with comments | « ui/keyboard/keyboard_controller.h ('k') | ui/keyboard/keyboard_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698