| Index: ui/keyboard/keyboard_ui.cc
|
| diff --git a/ui/keyboard/keyboard_ui.cc b/ui/keyboard/keyboard_ui.cc
|
| index 2da1729ae363981011a2481c52ab92538a92a760..e1b70491a8b7d9c122803653c8238b253c6f0de8 100644
|
| --- a/ui/keyboard/keyboard_ui.cc
|
| +++ b/ui/keyboard/keyboard_ui.cc
|
| @@ -4,9 +4,11 @@
|
|
|
| #include "ui/keyboard/keyboard_ui.h"
|
|
|
| +#include "base/command_line.h"
|
| #include "ui/aura/window.h"
|
| #include "ui/base/ime/input_method.h"
|
| #include "ui/base/ime/text_input_client.h"
|
| +#include "ui/base/ui_base_switches.h"
|
| #include "ui/keyboard/keyboard_controller.h"
|
|
|
| namespace keyboard {
|
| @@ -29,10 +31,22 @@ void KeyboardUI::HideKeyboardContainer(aura::Window* container) {
|
| }
|
|
|
| void KeyboardUI::EnsureCaretInWorkArea() {
|
| - if (GetInputMethod()->GetTextInputClient()) {
|
| - aura::Window* keyboard_window = GetKeyboardWindow();
|
| - GetInputMethod()->GetTextInputClient()->EnsureCaretOutOfRect(
|
| - keyboard_window->GetBoundsInScreen());
|
| + if (GetInputMethod()) {
|
| + const aura::Window* keyboard_window = GetKeyboardWindow();
|
| +
|
| + // Use new virtual keyboard behavior only if the flag enabled and in
|
| + // non-sticky mode.
|
| + const bool new_vk_behavior =
|
| + (base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| + ::switches::kUseNewVirtualKeyboardBehavior) &&
|
| + !keyboard::KeyboardController::GetInstance()->keyboard_locked());
|
| +
|
| + if (new_vk_behavior) {
|
| + GetInputMethod()->SetCoveredBounds(keyboard_window->GetBoundsInScreen());
|
| + } else if (GetInputMethod()->GetTextInputClient()) {
|
| + GetInputMethod()->GetTextInputClient()->EnsureCaretOutOfRect(
|
| + keyboard_window->GetBoundsInScreen());
|
| + }
|
| }
|
| }
|
|
|
|
|