| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_layout_manager.h" | 5 #include "ui/keyboard/keyboard_layout_manager.h" |
| 6 | 6 |
| 7 #include "ui/compositor/layer_animator.h" | 7 #include "ui/compositor/layer_animator.h" |
| 8 #include "ui/display/display.h" | 8 #include "ui/display/display.h" |
| 9 #include "ui/display/screen.h" | 9 #include "ui/display/screen.h" |
| 10 #include "ui/keyboard/keyboard_controller.h" | 10 #include "ui/keyboard/keyboard_controller.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } else if (controller_->keyboard_mode() == FLOATING) { | 37 } else if (controller_->keyboard_mode() == FLOATING) { |
| 38 controller_->GetContainerWindow()->SetBounds(child->bounds()); | 38 controller_->GetContainerWindow()->SetBounds(child->bounds()); |
| 39 SetChildBoundsDirect(keyboard_, gfx::Rect(child->bounds().size())); | 39 SetChildBoundsDirect(keyboard_, gfx::Rect(child->bounds().size())); |
| 40 } | 40 } |
| 41 } | 41 } |
| 42 | 42 |
| 43 void KeyboardLayoutManager::SetChildBounds(aura::Window* child, | 43 void KeyboardLayoutManager::SetChildBounds(aura::Window* child, |
| 44 const gfx::Rect& requested_bounds) { | 44 const gfx::Rect& requested_bounds) { |
| 45 DCHECK(child == keyboard_); | 45 DCHECK(child == keyboard_); |
| 46 | 46 |
| 47 TRACE_EVENT0("vk", "KeyboardLayoutSetChildBounds"); |
| 48 |
| 47 // Request to change the bounds of child window (AKA the virtual keyboard | 49 // Request to change the bounds of child window (AKA the virtual keyboard |
| 48 // window) should change the container window first. Then the child window is | 50 // window) should change the container window first. Then the child window is |
| 49 // resized and covers the container window. Note the child's bound is only set | 51 // resized and covers the container window. Note the child's bound is only set |
| 50 // in OnWindowResized. | 52 // in OnWindowResized. |
| 51 gfx::Rect new_bounds = requested_bounds; | 53 gfx::Rect new_bounds = requested_bounds; |
| 52 if (controller_->keyboard_mode() == FULL_WIDTH) { | 54 if (controller_->keyboard_mode() == FULL_WIDTH) { |
| 53 const gfx::Rect& window_bounds = | 55 const gfx::Rect& window_bounds = |
| 54 controller_->GetContainerWindow()->GetRootWindow()->bounds(); | 56 controller_->GetContainerWindow()->GetRootWindow()->bounds(); |
| 55 new_bounds.set_y(window_bounds.height() - new_bounds.height()); | 57 new_bounds.set_y(window_bounds.height() - new_bounds.height()); |
| 56 // If shelf is positioned on the left side of screen, x is not 0. In | 58 // If shelf is positioned on the left side of screen, x is not 0. In |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 // keyboard window is resized even if keyboard is hidden. | 102 // keyboard window is resized even if keyboard is hidden. |
| 101 if (controller_->keyboard_visible()) | 103 if (controller_->keyboard_visible()) |
| 102 controller_->NotifyKeyboardBoundsChanging(new_bounds); | 104 controller_->NotifyKeyboardBoundsChanging(new_bounds); |
| 103 } else if (controller_->keyboard_mode() == FLOATING) { | 105 } else if (controller_->keyboard_mode() == FLOATING) { |
| 104 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); | 106 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); |
| 105 } | 107 } |
| 106 } | 108 } |
| 107 } | 109 } |
| 108 | 110 |
| 109 } // namespace keyboard | 111 } // namespace keyboard |
| OLD | NEW |