Skip to content

Commit

Permalink
Move smart deploy to tristate.
Browse files Browse the repository at this point in the history
BUG=

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

Cr-Commit-Position: refs/heads/master@{#333058}
  • Loading branch information
rsadam authored and Commit bot committed Jun 5, 2015
1 parent a3f1ea0 commit 318530d
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 19 deletions.
3 changes: 1 addition & 2 deletions ash/virtual_keyboard_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ bool IsSmartVirtualKeyboardEnabled() {
keyboard::switches::kEnableVirtualKeyboard)) {
return false;
}
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
keyboard::switches::kDisableSmartVirtualKeyboard);
return keyboard::IsSmartDeployEnabled();
}

} // namespace
Expand Down
4 changes: 2 additions & 2 deletions ash/virtual_keyboard_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ class VirtualKeyboardControllerTest : public AshTestBase {
}

void SetUp() override {
base::CommandLine::ForCurrentProcess()->AppendSwitch(
keyboard::switches::kDisableSmartVirtualKeyboard);
base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
keyboard::switches::kSmartVirtualKeyboard, "disabled");
AshTestBase::SetUp();
UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
UpdateTouchscreenDevices(std::vector<ui::TouchscreenDevice>());
Expand Down
8 changes: 4 additions & 4 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -14289,11 +14289,11 @@ After you create a new supervised user, you can manage their settings at any tim
</message>

<if expr="chromeos">
<message name="IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn off smart deployment of the virtual keyboard.">
Disable Smart Virtual Keyboard
<message name="IDS_FLAGS_SMART_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to toggle smart deployment of the virtual keyboard.">
Smart Deployment of the Virtual Keyboard
</message>
<message name="IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_DESCRIPTION" desc="Description of about:flags option to turn off smart deployment of the virtual keyboard">
Disable smart deployment of the virtual keyboard.
<message name="IDS_FLAGS_SMART_VIRTUAL_KEYBOARD_DESCRIPTION" desc="Description of about:flags option to turn off smart deployment of the virtual keyboard">
Enable/Disable smart deployment of the virtual keyboard.
</message>

<message name="IDS_FLAGS_ENABLE_VIRTUAL_KEYBOARD_NAME" desc="Name of about:flags option to turn on the virtual keyboard">
Expand Down
24 changes: 17 additions & 7 deletions chrome/browser/about_flags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ const Experiment::Choice kFloatingVirtualKeyboardChoices[] = {
keyboard::switches::kFloatingVirtualKeyboardEnabled},
};

const Experiment::Choice kSmartVirtualKeyboardChoices[] = {
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
keyboard::switches::kSmartVirtualKeyboard,
keyboard::switches::kSmartVirtualKeyboardDisabled},
{ IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED,
keyboard::switches::kSmartVirtualKeyboard,
keyboard::switches::kSmartVirtualKeyboardEnabled},
};

const Experiment::Choice kGestureTypingChoices[] = {
{ IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" },
{ IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED,
Expand Down Expand Up @@ -1401,6 +1411,13 @@ const Experiment kExperiments[] = {
kOsCrOS,
MULTI_VALUE_TYPE(kFloatingVirtualKeyboardChoices)
},
{
"smart-virtual-keyboard",
IDS_FLAGS_SMART_VIRTUAL_KEYBOARD_NAME,
IDS_FLAGS_SMART_VIRTUAL_KEYBOARD_DESCRIPTION,
kOsCrOS,
MULTI_VALUE_TYPE(kSmartVirtualKeyboardChoices)
},
{
"gesture-typing",
IDS_FLAGS_GESTURE_TYPING_NAME,
Expand All @@ -1415,13 +1432,6 @@ const Experiment kExperiments[] = {
kOsCrOS,
MULTI_VALUE_TYPE(kGestureEditingChoices)
},
{
"disable-smart-virtual-keyboard",
IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_NAME,
IDS_FLAGS_DISABLE_SMART_VIRTUAL_KEYBOARD_DESCRIPTION,
kOsCrOS,
SINGLE_VALUE_TYPE(keyboard::switches::kDisableSmartVirtualKeyboard)
},
#endif
{
"enable-simple-cache-backend",
Expand Down
1 change: 1 addition & 0 deletions tools/metrics/histograms/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -58245,6 +58245,7 @@ To add a new entry, add it with any value and run test to compute valid value.
<int value="-2063014275" label="enable-web-bluetooth"/>
<int value="-2047822258" label="enable-avfoundation"/>
<int value="-2025367104" label="enable-material-design-ntp"/>
<int value="-2020721975" label="smart-virtual-keyboard"/>
<int value="-2020024440" label="scroll-end-effect"/>
<int value="-2017953534" label="enable-hosted-app-shim-creation"/>
<int value="-2008272679" label="disable-webrtc-hw-encoding"/>
Expand Down
5 changes: 4 additions & 1 deletion ui/keyboard/keyboard_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard";
const char kFloatingVirtualKeyboard[] = "floating-virtual-keyboard";
const char kFloatingVirtualKeyboardDisabled[] ="disabled";
const char kFloatingVirtualKeyboardEnabled[] ="enabled";
const char kDisableSmartVirtualKeyboard[] = "disable-smart-virtual-keyboard";

const char kSmartVirtualKeyboard[] = "smart-virtual-keyboard";
const char kSmartVirtualKeyboardDisabled[] = "disabled";
const char kSmartVirtualKeyboardEnabled[] = "enabled";

const char kDisableVirtualKeyboardOverscroll[] =
"disable-virtual-keyboard-overscroll";
Expand Down
12 changes: 9 additions & 3 deletions ui/keyboard/keyboard_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,15 @@ KEYBOARD_EXPORT extern const char kDisableVirtualKeyboardOverscroll[];
// to provide access to content that would otherwise be occluded.
KEYBOARD_EXPORT extern const char kEnableVirtualKeyboardOverscroll[];

// Disable automatic showing/hiding of the keyboard based on the devices plugged
// in.
KEYBOARD_EXPORT extern const char kDisableSmartVirtualKeyboard[];
// Controls automatic showing/hiding of the keyboard based on the devices
// plugged in.
KEYBOARD_EXPORT extern const char kSmartVirtualKeyboard[];

// Enables smart deploy for the virtual keyboard.
KEYBOARD_EXPORT extern const char kSmartVirtualKeyboardEnabled[];

// Disables smart deploy for the virtual keyboard.
KEYBOARD_EXPORT extern const char kSmartVirtualKeyboardDisabled[];

} // namespace switches
} // namespace keyboard
Expand Down
7 changes: 7 additions & 0 deletions ui/keyboard/keyboard_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ bool IsGestureEditingEnabled() {
return keyboard_switch != switches::kGestureEditingDisabled;
}

bool IsSmartDeployEnabled() {
std::string keyboard_switch =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kSmartVirtualKeyboard);
return keyboard_switch != switches::kSmartVirtualKeyboardDisabled;
}

bool IsMaterialDesignEnabled() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableNewMDInputView);
Expand Down
3 changes: 3 additions & 0 deletions ui/keyboard/keyboard_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ KEYBOARD_EXPORT std::string GetKeyboardLayout();
// Returns true if the virtual keyboard is enabled.
KEYBOARD_EXPORT bool IsKeyboardEnabled();

// Returns true if smart deployment of the virtual keyboard is enabled.
KEYBOARD_EXPORT bool IsSmartDeployEnabled();

// Returns true if keyboard overscroll mode is enabled.
KEYBOARD_EXPORT bool IsKeyboardOverscrollEnabled();

Expand Down

0 comments on commit 318530d

Please sign in to comment.