Commit 47e23d2c authored by rsadam's avatar rsadam Committed by Commit bot

Turns on smart deployment of the virtual keyboard by default, and changes the

flag to allow easy disabling of this feature.

BUG=441814

Review URL: https://codereview.chromium.org/800933002

Cr-Commit-Position: refs/heads/master@{#308373}
parent 56332e21
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "ash/test/status_area_widget_test_helper.h" #include "ash/test/status_area_widget_test_helper.h"
#include "ash/test/virtual_keyboard_test_helper.h" #include "ash/test/virtual_keyboard_test_helper.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "ui/keyboard/keyboard_switches.h"
#include "ui/keyboard/keyboard_util.h" #include "ui/keyboard/keyboard_util.h"
namespace ash { namespace ash {
...@@ -76,8 +75,6 @@ void TrayKeyboardLockTest::TearDownViews() { ...@@ -76,8 +75,6 @@ void TrayKeyboardLockTest::TearDownViews() {
} }
void TrayKeyboardLockTest::SetUp() { void TrayKeyboardLockTest::SetUp() {
CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kAutoVirtualKeyboard);
test::AshTestBase::SetUp(); test::AshTestBase::SetUp();
SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget()); SetUpForStatusAreaWidget(StatusAreaWidgetTestHelper::GetStatusAreaWidget());
} }
......
...@@ -19,6 +19,15 @@ ...@@ -19,6 +19,15 @@
#include "ui/keyboard/keyboard_util.h" #include "ui/keyboard/keyboard_util.h"
namespace ash { namespace ash {
namespace {
// Checks whether smart deployment is enabled.
bool IsSmartVirtualKeyboardEnabled() {
return !CommandLine::ForCurrentProcess()->HasSwitch(
keyboard::switches::kDisableSmartVirtualKeyboard);
}
} // namespace
VirtualKeyboardController::VirtualKeyboardController() VirtualKeyboardController::VirtualKeyboardController()
: has_external_keyboard_(false), : has_external_keyboard_(false),
...@@ -36,17 +45,13 @@ VirtualKeyboardController::~VirtualKeyboardController() { ...@@ -36,17 +45,13 @@ VirtualKeyboardController::~VirtualKeyboardController() {
} }
void VirtualKeyboardController::OnMaximizeModeStarted() { void VirtualKeyboardController::OnMaximizeModeStarted() {
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!IsSmartVirtualKeyboardEnabled())
keyboard::switches::kAutoVirtualKeyboard)) {
SetKeyboardEnabled(true); SetKeyboardEnabled(true);
}
} }
void VirtualKeyboardController::OnMaximizeModeEnded() { void VirtualKeyboardController::OnMaximizeModeEnded() {
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!IsSmartVirtualKeyboardEnabled())
keyboard::switches::kAutoVirtualKeyboard)) {
SetKeyboardEnabled(false); SetKeyboardEnabled(false);
}
} }
void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() { void VirtualKeyboardController::OnTouchscreenDeviceConfigurationChanged() {
...@@ -87,8 +92,7 @@ void VirtualKeyboardController::UpdateDevices() { ...@@ -87,8 +92,7 @@ void VirtualKeyboardController::UpdateDevices() {
} }
void VirtualKeyboardController::UpdateKeyboardEnabled() { void VirtualKeyboardController::UpdateKeyboardEnabled() {
if (!CommandLine::ForCurrentProcess()->HasSwitch( if (!IsSmartVirtualKeyboardEnabled()) {
keyboard::switches::kAutoVirtualKeyboard)) {
SetKeyboardEnabled(Shell::GetInstance() SetKeyboardEnabled(Shell::GetInstance()
->maximize_mode_controller() ->maximize_mode_controller()
->IsMaximizeModeWindowManagerEnabled()); ->IsMaximizeModeWindowManagerEnabled());
......
...@@ -40,6 +40,8 @@ class VirtualKeyboardControllerTest : public AshTestBase { ...@@ -40,6 +40,8 @@ class VirtualKeyboardControllerTest : public AshTestBase {
} }
void SetUp() override { void SetUp() override {
CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kDisableSmartVirtualKeyboard);
AshTestBase::SetUp(); AshTestBase::SetUp();
UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>()); UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
...@@ -70,9 +72,11 @@ class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest, ...@@ -70,9 +72,11 @@ class VirtualKeyboardControllerAutoTest : public VirtualKeyboardControllerTest,
~VirtualKeyboardControllerAutoTest() override {} ~VirtualKeyboardControllerAutoTest() override {}
void SetUp() override { void SetUp() override {
CommandLine::ForCurrentProcess()->AppendSwitch( AshTestBase::SetUp();
keyboard::switches::kAutoVirtualKeyboard); // Set the current list of devices to empty so that they don't interfere
VirtualKeyboardControllerTest::SetUp(); // with the test.
UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver( Shell::GetInstance()->system_tray_notifier()->AddVirtualKeyboardObserver(
this); this);
} }
......
...@@ -14121,11 +14121,11 @@ Do you accept? ...@@ -14121,11 +14121,11 @@ Do you accept?
</message> </message>
<if expr="chromeos"> <if expr="chromeos">
<message name="IDS_FLAGS_AUTO_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn on automatic deployment of the virtual keyboard."> <message name="IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn off smart deployment of the virtual keyboard.">
Auto Virtual Keyboard Disable Smart Virtual Keyboard
</message> </message>
<message name="IDS_FLAGS_AUTO_VIRTUAL_KEYBOARD_DESCRIPTION" desc="Description of about:flags option to turn on automatic deployment of the virtual keyboard"> <message name="IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_DESCRIPTION" desc="Description of about:flags option to turn off smart deployment of the virtual keyboard">
Enable automatic deployment of the virtual keyboard. Disable smart deployment of the virtual keyboard.
</message> </message>
<message name="IDS_FLAGS_ENABLE_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn on the virtual keyboard"> <message name="IDS_FLAGS_ENABLE_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn on the virtual keyboard">
......
...@@ -1271,11 +1271,11 @@ const Experiment kExperiments[] = { ...@@ -1271,11 +1271,11 @@ const Experiment kExperiments[] = {
SINGLE_VALUE_TYPE(keyboard::switches::kEnableExperimentalInputViewFeatures) SINGLE_VALUE_TYPE(keyboard::switches::kEnableExperimentalInputViewFeatures)
}, },
{ {
"auto-virtual-keyboard", "disable-smart-virtual-keyboard",
IDS_FLAGS_AUTO_VIRTUAL_KEYBOARD_NAME, IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_NAME,
IDS_FLAGS_AUTO_VIRTUAL_KEYBOARD_DESCRIPTION, IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_DESCRIPTION,
kOsCrOS, kOsCrOS,
SINGLE_VALUE_TYPE(keyboard::switches::kAutoVirtualKeyboard) SINGLE_VALUE_TYPE(keyboard::switches::kDisableSmartVirtualKeyboard)
}, },
#endif #endif
{ {
......
...@@ -49620,6 +49620,7 @@ To add a new entry, add it with any value and run test to compute valid value. ...@@ -49620,6 +49620,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="1163255347" label="ash-enable-touch-view-touch-feedback"/> <int value="1163255347" label="ash-enable-touch-view-touch-feedback"/>
<int value="1181056275" label="enable-cloud-backup"/> <int value="1181056275" label="enable-cloud-backup"/>
<int value="1196644408" label="performance-monitor-gathering"/> <int value="1196644408" label="performance-monitor-gathering"/>
<int value="1196834473" label="disable-smart-virtual-keyboard"/>
<int value="1205849612" label="enable-sync-synced-notifications"/> <int value="1205849612" label="enable-sync-synced-notifications"/>
<int value="1210343926" label="enable-drop-sync-credential"/> <int value="1210343926" label="enable-drop-sync-credential"/>
<int value="1220464509" label="enable-first-run-ui-transitions"/> <int value="1220464509" label="enable-first-run-ui-transitions"/>
...@@ -15,7 +15,7 @@ const char kEnableExperimentalInputViewFeatures[] = ...@@ -15,7 +15,7 @@ const char kEnableExperimentalInputViewFeatures[] =
"enable-experimental-input-view-features"; "enable-experimental-input-view-features";
const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard"; const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard";
const char kAutoVirtualKeyboard[] = "auto-virtual-keyboard"; const char kDisableSmartVirtualKeyboard[] = "disable-smart-virtual-keyboard";
const char kDisableVirtualKeyboardOverscroll[] = const char kDisableVirtualKeyboardOverscroll[] =
"disable-virtual-keyboard-overscroll"; "disable-virtual-keyboard-overscroll";
......
...@@ -36,9 +36,9 @@ KEYBOARD_EXPORT extern const char kDisableVirtualKeyboardOverscroll[]; ...@@ -36,9 +36,9 @@ KEYBOARD_EXPORT extern const char kDisableVirtualKeyboardOverscroll[];
// to provide access to content that would otherwise be occluded. // to provide access to content that would otherwise be occluded.
KEYBOARD_EXPORT extern const char kEnableVirtualKeyboardOverscroll[]; KEYBOARD_EXPORT extern const char kEnableVirtualKeyboardOverscroll[];
// Enable automatic showing/hiding of the keyboard based on the devices plugged // Disable automatic showing/hiding of the keyboard based on the devices plugged
// in. // in.
KEYBOARD_EXPORT extern const char kAutoVirtualKeyboard[]; KEYBOARD_EXPORT extern const char kDisableSmartVirtualKeyboard[];
} // namespace switches } // namespace switches
} // namespace keyboard } // namespace keyboard
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment