Skip to content

Commit 468feb5

Browse files
author
wutao
committed
cros: Convert switch to Feature for KSV
This cl converts the Keyboard Shortcut Viewer (KSV) switch to a base::Feature which is enabled by default. [email protected] Bug: 768932, 778874 Test: the feature works properly Change-Id: I38517d3084f2f493c822d3c435101525d2c98839 Reviewed-on: https://chromium-review.googlesource.com/946550 Reviewed-by: Mitsuru Oshima <[email protected]> Commit-Queue: Tao Wu <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#540584}(cherry picked from commit 40de263) Reviewed-on: https://chromium-review.googlesource.com/952169 Reviewed-by: Tao Wu <[email protected]> Cr-Commit-Position: refs/branch-heads/3359@{#56} Cr-Branched-From: 66afc5e-refs/heads/master@{#540276}
1 parent af09015 commit 468feb5

File tree

7 files changed

+21
-15
lines changed

7 files changed

+21
-15
lines changed

ash/public/cpp/ash_features.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ namespace features {
1010
const base::Feature kDockedMagnifier{"DockedMagnifier",
1111
base::FEATURE_ENABLED_BY_DEFAULT};
1212

13+
const base::Feature kKeyboardShortcutViewer{"KeyboardShortcutViewer",
14+
base::FEATURE_ENABLED_BY_DEFAULT};
15+
1316
const base::Feature kSystemTrayUnified{"SystemTrayUnified",
1417
base::FEATURE_DISABLED_BY_DEFAULT};
1518

1619
bool IsDockedMagnifierEnabled() {
1720
return base::FeatureList::IsEnabled(kDockedMagnifier);
1821
}
1922

23+
bool IsKeyboardShortcutViewerEnabled() {
24+
return base::FeatureList::IsEnabled(kKeyboardShortcutViewer);
25+
}
26+
2027
bool IsSystemTrayUnifiedEnabled() {
2128
return base::FeatureList::IsEnabled(kSystemTrayUnified);
2229
}

ash/public/cpp/ash_features.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,18 @@ namespace features {
1616
// https://crbug.com/709824.
1717
ASH_PUBLIC_EXPORT extern const base::Feature kDockedMagnifier;
1818

19+
// Enables the keyboard shortcut viewer.
20+
// TODO(wutao): Remove this after the feature is fully launched.
21+
// https://crbug.com/755448.
22+
ASH_PUBLIC_EXPORT extern const base::Feature kKeyboardShortcutViewer;
23+
1924
// Enables new system menu.
2025
ASH_PUBLIC_EXPORT extern const base::Feature kSystemTrayUnified;
2126

2227
ASH_PUBLIC_EXPORT bool IsDockedMagnifierEnabled();
2328

29+
ASH_PUBLIC_EXPORT bool IsKeyboardShortcutViewerEnabled();
30+
2431
ASH_PUBLIC_EXPORT bool IsSystemTrayUnifiedEnabled();
2532

2633
} // namespace features

ash/public/cpp/ash_switches.cc

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,6 @@ const char kAshEnableV1AppBackButton[] = "ash-enable-v1-app-back-button";
5252
const char kAshEnableDisplayMoveWindowAccels[] =
5353
"ash-enable-display-move-window-accels";
5454

55-
// Enables keyboard shortcut viewer.
56-
// TODO(wutao): Remove this once the feature is launched. crbug.com/768932.
57-
const char kAshEnableKeyboardShortcutViewer[] =
58-
"ash-enable-keyboard-shortcut-viewer";
59-
6055
// Enables key bindings to scroll magnified screen.
6156
const char kAshEnableMagnifierKeyScroller[] =
6257
"ash-enable-magnifier-key-scroller";

ash/public/cpp/ash_switches.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ ASH_PUBLIC_EXPORT extern const char kAshDisableTrilinearFiltering[];
2727
ASH_PUBLIC_EXPORT extern const char kAshDisableTouchExplorationMode[];
2828
ASH_PUBLIC_EXPORT extern const char kAshEnableV1AppBackButton[];
2929
ASH_PUBLIC_EXPORT extern const char kAshEnableDisplayMoveWindowAccels[];
30-
ASH_PUBLIC_EXPORT extern const char kAshEnableKeyboardShortcutViewer[];
3130
ASH_PUBLIC_EXPORT extern const char kAshEnableMagnifierKeyScroller[];
3231
ASH_PUBLIC_EXPORT extern const char kAshEnableNewOverviewAnimations[];
3332
ASH_PUBLIC_EXPORT extern const char kAshEnableNewOverviewUi[];

chrome/browser/about_flags.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3430,8 +3430,7 @@ const FeatureEntry kFeatureEntries[] = {
34303430
flag_descriptions::kEnableManualFallbacksFillingName,
34313431
flag_descriptions::kEnableManualFallbacksFillingDescription,
34323432
kOsDesktop | kOsAndroid,
3433-
FEATURE_VALUE_TYPE(
3434-
password_manager::features::kManualFallbacksFilling)},
3433+
FEATURE_VALUE_TYPE(password_manager::features::kManualFallbacksFilling)},
34353434

34363435
#if !defined(OS_ANDROID)
34373436
{"voice-search-on-local-ntp", flag_descriptions::kVoiceSearchOnLocalNtpName,
@@ -3619,7 +3618,7 @@ const FeatureEntry kFeatureEntries[] = {
36193618
{"ash-enable-keyboard-shortcut-viewer",
36203619
flag_descriptions::kAshEnableKeyboardShortcutViewerName,
36213620
flag_descriptions::kAshEnableKeyboardShortcutViewerDescription, kOsCrOS,
3622-
SINGLE_VALUE_TYPE(ash::switches::kAshEnableKeyboardShortcutViewer)},
3621+
FEATURE_VALUE_TYPE(ash::features::kKeyboardShortcutViewer)},
36233622

36243623
{"ash-disable-login-dim-and-blur",
36253624
flag_descriptions::kAshDisableLoginDimAndBlurName,

chrome/browser/ui/ash/chrome_new_window_client.cc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "chrome/browser/ui/ash/chrome_new_window_client.h"
66

77
#include "ash/content/keyboard_overlay/keyboard_overlay_view.h"
8-
#include "ash/public/cpp/ash_switches.h"
8+
#include "ash/public/cpp/ash_features.h"
99
#include "ash/public/interfaces/constants.mojom.h"
1010
#include "base/macros.h"
1111
#include "chrome/browser/chromeos/file_manager/app_id.h"
@@ -216,10 +216,8 @@ void ChromeNewWindowClient::RestoreTab() {
216216

217217
// TODO(crbug.com/755448): Remove this when the new shortcut viewer is enabled.
218218
void ChromeNewWindowClient::ShowKeyboardOverlay() {
219-
// TODO(wutao): It is only for cl reviewers to test the new shortcut viewer
220-
// and will be removed when the new shortcut viewer is enabled.
221-
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
222-
ash::switches::kAshEnableKeyboardShortcutViewer)) {
219+
// Show the new keyboard shortcut viewer if the feature is enabled.
220+
if (ash::features::IsKeyboardShortcutViewerEnabled()) {
223221
keyboard_shortcut_viewer_util::ShowKeyboardShortcutViewer();
224222
return;
225223
}

tools/metrics/histograms/enums.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25849,6 +25849,7 @@ from previous Chrome versions.
2584925849
<int value="-1469536698" label="ChromeHomeDoodle:enabled"/>
2585025850
<int value="-1469228683" label="QuickUnlockPinSignin:disabled"/>
2585125851
<int value="-1468126425" label="ResourceLoadScheduler:disabled"/>
25852+
<int value="-1467642274" label="KeyboardShortcutViewer:disabled"/>
2585225853
<int value="-1467332609" label="tab-management-experiment-type-anise"/>
2585325854
<int value="-1466990325" label="CrosCompUpdates:enabled"/>
2585425855
<int value="-1466759286" label="TabModalJsDialog:disabled"/>
@@ -26156,7 +26157,6 @@ from previous Chrome versions.
2615626157
<int value="-723224470" label="enable-password-force-saving:enabled"/>
2615726158
<int value="-722474177" label="browser-side-navigation:disabled"/>
2615826159
<int value="-718626298" label="SysInternals:enabled"/>
26159-
<int value="-717281513" label="ash-enable-keyboard-shortcut-viewer"/>
2616026160
<int value="-716953514" label="disable-password-separated-signin-flow"/>
2616126161
<int value="-715733307" label="force-effective-connection-type"/>
2616226162
<int value="-714712077" label="ClickToOpenPDFPlaceholder:disabled"/>
@@ -26169,6 +26169,7 @@ from previous Chrome versions.
2616926169
<int value="-704232562" label="UseMonitorColorSpace:enabled"/>
2617026170
<int value="-702477233" label="ContentFullscreen:enabled"/>
2617126171
<int value="-699767107" label="enable-sync-app-list"/>
26172+
<int value="-699198009" label="KeyboardShortcutViewer:enabled"/>
2617226173
<int value="-697751423" label="disable-quickoffice-component-app"/>
2617326174
<int value="-684900739" label="disable-merge-key-char-events"/>
2617426175
<int value="-684223908" label="enable-android-wallpapers-app"/>

0 commit comments

Comments
 (0)