summaryrefslogtreecommitdiffstats
path: root/ui/keyboard
diff options
context:
space:
mode:
authorsadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-04 00:33:26 +0000
committersadrul@chromium.org <sadrul@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-04 00:33:26 +0000
commitde1c79497381ede8638df4953abcc7c6d0304ad2 (patch)
tree8acb04bbd36da22de0f81a396e3b251bf60d7b80 /ui/keyboard
parentf723c122d6858b7b481698531bf30ee0cfba72ae (diff)
downloadchromium_src-de1c79497381ede8638df4953abcc7c6d0304ad2.zip
chromium_src-de1c79497381ede8638df4953abcc7c6d0304ad2.tar.gz
chromium_src-de1c79497381ede8638df4953abcc7c6d0304ad2.tar.bz2
keyboard: Override OnWindowHierarchyChanged instead of OnWindowParentChanged.
Calling OnTextInputStateChanged can change the window hierarchy of the keyboard window or its container window. Doing this while the hierarchy is already in the process of changing (in OnWindowParentChanged override) can cause unpredictable behaviour. BUG=none R=sky@chromium.org Review URL: https://codereview.chromium.org/14772014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/keyboard')
-rw-r--r--ui/keyboard/keyboard_controller.cc7
-rw-r--r--ui/keyboard/keyboard_controller.h4
2 files changed, 6 insertions, 5 deletions
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc
index 17f4fdd..79acecc 100644
--- a/ui/keyboard/keyboard_controller.cc
+++ b/ui/keyboard/keyboard_controller.cc
@@ -150,9 +150,10 @@ void KeyboardController::RemoveObserver(KeyboardControllerObserver* observer) {
observer_list_.RemoveObserver(observer);
}
-void KeyboardController::OnWindowParentChanged(aura::Window* window,
- aura::Window* parent) {
- OnTextInputStateChanged(proxy_->GetInputMethod()->GetTextInputClient());
+void KeyboardController::OnWindowHierarchyChanged(
+ const HierarchyChangeParams& params) {
+ if (params.new_parent && params.target == container_)
+ OnTextInputStateChanged(proxy_->GetInputMethod()->GetTextInputClient());
}
void KeyboardController::OnWindowDestroying(aura::Window* window) {
diff --git a/ui/keyboard/keyboard_controller.h b/ui/keyboard/keyboard_controller.h
index cb21b1d..6022339 100644
--- a/ui/keyboard/keyboard_controller.h
+++ b/ui/keyboard/keyboard_controller.h
@@ -51,8 +51,8 @@ class KEYBOARD_EXPORT KeyboardController : public ui::InputMethodObserver,
friend class KeyboardControllerTest;
// aura::WindowObserver overrides
- virtual void OnWindowParentChanged(aura::Window* window,
- aura::Window* parent) OVERRIDE;
+ virtual void OnWindowHierarchyChanged(
+ const HierarchyChangeParams& params) OVERRIDE;
virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
// InputMethodObserver overrides