diff options
author | rsadam <rsadam@chromium.org> | 2015-05-06 14:20:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-06 21:21:14 +0000 |
commit | b504002422fc21b01fee88d49e1f92b39f61e3c3 (patch) | |
tree | 3cecad3c0799b66cd57e97a75d9243ff5be3fcf3 | |
parent | bcad31300f5c56d4bc64de5b3c668e749634ecc0 (diff) | |
download | chromium_src-b504002422fc21b01fee88d49e1f92b39f61e3c3.zip chromium_src-b504002422fc21b01fee88d49e1f92b39f61e3c3.tar.gz chromium_src-b504002422fc21b01fee88d49e1f92b39f61e3c3.tar.bz2 |
Refactors experimental keyboard flags to use tristates.
BUG=485104
Review URL: https://codereview.chromium.org/1126233003
Cr-Commit-Position: refs/heads/master@{#328614}
-rw-r--r-- | chrome/app/generated_resources.grd | 18 | ||||
-rw-r--r-- | chrome/browser/about_flags.cc | 54 | ||||
-rw-r--r-- | tools/metrics/histograms/histograms.xml | 3 | ||||
-rw-r--r-- | ui/keyboard/keyboard_switches.cc | 15 | ||||
-rw-r--r-- | ui/keyboard/keyboard_switches.h | 28 | ||||
-rw-r--r-- | ui/keyboard/keyboard_util.cc | 18 |
6 files changed, 101 insertions, 35 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 05cd154..800e903 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -14481,23 +14481,23 @@ After you create a new supervised user, you can manage their settings at any tim <message name="IDS_FLAGS_FLOATING_VIRTUAL_KEYBOARD_DESCRIPTION" desc="Description of about::flags option to toggle floating virtual keyboard"> Enable/Disable floating virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_TYPING_NAME" desc="Name of about::flags option to enable gesture typing for the virtual keyboard"> + <message name="IDS_FLAGS_GESTURE_TYPING_NAME" desc="Name of about::flags option to toggle gesture typing for the virtual keyboard"> Gesture typing for the virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_TYPING_DESCRIPTION" desc="Description of about::flags option to enable gesture typing for the virtual keyboard"> - Enable gesture typing for the virtual keyboard. + <message name="IDS_FLAGS_GESTURE_TYPING_DESCRIPTION" desc="Description of about::flags option to toggle gesture typing for the virtual keyboard"> + Enable/Disable gesture typing for the virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_SELECTION_NAME" desc="Name of about::flags option to enable gesture selection for the virtual keyboard"> + <message name="IDS_FLAGS_GESTURE_SELECTION_NAME" desc="Name of about::flags option to enable gesture selection for the virtual keyboard"> Gesture selection for the virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_SELECTION_DESCRIPTION" desc="Description of about::flags option to enable gesture selection for the virtual keyboard"> - Enable gesture selection for the virtual keyboard. + <message name="IDS_FLAGS_GESTURE_SELECTION_DESCRIPTION" desc="Description of about::flags option to toggle gesture selection in the settings page for the virtual keyboard"> + Enable/Disable gesture selection option in the settings page for the virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_DELETION_NAME" desc="Name of about::flags option to enable gesture deletion for the virtual keyboard"> + <message name="IDS_FLAGS_GESTURE_DELETION_NAME" desc="Name of about::flags option to toggle gesture deletion for the virtual keyboard"> Gesture deletion for the virtual keyboard. </message> - <message name="IDS_FLAGS_ENABLE_GESTURE_DELETION_DESCRIPTION" desc="Description of about::flags option to enable gesture deletion for the virtual keyboard"> - Enable gesture deletion for the virtual keyboard. + <message name="IDS_FLAGS_GESTURE_DELETION_DESCRIPTION" desc="Description of about::flags option to toggle gesture deletion in the settings page for the virtual keyboard"> + Enable/Disable gesture deletion option in the settings page for the virtual keyboard. </message> <message name="IDS_FLAGS_DISABLE_CAPTIVE_PORTAL_BYPASS_PROXY_NAME" desc="Name of about::flags option to disable bypass proxy for captive portal authorization on Chrome OS."> Disable bypass proxy for Captive Portal Authorization diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 7ed8e62..201ebab 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -476,6 +476,36 @@ const Experiment::Choice kFloatingVirtualKeyboardChoices[] = { keyboard::switches::kFloatingVirtualKeyboard, keyboard::switches::kFloatingVirtualKeyboardEnabled}, }; + +const Experiment::Choice kGestureTypingChoices[] = { + { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, + { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, + keyboard::switches::kGestureTyping, + keyboard::switches::kGestureTypingDisabled}, + { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, + keyboard::switches::kGestureTyping, + keyboard::switches::kGestureTypingEnabled}, +}; + +const Experiment::Choice kGestureSelectionChoices[] = { + { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, + { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, + keyboard::switches::kGestureSelection, + keyboard::switches::kGestureSelectionDisabled}, + { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, + keyboard::switches::kGestureSelection, + keyboard::switches::kGestureSelectionEnabled}, +}; + +const Experiment::Choice kGestureDeletionChoices[] = { + { IDS_GENERIC_EXPERIMENT_CHOICE_DEFAULT, "", "" }, + { IDS_GENERIC_EXPERIMENT_CHOICE_DISABLED, + keyboard::switches::kGestureDeletion, + keyboard::switches::kGestureDeletionDisabled}, + { IDS_GENERIC_EXPERIMENT_CHOICE_ENABLED, + keyboard::switches::kGestureDeletion, + keyboard::switches::kGestureDeletionEnabled}, +}; #endif const Experiment::Choice kSupervisedUserSafeSitesChoices[] = { @@ -1451,25 +1481,25 @@ const Experiment kExperiments[] = { MULTI_VALUE_TYPE(kFloatingVirtualKeyboardChoices) }, { - "enable-gesture-typing", - IDS_FLAGS_ENABLE_GESTURE_TYPING_NAME, - IDS_FLAGS_ENABLE_GESTURE_TYPING_DESCRIPTION, + "gesture-typing", + IDS_FLAGS_GESTURE_TYPING_NAME, + IDS_FLAGS_GESTURE_TYPING_DESCRIPTION, kOsCrOS, - SINGLE_VALUE_TYPE(keyboard::switches::kEnableGestureTyping) + MULTI_VALUE_TYPE(kGestureTypingChoices) }, { - "enable-gesture-deletion", - IDS_FLAGS_ENABLE_GESTURE_DELETION_NAME, - IDS_FLAGS_ENABLE_GESTURE_DELETION_DESCRIPTION, + "gesture-selection", + IDS_FLAGS_GESTURE_SELECTION_NAME, + IDS_FLAGS_GESTURE_SELECTION_DESCRIPTION, kOsCrOS, - SINGLE_VALUE_TYPE(keyboard::switches::kEnableGestureDeletion) + MULTI_VALUE_TYPE(kGestureSelectionChoices) }, { - "enable-gesture-selection", - IDS_FLAGS_ENABLE_GESTURE_SELECTION_NAME, - IDS_FLAGS_ENABLE_GESTURE_SELECTION_DESCRIPTION, + "gesture-deletion", + IDS_FLAGS_GESTURE_DELETION_NAME, + IDS_FLAGS_GESTURE_DELETION_DESCRIPTION, kOsCrOS, - SINGLE_VALUE_TYPE(keyboard::switches::kEnableGestureSelection) + MULTI_VALUE_TYPE(kGestureDeletionChoices) }, { "disable-smart-virtual-keyboard", diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 5b849f9..8a25d23 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -55562,6 +55562,7 @@ To add a new entry, add it with any value and run test to compute valid value. <int value="-1349872906" label="disallow-autofill-sync-credential-for-reauth"/> <int value="-1349532167" label="enable-wifi-credential-sync"/> + <int value="-1346722635" label="gesture-selection"/> <int value="-1341092934" label="enable-accelerated-overflow-scroll"/> <int value="-1340055960" label="enable-streamlined-hosted-apps"/> <int value="-1334327410" label="ash-enable-touch-view-testing"/> @@ -55594,6 +55595,7 @@ To add a new entry, add it with any value and run test to compute valid value. <int value="-1052415111" label="malware-interstitial-v2"/> <int value="-1052219252" label="disable-captive-portal-bypass-proxy"/> <int value="-1022971520" label="enable-search-button-in-omnibox-for-str"/> + <int value="-1020450980" label="gesture-deletion"/> <int value="-996673716" label="enable-web-app-frame"/> <int value="-979057409" label="enable-seccomp-filter-sandbox"/> <int value="-979034258" label="disable-ntp-other-sessions-menu"/> @@ -55800,6 +55802,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="1181056275" label="enable-cloud-backup"/> <int value="1185424279" label="enable-media-router"/> + <int value="1192302892" label="gesture-typing"/> <int value="1196644408" label="performance-monitor-gathering"/> <int value="1196834473" label="disable-smart-virtual-keyboard"/> <int value="1205849612" label="enable-sync-synced-notifications"/> diff --git a/ui/keyboard/keyboard_switches.cc b/ui/keyboard/keyboard_switches.cc index d2a18f3..c020552 100644 --- a/ui/keyboard/keyboard_switches.cc +++ b/ui/keyboard/keyboard_switches.cc @@ -13,12 +13,21 @@ const char kDisableInputView[] = "disable-input-view"; const char kEnableInputView[] = "enable-input-view"; const char kEnableExperimentalInputViewFeatures[] = "enable-experimental-input-view-features"; -const char kEnableGestureTyping[] = "enable-gesture-typing"; -const char kEnableGestureSelection[] = "enable-gesture-selection"; -const char kEnableGestureDeletion[] = "enable-gesture-deletion"; const char kDisableVoiceInput[] = "disable-voice-input"; const char kDisableNewMDInputView[] = "disable-new-md-input-view"; +const char kGestureTyping[] = "gesture-typing"; +const char kGestureTypingEnabled[] = "enabled"; +const char kGestureTypingDisabled[] = "disabled"; + +const char kGestureSelection[] = "gesture-selection"; +const char kGestureSelectionEnabled[] = "enabled"; +const char kGestureSelectionDisabled[] = "disabled"; + +const char kGestureDeletion[] = "gesture-deletion"; +const char kGestureDeletionEnabled[] = "enabled"; +const char kGestureDeletionDisabled[] = "disabled"; + const char kEnableVirtualKeyboard[] = "enable-virtual-keyboard"; const char kFloatingVirtualKeyboard[] = "floating-virtual-keyboard"; const char kFloatingVirtualKeyboardDisabled[] ="disabled"; diff --git a/ui/keyboard/keyboard_switches.h b/ui/keyboard/keyboard_switches.h index bb4bc17..f036161 100644 --- a/ui/keyboard/keyboard_switches.h +++ b/ui/keyboard/keyboard_switches.h @@ -30,14 +30,32 @@ KEYBOARD_EXPORT extern const char kEnableInputView[]; // Enables experimental features for IME extensions. KEYBOARD_EXPORT extern const char kEnableExperimentalInputViewFeatures[]; -// Enables gesture typing for the virtual keyboard. -KEYBOARD_EXPORT extern const char kEnableGestureTyping[]; +// Gesture typing flag for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureTyping[]; // Enables gesture typing for the virtual keyboard. -KEYBOARD_EXPORT extern const char kEnableGestureSelection[]; +KEYBOARD_EXPORT extern const char kGestureTypingEnabled[]; -// Enables gesture typing for the virtual keyboard. -KEYBOARD_EXPORT extern const char kEnableGestureDeletion[]; +// Disables gesture typing for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureTypingDisabled[]; + +// Gesture selection for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureSelection[]; + +// Enables gesture selection for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureSelectionEnabled[]; + +// Disables gesture selection for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureSelectionDisabled[]; + +// Gesture deletion for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureDeletion[]; + +// Enables gesture deletion for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureDeletionEnabled[]; + +// Disables gesture deletion for the virtual keyboard. +KEYBOARD_EXPORT extern const char kGestureDeletionDisabled[]; // Enables the virtual keyboard. KEYBOARD_EXPORT extern const char kEnableVirtualKeyboard[]; diff --git a/ui/keyboard/keyboard_util.cc b/ui/keyboard/keyboard_util.cc index d861ad8..30e7ad4 100644 --- a/ui/keyboard/keyboard_util.cc +++ b/ui/keyboard/keyboard_util.cc @@ -164,18 +164,24 @@ bool IsFloatingVirtualKeyboardEnabled() { } bool IsGestureTypingEnabled() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableGestureTyping); + std::string keyboard_switch = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kGestureTyping); + return keyboard_switch == switches::kGestureTypingEnabled; } bool IsGestureSelectionEnabled() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableGestureSelection); + std::string keyboard_switch = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kGestureSelection); + return keyboard_switch == switches::kGestureSelectionEnabled; } bool IsGestureDeletionEnabled() { - return base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableGestureDeletion); + std::string keyboard_switch = + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( + switches::kGestureDeletion); + return keyboard_switch == switches::kGestureDeletionEnabled; } bool IsMaterialDesignEnabled() { |