Index: ui/keyboard/keyboard_controller.cc |
diff --git a/ui/keyboard/keyboard_controller.cc b/ui/keyboard/keyboard_controller.cc |
index de8bcbede5c901a4e74957ae062b0b8b1685d146..90439615e13b26dcbec5e497f58a64130549af65 100644 |
--- a/ui/keyboard/keyboard_controller.cc |
+++ b/ui/keyboard/keyboard_controller.cc |
@@ -22,6 +22,7 @@ |
#include "ui/base/ime/text_input_client.h" |
#include "ui/compositor/layer_animation_observer.h" |
#include "ui/compositor/scoped_layer_animation_settings.h" |
+#include "ui/display/display.h" |
#include "ui/gfx/geometry/rect.h" |
#include "ui/gfx/path.h" |
#include "ui/gfx/skia_util.h" |
@@ -165,8 +166,10 @@ void CallbackAnimationObserver::OnLayerAnimationAborted( |
// static |
KeyboardController* KeyboardController::instance_ = NULL; |
-KeyboardController::KeyboardController(KeyboardUI* ui) |
+KeyboardController::KeyboardController(KeyboardUI* ui, |
+ KeyboardLayoutDelegate* delegate) |
: ui_(ui), |
+ layout_delegate_(delegate), |
input_method_(NULL), |
keyboard_visible_(false), |
show_on_resize_(false), |
@@ -295,7 +298,12 @@ void KeyboardController::SetKeyboardMode(KeyboardMode mode) { |
void KeyboardController::ShowKeyboard(bool lock) { |
set_lock_keyboard(lock); |
- ShowKeyboardInternal(); |
+ ShowKeyboardInternal(display::Display::kInvalidDisplayID); |
+} |
+ |
+void KeyboardController::ShowKeyboardInSpecificDisplay(int64_t display_id) { |
+ set_lock_keyboard(true); |
+ ShowKeyboardInternal(display_id); |
} |
void KeyboardController::OnWindowHierarchyChanged( |
@@ -392,11 +400,13 @@ void KeyboardController::OnInputMethodDestroyed( |
} |
void KeyboardController::OnShowImeIfNeeded() { |
- if (IsKeyboardEnabled()) |
- ShowKeyboardInternal(); |
+ // Calling |ShowKeyboardInternal| may cause the movement of the keyboard to |
+ // another display. |
+ if (IsKeyboardEnabled() && !get_lock_keyboard()) |
+ ShowKeyboardInternal(display::Display::kInvalidDisplayID); |
} |
-void KeyboardController::ShowKeyboardInternal() { |
+void KeyboardController::ShowKeyboardInternal(int64_t display_id) { |
if (!container_.get()) |
return; |
@@ -410,6 +420,10 @@ void KeyboardController::ShowKeyboardInternal() { |
ui_->ReloadKeyboardIfNeeded(); |
+ if (layout_delegate_ != nullptr) { |
+ layout_delegate_->MoveKeyboardToAnotherDisplayIfNeeded(display_id); |
+ } |
oshima
2016/11/08 17:26:05
nuke {}
yhanada
2016/11/14 22:48:47
Done.
|
+ |
if (keyboard_visible_) { |
return; |
} else if (ui_->GetKeyboardWindow()->bounds().height() == 0) { |