| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/keyboard/keyboard_controller.h" | 5 #include "ui/keyboard/keyboard_controller.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 container_->SetName("KeyboardContainer"); | 214 container_->SetName("KeyboardContainer"); |
| 215 container_->set_owned_by_parent(false); | 215 container_->set_owned_by_parent(false); |
| 216 container_->Init(ui::LAYER_NOT_DRAWN); | 216 container_->Init(ui::LAYER_NOT_DRAWN); |
| 217 container_->AddObserver(this); | 217 container_->AddObserver(this); |
| 218 container_->SetLayoutManager(new KeyboardLayoutManager(this)); | 218 container_->SetLayoutManager(new KeyboardLayoutManager(this)); |
| 219 container_->AddPreTargetHandler(&event_filter_); | 219 container_->AddPreTargetHandler(&event_filter_); |
| 220 } | 220 } |
| 221 return container_.get(); | 221 return container_.get(); |
| 222 } | 222 } |
| 223 | 223 |
| 224 aura::Window* KeyboardController::GetContainerWindowWithoutCreationForTest() { |
| 225 return container_.get(); |
| 226 } |
| 227 |
| 224 void KeyboardController::NotifyKeyboardBoundsChanging( | 228 void KeyboardController::NotifyKeyboardBoundsChanging( |
| 225 const gfx::Rect& new_bounds) { | 229 const gfx::Rect& new_bounds) { |
| 226 current_keyboard_bounds_ = new_bounds; | 230 current_keyboard_bounds_ = new_bounds; |
| 227 if (ui_->HasKeyboardWindow() && ui_->GetKeyboardWindow()->IsVisible()) { | 231 if (ui_->HasKeyboardWindow() && ui_->GetKeyboardWindow()->IsVisible()) { |
| 228 for (KeyboardControllerObserver& observer : observer_list_) | 232 for (KeyboardControllerObserver& observer : observer_list_) |
| 229 observer.OnKeyboardBoundsChanging(new_bounds); | 233 observer.OnKeyboardBoundsChanging(new_bounds); |
| 230 if (keyboard::IsKeyboardOverscrollEnabled()) | 234 if (keyboard::IsKeyboardOverscrollEnabled()) |
| 231 ui_->InitInsets(new_bounds); | 235 ui_->InitInsets(new_bounds); |
| 232 else | 236 else |
| 233 ui_->ResetInsets(); | 237 ui_->ResetInsets(); |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 518 int keyboard_height = GetContainerWindow()->bounds().height(); | 522 int keyboard_height = GetContainerWindow()->bounds().height(); |
| 519 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); | 523 const gfx::Rect& root_bounds = container_->GetRootWindow()->bounds(); |
| 520 gfx::Rect new_bounds = root_bounds; | 524 gfx::Rect new_bounds = root_bounds; |
| 521 new_bounds.set_y(root_bounds.height() - keyboard_height); | 525 new_bounds.set_y(root_bounds.height() - keyboard_height); |
| 522 new_bounds.set_height(keyboard_height); | 526 new_bounds.set_height(keyboard_height); |
| 523 GetContainerWindow()->SetBounds(new_bounds); | 527 GetContainerWindow()->SetBounds(new_bounds); |
| 524 } | 528 } |
| 525 } | 529 } |
| 526 | 530 |
| 527 } // namespace keyboard | 531 } // namespace keyboard |
| OLD | NEW |