Chromium Code Reviews| 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" | |
| 9 #include "ui/display/screen.h" | |
| 8 #include "ui/keyboard/keyboard_controller.h" | 10 #include "ui/keyboard/keyboard_controller.h" |
| 9 #include "ui/keyboard/keyboard_util.h" | 11 #include "ui/keyboard/keyboard_util.h" |
| 10 | 12 |
| 11 namespace keyboard { | 13 namespace keyboard { |
| 12 | 14 |
| 13 // Overridden from aura::LayoutManager | 15 // Overridden from aura::LayoutManager |
| 14 void KeyboardLayoutManager::OnWindowResized() { | 16 void KeyboardLayoutManager::OnWindowResized() { |
| 15 if (keyboard_) { | 17 if (keyboard_) { |
| 16 // Container window is the top level window of the virtual keyboard window. | 18 // Container window is the top level window of the virtual keyboard window. |
| 17 // To support window.moveTo for the virtual keyboard window, as it actually | 19 // To support window.moveTo for the virtual keyboard window, as it actually |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 animator->StopAnimating(); | 76 animator->StopAnimating(); |
| 75 | 77 |
| 76 controller_->GetContainerWindow()->SetBounds(new_bounds); | 78 controller_->GetContainerWindow()->SetBounds(new_bounds); |
| 77 SetChildBoundsDirect(keyboard_, gfx::Rect(new_bounds.size())); | 79 SetChildBoundsDirect(keyboard_, gfx::Rect(new_bounds.size())); |
| 78 | 80 |
| 79 if (old_bounds.height() == 0 && child->bounds().height() != 0 && | 81 if (old_bounds.height() == 0 && child->bounds().height() != 0 && |
| 80 controller_->show_on_resize()) { | 82 controller_->show_on_resize()) { |
| 81 // The window height is set to 0 initially or before switch to an IME in a | 83 // The window height is set to 0 initially or before switch to an IME in a |
| 82 // different extension. Virtual keyboard window may wait for this bounds | 84 // different extension. Virtual keyboard window may wait for this bounds |
| 83 // change to correctly animate in. | 85 // change to correctly animate in. |
| 84 controller_->ShowKeyboard(controller_->keyboard_locked()); | 86 if (controller_->keyboard_locked()) { |
| 87 // Do not move the keyboard to another display after loading an IME. | |
|
bshe
2016/12/14 16:18:28
nit: loading an IME/switch to an IME in a differen
yhanada
2016/12/15 01:10:20
Done.
| |
| 88 const int64_t display_id = | |
| 89 display::Screen::GetScreen() | |
| 90 ->GetDisplayNearestWindow(controller_->GetContainerWindow()) | |
| 91 .id(); | |
| 92 controller_->ShowKeyboardInDisplay(display_id); | |
| 93 } else { | |
| 94 controller_->ShowKeyboard(false /* lock */); | |
| 95 } | |
| 85 } else { | 96 } else { |
| 86 if (controller_->keyboard_mode() == FULL_WIDTH) { | 97 if (controller_->keyboard_mode() == FULL_WIDTH) { |
| 87 // We need to send out this notification only if keyboard is visible since | 98 // We need to send out this notification only if keyboard is visible since |
| 88 // keyboard window is resized even if keyboard is hidden. | 99 // keyboard window is resized even if keyboard is hidden. |
| 89 if (controller_->keyboard_visible()) | 100 if (controller_->keyboard_visible()) |
| 90 controller_->NotifyKeyboardBoundsChanging(requested_bounds); | 101 controller_->NotifyKeyboardBoundsChanging(requested_bounds); |
| 91 } else if (controller_->keyboard_mode() == FLOATING) { | 102 } else if (controller_->keyboard_mode() == FLOATING) { |
| 92 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); | 103 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); |
| 93 } | 104 } |
| 94 } | 105 } |
| 95 } | 106 } |
| 96 | 107 |
| 97 } // namespace keyboard | 108 } // namespace keyboard |
| OLD | NEW |