Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: ui/keyboard/keyboard_layout_manager.cc

Issue 2546963002: Do not move the on-screen keyboard to another display after loading an IME. (Closed)
Patch Set: rebase Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/keyboard/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 switch to an IME in a
88 // different extension.
89 const int64_t display_id =
90 display::Screen::GetScreen()
91 ->GetDisplayNearestWindow(controller_->GetContainerWindow())
92 .id();
93 controller_->ShowKeyboardInDisplay(display_id);
94 } else {
95 controller_->ShowKeyboard(false /* lock */);
96 }
85 } else { 97 } else {
86 if (controller_->keyboard_mode() == FULL_WIDTH) { 98 if (controller_->keyboard_mode() == FULL_WIDTH) {
87 // We need to send out this notification only if keyboard is visible since 99 // We need to send out this notification only if keyboard is visible since
88 // keyboard window is resized even if keyboard is hidden. 100 // keyboard window is resized even if keyboard is hidden.
89 if (controller_->keyboard_visible()) 101 if (controller_->keyboard_visible())
90 controller_->NotifyKeyboardBoundsChanging(requested_bounds); 102 controller_->NotifyKeyboardBoundsChanging(requested_bounds);
91 } else if (controller_->keyboard_mode() == FLOATING) { 103 } else if (controller_->keyboard_mode() == FLOATING) {
92 controller_->NotifyKeyboardBoundsChanging(gfx::Rect()); 104 controller_->NotifyKeyboardBoundsChanging(gfx::Rect());
93 } 105 }
94 } 106 }
95 } 107 }
96 108
97 } // namespace keyboard 109 } // namespace keyboard
OLDNEW
« no previous file with comments | « ui/keyboard/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698