Chromium Code Reviews| Index: ui/keyboard/keyboard_controller.cc |
| diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc |
| index c948ca04beee84730d823e4ac4c436f2de71a76a..686f6bb9d582c88b51c684f3f4eeab8eaf8b8674 100644 |
| --- a/ui/keyboard/keyboard_controller.cc |
| +++ b/ui/keyboard/keyboard_controller.cc |
| @@ -141,6 +141,14 @@ aura::Window* KeyboardController::GetContainerWindow() { |
| return container_; |
| } |
| +void KeyboardController::AddObserver(Observer* observer) { |
| + observer_list_.AddObserver(observer); |
| +} |
| + |
| +void KeyboardController::RemoveObserver(Observer* observer) { |
| + observer_list_.RemoveObserver(observer); |
| +} |
| + |
| void KeyboardController::OnWindowParentChanged(aura::Window* window, |
| aura::Window* parent) { |
| OnTextInputStateChanged(proxy_->GetInputMethod()->GetTextInputClient()); |
| @@ -156,6 +164,7 @@ void KeyboardController::OnTextInputStateChanged( |
| if (!container_) |
| return; |
| + bool was_showing = container_->IsVisible(); |
| if (!client || client->GetTextInputType() == ui::TEXT_INPUT_TYPE_NONE) { |
| container_->Hide(); |
| } else { |
| @@ -168,6 +177,17 @@ void KeyboardController::OnTextInputStateChanged( |
| container_->parent()->StackChildAtTop(container_); |
| container_->Show(); |
| } |
| + bool is_showing = container_->IsVisible(); |
| + |
| + if (was_showing != is_showing) { |
| + FOR_EACH_OBSERVER( |
| + Observer, |
| + observer_list_, |
| + OnKeyboardBoundsChanged( |
| + is_showing ? container_->children()[0]->bounds() : |
| + gfx::Rect(0, 0, 0, 0))); |
|
sadrul
2013/04/26 02:54:16
just gfx::Rect()
bryeung
2013/04/26 13:44:50
Oh, that's nicer. Thanks!
|
| + } |
| + |
| // TODO(bryeung): whenever the TextInputClient changes we need to notify the |
| // keyboard (with the TextInputType) so that it can reset it's state (e.g. |
| // abandon compositions in progress) |