0

Remove kImprovedKeyboardShortcuts and kShortcutCustomization flag

Bug: 1179893
Test: no functional change. All tests should still pass.

Change-Id: I99bd5f4d428b5db30e27eec7badead4851691cf3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6046082
Reviewed-by: David Padlipsky <dpad@google.com>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Alex Gough <ajgo@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1399452}
This commit is contained in:
Mitsuru Oshima
2024-12-20 17:55:01 -08:00
committed by Chromium LUCI CQ
parent 396bcadaae
commit 5218f8ca11
28 changed files with 51 additions and 338 deletions

@ -1608,11 +1608,6 @@ TEST_F(AcceleratorControllerTest, GlobalAcceleratorsToggleQuickSettings) {
}
TEST_F(AcceleratorControllerTest, ToggleMultitaskMenu) {
// Accelerators behind a flag should also be accompanied by the
// `kShortcutCustomization` to support dynamic accelerator registration.
base::test::ScopedFeatureList scoped_feature_list(
::features::kShortcutCustomization);
// Simulate fake user login to ensure pref registration is done correctly.
SimulateUserLogin("fakeuser");
// Enabling `kShortcutCustomization` will start letting
@ -2888,9 +2883,6 @@ class AcceleratorControllerImprovedKeyboardShortcutsTest
};
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kImprovedKeyboardShortcuts);
// Setup our own |InputMethodManager| to test that the accelerator
// controller respects ArePositionalShortcutsUsedByCurrentInputMethod value
// from the |InputMethodManager|.
@ -2914,9 +2906,6 @@ class AcceleratorControllerImprovedKeyboardShortcutsTest
protected:
raw_ptr<TestInputMethodManager, DanglingUntriaged> input_method_manager_ =
nullptr; // Not owned.
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(AcceleratorControllerImprovedKeyboardShortcutsTest, InputMethodChanged) {
@ -2955,9 +2944,6 @@ class AcceleratorControllerInputMethodTest : public AcceleratorControllerTest {
};
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kImprovedKeyboardShortcuts);
// Setup the mock input method to capture the calls to
// |CancelCompositionAfterAccelerator|. Ownersship is passed to
// ui::SetUpInputMethodForTesting().
@ -2969,9 +2955,6 @@ class AcceleratorControllerInputMethodTest : public AcceleratorControllerTest {
protected:
raw_ptr<AcceleratorMockInputMethod, DanglingUntriaged> mock_input_ =
nullptr; // Not owned.
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
// In some layouts positional accelerators can be on dead/compose keys. To
@ -2996,37 +2979,6 @@ TEST_F(AcceleratorControllerInputMethodTest, AcceleratorClearsComposition) {
EXPECT_EQ(1u, mock_input_->cancel_composition_call_count);
}
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
class AcceleratorControllerDeprecatedTest : public AcceleratorControllerTest {
public:
AcceleratorControllerDeprecatedTest() = default;
~AcceleratorControllerDeprecatedTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndDisableFeature(
::features::kImprovedKeyboardShortcuts);
AcceleratorControllerTest::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
TEST_F(AcceleratorControllerDeprecatedTest, DeskShortcuts_Old) {
// The shortcuts are Search+Shift+[MINUS|PLUS], but due to event
// rewriting they became Shift+[F11|F12]. So only the rewritten shortcut
// works but the "real" shortcut doesn't.
EXPECT_TRUE(controller_->IsRegistered(
ui::Accelerator(ui::VKEY_F12, ui::EF_SHIFT_DOWN)));
EXPECT_TRUE(controller_->IsRegistered(
ui::Accelerator(ui::VKEY_F11, ui::EF_SHIFT_DOWN)));
EXPECT_FALSE(controller_->IsRegistered(ui::Accelerator(
ui::VKEY_OEM_PLUS, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN)));
EXPECT_FALSE(controller_->IsRegistered(ui::Accelerator(
ui::VKEY_OEM_MINUS, ui::EF_COMMAND_DOWN | ui::EF_SHIFT_DOWN)));
}
// defines a class to test the behavior of deprecated accelerators.
class DeprecatedAcceleratorTester : public AcceleratorControllerTest {
public:
@ -3096,9 +3048,6 @@ TEST_F(DeprecatedAcceleratorTester, TestDeprecatedAcceleratorsBehavior) {
}
TEST_F(DeprecatedAcceleratorTester, NoNotificationIfReplacementMissing) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(::features::kShortcutCustomization);
// Remove the replacements for all deprecated accelerators.
Shell::Get()->ash_accelerator_configuration()->RemoveAccelerator(
AcceleratorAction::kShowShortcutViewer,
@ -3206,9 +3155,6 @@ class MagnifiersAcceleratorsTester : public AcceleratorControllerTest {
// Create user session and simulate its login.
SimulateUserLogin(kUserEmail);
}
protected:
base::test::ScopedFeatureList feature_list_;
};
// TODO (afakhry): Remove this class after refactoring MagnificationManager.

@ -13,10 +13,8 @@
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/memory/raw_ptr.h"
#include "base/test/scoped_feature_list.h"
#include "device/udev_linux/fake_udev_loader.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/devices/device_data_manager_test_api.h"
#include "ui/events/devices/input_device.h"
#include "ui/events/devices/keyboard_device.h"
@ -98,8 +96,6 @@ class AcceleratorLookupTest : public AshTestBase {
~AcceleratorLookupTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kShortcutCustomization);
AshTestBase::SetUp();
config_ = Shell::Get()->ash_accelerator_configuration();
accelerator_lookup_ = Shell::Get()->accelerator_lookup();
@ -112,7 +108,6 @@ class AcceleratorLookupTest : public AshTestBase {
}
protected:
base::test::ScopedFeatureList scoped_feature_list_;
raw_ptr<AshAcceleratorConfiguration> config_;
raw_ptr<AcceleratorLookup> accelerator_lookup_;
};

@ -101,9 +101,7 @@ bool AcceleratorPrefs::IsCustomizationAllowed() {
if (IsUserEnterpriseManaged() && IsCustomizationPolicySet()) {
return IsCustomizationAllowedByPolicy();
}
// If user is not managed or the policy is unset, check the flag.
return ::features::IsShortcutCustomizationEnabled();
return true;
}
} // namespace ash

@ -6,7 +6,6 @@
#include "ash/session/session_controller_impl.h"
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
#include "testing/gtest/include/gtest/gtest.h"
@ -33,13 +32,8 @@ class AcceleratorPrefsTest : public AshTestBase {
~AcceleratorPrefsTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kShortcutCustomization);
AshTestBase::SetUp();
}
protected:
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(AcceleratorPrefsTest, PrefsAreRegisitered) {

@ -160,8 +160,6 @@ class AshAcceleratorConfigurationTest : public AshTestBase {
~AshAcceleratorConfigurationTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kShortcutCustomization);
AshTestBase::SetUp();
config_ = std::make_unique<AshAcceleratorConfiguration>();
config_->AddObserver(&observer_);
@ -2595,8 +2593,7 @@ TEST_F(AshAcceleratorConfigurationTest, SwitchUserPrefsAreSeparate) {
TEST_F(AshAcceleratorConfigurationTest, PrefsResetWithFlag) {
scoped_feature_list_.Reset();
scoped_feature_list_.InitWithFeatures(
/*enabled_features=*/{::features::kShortcutCustomization,
features::kResetShortcutCustomizations},
/*enabled_features=*/{features::kResetShortcutCustomizations},
/*disabled_features=*/{});
SimulateNewUserFirstLogin(kFakeUserEmail);
const AcceleratorData test_data[] = {

@ -63,10 +63,9 @@ ShortcutInputHandler::~ShortcutInputHandler() {
void ShortcutInputHandler::Initialize() {
CHECK(Shell::Get());
if (!features::IsPeripheralCustomizationEnabled() &&
!::features::IsShortcutCustomizationEnabled()) {
if (!features::IsPeripheralCustomizationEnabled()) {
LOG(ERROR) << "ShortcutInputHandler can only be initialized if "
<< "shortcut or peripherals customization flags are enabled.";
<< "peripherals customization flag is enabled.";
return;
}

@ -109,14 +109,11 @@ void EventRewriterControllerImpl::Initialize(
std::unique_ptr<PeripheralCustomizationEventRewriter>
peripheral_customization_event_rewriter;
if (features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled()) {
peripheral_customization_event_rewriter =
std::make_unique<PeripheralCustomizationEventRewriter>(
Shell::Get()->input_device_settings_controller());
peripheral_customization_event_rewriter_ =
peripheral_customization_event_rewriter.get();
}
peripheral_customization_event_rewriter =
std::make_unique<PeripheralCustomizationEventRewriter>(
Shell::Get()->input_device_settings_controller());
peripheral_customization_event_rewriter_ =
peripheral_customization_event_rewriter.get();
std::unique_ptr<PrerewrittenEventForwarder> prerewritten_event_forwarder =
std::make_unique<PrerewrittenEventForwarder>();
@ -167,10 +164,7 @@ void EventRewriterControllerImpl::Initialize(
Shell::Get()->keyboard_capability(),
ash::input_method::InputMethodManager::Get()->GetImeKeyboard()));
}
if (features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled()) {
AddEventRewriter(std::move(peripheral_customization_event_rewriter));
}
AddEventRewriter(std::move(peripheral_customization_event_rewriter));
AddEventRewriter(std::move(prerewritten_event_forwarder));
// Accessibility rewriter is applied between modifier event rewriters and
// EventRewriterAsh. Specifically, Search modifier is captured by the

@ -1365,9 +1365,6 @@ PeripheralCustomizationEventRewriter::RewriteMouseEvent(
ui::EventDispatchDetails PeripheralCustomizationEventRewriter::RewriteEvent(
const ui::Event& event,
const Continuation continuation) {
DCHECK(features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled());
if (event.IsMouseWheelEvent()) {
return RewriteMouseWheelEvent(*event.AsMouseWheelEvent(), continuation);
}

@ -7,7 +7,6 @@
#include <memory>
#include "ash/test/ash_test_base.h"
#include "base/test/scoped_feature_list.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event.h"
#include "ui/events/test/test_event_rewriter_continuation.h"
@ -88,8 +87,6 @@ class PrerewrittenEventForwarderTest : public AshTestBase {
// testing::Test:
void SetUp() override {
AshTestBase::SetUp();
scoped_feature_list_.InitWithFeatures({features::kShortcutCustomization},
{});
observer_ = std::make_unique<TestKeyObserver>();
rewriter_ = std::make_unique<PrerewrittenEventForwarder>();
rewriter_->AddObserver(observer_.get());
@ -99,14 +96,12 @@ class PrerewrittenEventForwarderTest : public AshTestBase {
rewriter_->RemoveObserver(observer_.get());
rewriter_.reset();
observer_.reset();
scoped_feature_list_.Reset();
AshTestBase::TearDown();
}
protected:
std::unique_ptr<TestKeyObserver> observer_;
std::unique_ptr<PrerewrittenEventForwarder> rewriter_;
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(PrerewrittenEventForwarderTest, InitializationTest) {

@ -798,8 +798,7 @@ Shell::~Shell() {
}
RemovePreTargetHandler(system_gesture_filter_.get());
RemoveAccessibilityEventHandler(mouse_cursor_filter_.get());
if (features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled()) {
if (features::IsPeripheralCustomizationEnabled()) {
RemovePreTargetHandler(shortcut_input_handler_.get());
}
RemovePreTargetHandler(modality_filter_.get());
@ -1659,8 +1658,7 @@ void Shell::Init(
modality_filter_ = std::make_unique<SystemModalContainerEventFilter>(this);
AddPreTargetHandler(modality_filter_.get());
if (features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled()) {
if (features::IsPeripheralCustomizationEnabled()) {
shortcut_input_handler_ = std::make_unique<ShortcutInputHandler>();
AddPreTargetHandler(shortcut_input_handler_.get());
}

@ -45,10 +45,6 @@ std::vector<mojom::StandardAcceleratorPropertiesPtr> GetAcceleratorsForActionId(
} // namespace
AcceleratorFetcher::AcceleratorFetcher() {
if (!::features::IsShortcutCustomizationEnabled()) {
return;
}
if (Shell::HasInstance()) {
Shell::Get()
->accelerator_controller()
@ -61,10 +57,6 @@ AcceleratorFetcher::AcceleratorFetcher() {
}
AcceleratorFetcher::~AcceleratorFetcher() {
if (!::features::IsShortcutCustomizationEnabled()) {
return;
}
if (Shell::HasInstance()) {
Shell::Get()
->accelerator_controller()
@ -75,7 +67,6 @@ AcceleratorFetcher::~AcceleratorFetcher() {
void AcceleratorFetcher::BindInterface(
mojo::PendingReceiver<common::mojom::AcceleratorFetcher> receiver) {
CHECK(::features::IsShortcutCustomizationEnabled());
if (accelerator_fetcher_receiver_.is_bound()) {
accelerator_fetcher_receiver_.reset();
}

@ -79,8 +79,7 @@ class AcceleratorFetcherTest : public AshTestBase {
public:
AcceleratorFetcherTest() {
scoped_feature_list_.InitWithFeatures({features::kPeripheralCustomization,
features::kInputDeviceSettingsSplit,
::features::kShortcutCustomization},
features::kInputDeviceSettingsSplit},
{});
}

@ -46,7 +46,6 @@ ShortcutInputProvider::~ShortcutInputProvider() {
void ShortcutInputProvider::BindInterface(
mojo::PendingReceiver<common::mojom::ShortcutInputProvider> receiver) {
CHECK(features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled() ||
::features::IsAccessibilityFaceGazeEnabled());
if (shortcut_input_receiver_.is_bound()) {
shortcut_input_receiver_.reset();

@ -39,7 +39,6 @@
#include "base/test/bind.h"
#include "base/test/metrics/histogram_tester.h"
#include "base/test/metrics/user_action_tester.h"
#include "base/test/scoped_feature_list.h"
#include "chromeos/ash/components/test/ash_test_suite.h"
#include "device/udev_linux/fake_udev_loader.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
@ -51,7 +50,6 @@
#include "ui/base/ime/ash/mock_input_method_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/ash/keyboard_capability.h"
#include "ui/events/devices/device_data_manager_test_api.h"
#include "ui/events/devices/input_device.h"
@ -362,10 +360,6 @@ class AcceleratorConfigurationProviderTest : public AshTestBase {
// AshTestBase:
void SetUp() override {
scoped_feature_list_.InitWithFeatures(
{::features::kImprovedKeyboardShortcuts,
::features::kShortcutCustomization},
{});
input_method_manager_ = new TestInputMethodManager();
input_method::InputMethodManager::Initialize(input_method_manager_);
@ -475,7 +469,6 @@ class AcceleratorConfigurationProviderTest : public AshTestBase {
std::unique_ptr<AcceleratorConfigurationProvider> provider_;
NonConfigurableActionsMap non_configurable_actions_map_;
base::test::ScopedFeatureList scoped_feature_list_;
// Test global singleton. Delete is handled by InputMethodManager::Shutdown().
raw_ptr<TestInputMethodManager, DanglingUntriaged> input_method_manager_;
std::unique_ptr<FakeDeviceManager> fake_keyboard_manager_;

@ -4779,10 +4779,6 @@ const FeatureEntry kFeatureEntries[] = {
{"instant-tethering", flag_descriptions::kTetherName,
flag_descriptions::kTetherDescription, kOsCrOS,
FEATURE_VALUE_TYPE(ash::features::kInstantTethering)},
{"improved-keyboard-shortcuts",
flag_descriptions::kImprovedKeyboardShortcutsName,
flag_descriptions::kImprovedKeyboardShortcutsDescription, kOsCrOS,
FEATURE_VALUE_TYPE(features::kImprovedKeyboardShortcuts)},
{"deprecate-alt-click", flag_descriptions::kDeprecateAltClickName,
flag_descriptions::kDeprecateAltClickDescription, kOsCrOS,
FEATURE_VALUE_TYPE(features::kDeprecateAltClick)},
@ -7919,11 +7915,6 @@ const FeatureEntry kFeatureEntries[] = {
flag_descriptions::kEnableOAuthIppDescription, kOsCrOS,
FEATURE_VALUE_TYPE(ash::features::kEnableOAuthIpp)},
{"enable-shortcut-customization",
flag_descriptions::kEnableShortcutCustomizationName,
flag_descriptions::kEnableShortcutCustomizationDescription, kOsCrOS,
FEATURE_VALUE_TYPE(features::kShortcutCustomization)},
{"enable-search-customizable-shortcuts-in-launcher",
flag_descriptions::kEnableSearchCustomizableShortcutsInLauncherName,
flag_descriptions::kEnableSearchCustomizableShortcutsInLauncherDescription,

@ -51,6 +51,7 @@
#include "ui/base/ime/ash/input_method_manager.h"
#include "ui/base/ime/ash/mock_input_method_manager.h"
#include "ui/base/ime/ash/mock_input_method_manager_impl.h"
#include "ui/base/shortcut_mapping_pref_delegate.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/ash/caps_lock_event_rewriter.h"
#include "ui/events/ash/discard_key_event_rewriter.h"
@ -606,6 +607,22 @@ constexpr TestKeyboard kWilcoKeyboardVariants[] = {
kWilco1_5Keyboard,
};
// Use to emulate `ImprovedKeyboardShortcuts` is disabled by the policy on
// enrolled device.
class TestShortcutMappingPrefDelegate : public ui::ShortcutMappingPrefDelegate {
public:
TestShortcutMappingPrefDelegate() = default;
TestShortcutMappingPrefDelegate(const TestShortcutMappingPrefDelegate&) =
delete;
TestShortcutMappingPrefDelegate& operator=(
const TestShortcutMappingPrefDelegate&) = delete;
~TestShortcutMappingPrefDelegate() override = default;
// ui::ShortcutMappingPrefDelegate:
bool IsDeviceEnterpriseManaged() const override { return true; }
bool IsI18nShortcutPrefEnabled() const override { return false; }
};
} // namespace
namespace ash {
@ -2010,72 +2027,6 @@ TEST_P(EventRewriterTest, TestRewriteFromQuickInsert) {
scoped_feature_list_.Reset();
}
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
TEST_P(EventRewriterTest, TestRewriteExtendedKeysAltVariantsOld) {
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{}, {::features::kImprovedKeyboardShortcuts,
features::kAltClickAndSixPackCustomization});
for (const auto keyboard : kNonAppleKeyboardVariants) {
SCOPED_TRACE(keyboard.name);
SetUpKeyboard(keyboard);
// Alt+Backspace -> Delete
EXPECT_EQ(KeyDelete::Typed(),
RunRewriter(KeyBackspace::Typed(), ui::EF_ALT_DOWN));
// Control+Alt+Backspace -> Control+Delete
EXPECT_EQ(KeyDelete::Typed(ui::EF_CONTROL_DOWN),
RunRewriter(KeyBackspace::Typed(),
ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN));
// Search+Alt+Backspace -> Alt+Backspace
EXPECT_EQ(KeyBackspace::Typed(ui::EF_ALT_DOWN),
RunRewriter(KeyBackspace::Typed(),
ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN));
// Search+Control+Alt+Backspace -> Control+Alt+Backspace
EXPECT_EQ(KeyBackspace::Typed(ui::EF_CONTROL_DOWN | ui::EF_ALT_DOWN),
RunRewriter(KeyBackspace::Typed(), ui::EF_ALT_DOWN |
ui::EF_COMMAND_DOWN |
ui::EF_CONTROL_DOWN));
// Alt+Up -> Prior
EXPECT_EQ(KeyPageUp::Typed(),
RunRewriter(KeyArrowUp::Typed(), ui::EF_ALT_DOWN));
// Alt+Down -> Next
EXPECT_EQ(KeyPageDown::Typed(),
RunRewriter(KeyArrowDown::Typed(), ui::EF_ALT_DOWN));
// Ctrl+Alt+Up -> Home
EXPECT_EQ(KeyHome::Typed(),
RunRewriter(KeyArrowUp::Typed(),
ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN));
// Ctrl+Alt+Down -> End
EXPECT_EQ(KeyEnd::Typed(),
RunRewriter(KeyArrowDown::Typed(),
ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN));
// NOTE: The following are workarounds to avoid rewriting the
// Alt variants by additionally pressing Search.
// Search+Ctrl+Alt+Up -> Ctrl+Alt+Up
EXPECT_EQ(
KeyArrowUp::Typed(ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN),
RunRewriter(KeyArrowUp::Typed(), ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN |
ui::EF_COMMAND_DOWN));
// Search+Ctrl+Alt+Down -> Ctrl+Alt+Down
EXPECT_EQ(KeyArrowDown::Typed(ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN),
RunRewriter(KeyArrowDown::Typed(), ui::EF_ALT_DOWN |
ui::EF_CONTROL_DOWN |
ui::EF_COMMAND_DOWN));
}
}
TEST_P(EventRewriterTest, TestRewriteExtendedKeysAltVariants) {
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
@ -2154,37 +2105,11 @@ TEST_P(EventRewriterTest, TestRewriteExtendedKeysAltVariants) {
}
}
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
TEST_P(EventRewriterTest, TestRewriteExtendedKeyInsertOld) {
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{}, {::features::kImprovedKeyboardShortcuts,
features::kAltClickAndSixPackCustomization});
for (const auto keyboard : kNonAppleKeyboardVariants) {
SCOPED_TRACE(keyboard.name);
SetUpKeyboard(keyboard);
// Period -> Period
EXPECT_EQ(KeyPeriod::Typed(), RunRewriter(KeyPeriod::Typed()));
// Search+Period -> Insert
EXPECT_EQ(KeyInsert::Typed(),
RunRewriter(KeyPeriod::Typed(), ui::EF_COMMAND_DOWN));
// Control+Search+Period -> Control+Insert
EXPECT_EQ(KeyInsert::Typed(ui::EF_CONTROL_DOWN),
RunRewriter(KeyPeriod::Typed(),
ui::EF_COMMAND_DOWN | ui::EF_CONTROL_DOWN));
}
}
TEST_P(EventRewriterTest, TestRewriteExtendedKeyInsertDeprecatedNotification) {
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{::features::kImprovedKeyboardShortcuts},
{features::kAltClickAndSixPackCustomization});
{}, {features::kAltClickAndSixPackCustomization});
for (const auto keyboard : kNonAppleKeyboardVariants) {
SCOPED_TRACE(keyboard.name);
@ -2208,13 +2133,11 @@ TEST_P(EventRewriterTest, TestRewriteExtendedKeyInsertDeprecatedNotification) {
}
}
// TODO(crbug.com/1179893): Rename once the feature is enabled permanently.
TEST_P(EventRewriterTest, TestRewriteExtendedKeyInsertNew) {
TEST_P(EventRewriterTest, TestRewriteExtendedKeyInsert) {
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{::features::kImprovedKeyboardShortcuts},
{features::kAltClickAndSixPackCustomization});
{}, {features::kAltClickAndSixPackCustomization});
for (const auto keyboard : kNonAppleKeyboardVariants) {
SCOPED_TRACE(keyboard.name);
@ -2300,12 +2223,11 @@ TEST_P(EventRewriterTest, TestNumberRowIsNotRewritten) {
}
}
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
TEST_P(EventRewriterTest, TestRewriteSearchNumberToFunctionKeyOld) {
TEST_P(EventRewriterTest, TestRewriteSearchNumberToFunctionKey) {
TestShortcutMappingPrefDelegate delegate;
CHECK(!::features::IsImprovedKeyboardShortcutsEnabled());
ASSERT_FALSE(::features::IsImprovedKeyboardShortcutsEnabled());
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndDisableFeature(
::features::kImprovedKeyboardShortcuts);
for (const auto& keyboard : kNonAppleNonCustomLayoutKeyboardVariants) {
SCOPED_TRACE(keyboard.name);
@ -3757,8 +3679,7 @@ TEST_P(EventRewriterTest, DontRewriteIfNotRewritten_AltClickIsRightClick_New) {
// behavior or create a notification.
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{::features::kImprovedKeyboardShortcuts},
{features::kAltClickAndSixPackCustomization});
{}, {features::kAltClickAndSixPackCustomization});
DontRewriteIfNotRewritten(ui::EF_LEFT_MOUSE_BUTTON | ui::EF_ALT_DOWN);
EXPECT_EQ(message_center_.NotificationCount(), 0u);
}
@ -4712,11 +4633,13 @@ TEST_P(EventRewriterTest, RewriteNumpadExtensionCommand) {
}
TEST_P(EventRewriterTest, RecordRewritingToFunctionKeys) {
TestShortcutMappingPrefDelegate delegate;
ASSERT_FALSE(::features::IsImprovedKeyboardShortcutsEnabled());
Preferences::RegisterProfilePrefs(prefs()->registry());
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitWithFeatures(
{features::kInputDeviceSettingsSplit},
{::features::kImprovedKeyboardShortcuts});
scoped_feature_list.InitWithFeatures({features::kInputDeviceSettingsSplit},
{});
base::HistogramTester histogram_tester;
histogram_tester.ExpectTotalCount("ChromeOS.Inputs.Keyboard.F1Pressed", 0);

@ -1712,24 +1712,7 @@ TEST_F(InputMethodManagerImplTest, TestAddRemoveArcInputMethods) {
EXPECT_TRUE(result.empty());
}
// TODO(crbug.com/1179893): Remove once the feature is enabled permanently.
class InputMethodManagerImplPositionalTest : public InputMethodManagerImplTest {
public:
InputMethodManagerImplPositionalTest() = default;
~InputMethodManagerImplPositionalTest() override = default;
void SetUp() override {
scoped_feature_list_.InitAndEnableFeature(
::features::kImprovedKeyboardShortcuts);
InputMethodManagerImplTest::SetUp();
}
private:
base::test::ScopedFeatureList scoped_feature_list_;
};
TEST_F(InputMethodManagerImplPositionalTest, ValidatePositionalShortcutLayout) {
TEST_F(InputMethodManagerImplTest, ValidatePositionalShortcutLayout) {
// Initialize with one positional (US) and one non-positional (US-dvorak)
// layout.
std::string us_id = ImeIdFromEngineId("xkb:us::eng");

@ -1393,10 +1393,7 @@ void ChromeBrowserMainPartsAsh::PostBrowserStart() {
accessibility_event_rewriter_delegate_.get());
// `ShortcutInputHandler` and `ModifierKeyComboRecorder` are dependent on
// `EventRewriterController`'s initialization.
if (ash::features::IsPeripheralCustomizationEnabled() ||
::features::IsShortcutCustomizationEnabled()) {
Shell::Get()->shortcut_input_handler()->Initialize();
}
Shell::Get()->shortcut_input_handler()->Initialize();
Shell::Get()->modifier_key_combo_recorder()->Initialize();
Shell::Get()->rapid_key_sequence_recorder()->Initialize();

@ -1278,11 +1278,8 @@ void PopulateChromeWebUIFrameBinders(
ash::settings::mojom::DisplaySettingsProvider,
ash::settings::OSSettingsUI>(map);
if (::features::IsShortcutCustomizationEnabled()) {
RegisterWebUIControllerInterfaceBinder<
ash::common::mojom::AcceleratorFetcher, ash::settings::OSSettingsUI>(
map);
}
RegisterWebUIControllerInterfaceBinder<ash::common::mojom::AcceleratorFetcher,
ash::settings::OSSettingsUI>(map);
RegisterWebUIControllerInterfaceBinder<
ash::common::mojom::ShortcutInputProvider, ash::settings::OSSettingsUI,

@ -1495,11 +1495,6 @@ const char kEnableFingerprintingProtectionBlocklistInIncognitoDescription[] =
"resources from loading in a 3p context. This flag applies only in "
"Incognito mode.";
const char kEnableShortcutCustomizationName[] =
"Enable customization in new shortcuts app";
const char kEnableShortcutCustomizationDescription[] =
"Enable customization of shortcuts in the new shortcuts app.";
const char kEnableSearchCustomizableShortcutsInLauncherName[] =
"Enable search for customizable shortcuts in launcher";
const char kEnableSearchCustomizableShortcutsInLauncherDescription[] =
@ -2335,12 +2330,6 @@ const char kIgnoreGpuBlocklistDescription[] =
"Overrides the built-in software rendering list and enables "
"GPU-acceleration on unsupported system configurations.";
const char kImprovedKeyboardShortcutsName[] =
"Enable improved keyboard shortcuts";
const char kImprovedKeyboardShortcutsDescription[] =
"Ensure keyboard shortcuts work consistently with international keyboard "
"layouts and deprecate legacy shortcuts.";
const char kIncrementLocalSurfaceIdForMainframeSameDocNavigationName[] =
"Increments LocalSurfaceId for main-frame same-doc navigations";
const char kIncrementLocalSurfaceIdForMainframeSameDocNavigationDescription[] =

@ -962,9 +962,6 @@ extern const char kEnablePixelCanvasRecordingDescription[];
extern const char kEnableProcessPerSiteUpToMainFrameThresholdName[];
extern const char kEnableProcessPerSiteUpToMainFrameThresholdDescription[];
extern const char kEnableShortcutCustomizationName[];
extern const char kEnableShortcutCustomizationDescription[];
extern const char kEnableSearchCustomizableShortcutsInLauncherName[];
extern const char kEnableSearchCustomizableShortcutsInLauncherDescription[];
@ -1324,9 +1321,6 @@ extern const char kHttpsUpgradesDescription[];
extern const char kIgnoreGpuBlocklistName[];
extern const char kIgnoreGpuBlocklistDescription[];
extern const char kImprovedKeyboardShortcutsName[];
extern const char kImprovedKeyboardShortcutsDescription[];
extern const char kIncrementLocalSurfaceIdForMainframeSameDocNavigationName[];
extern const char
kIncrementLocalSurfaceIdForMainframeSameDocNavigationDescription[];

@ -407,7 +407,6 @@ void OSSettingsUI::BindInterface(
void OSSettingsUI::BindInterface(
mojo::PendingReceiver<::ash::common::mojom::AcceleratorFetcher> receiver) {
CHECK(::features::IsShortcutCustomizationEnabled());
OsSettingsManagerFactory::GetForProfile(Profile::FromWebUI(web_ui()))
->accelerator_fetcher()
->BindInterface(std::move(receiver));

@ -517,8 +517,8 @@ void InputsSection::AddLoadTimeData(content::WebUIDataSource* html_source) {
html_source->AddBoolean(
"languagePacksInSettingsEnabled",
base::FeatureList::IsEnabled(features::kLanguagePacksInSettings));
html_source->AddBoolean("isShortcutCustomizationEnabled",
::features::IsShortcutCustomizationEnabled());
// TODO(b/290861003): Update the settings code and remove this.
html_source->AddBoolean("isShortcutCustomizationEnabled", true);
AddInputMethodOptionsLoadTimeData(
html_source,

@ -51,8 +51,7 @@ class ShortcutCustomizationInteractiveUiTest : public InteractiveAshTest {
webcontents_id_ = kShortcutAppWebContentsId;
feature_list_.InitWithFeatures(
{::features::kShortcutCustomization,
ash::features::kInputDeviceSettingsSplit,
{ash::features::kInputDeviceSettingsSplit,
ash::features::kEnableKeyboardBacklightControlInSettings},
{});
}

@ -4,13 +4,9 @@
#include "ui/base/accelerators/accelerator_manager.h"
#include <array>
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/accelerators/test_accelerator_target.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event.h"
#include "ui/events/event_constants.h"
#include "ui/events/keycodes/dom/dom_code.h"
@ -175,10 +171,6 @@ TEST_F(AcceleratorManagerTest, Process) {
#if BUILDFLAG(IS_CHROMEOS)
TEST_F(AcceleratorManagerTest, PositionalShortcuts_AllEqual) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kImprovedKeyboardShortcuts);
// Use a local instance so that the feature is enabled during construction.
AcceleratorManager manager;
manager.SetUsePositionalLookup(true);
@ -197,10 +189,6 @@ TEST_F(AcceleratorManagerTest, PositionalShortcuts_AllEqual) {
}
TEST_F(AcceleratorManagerTest, PositionalShortcuts_MatchingDomCode) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kImprovedKeyboardShortcuts);
// Use a local instance so that the feature is enabled during construction.
AcceleratorManager manager;
manager.SetUsePositionalLookup(true);
@ -220,10 +208,6 @@ TEST_F(AcceleratorManagerTest, PositionalShortcuts_MatchingDomCode) {
}
TEST_F(AcceleratorManagerTest, PositionalShortcuts_NotMatchingDomCode) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kImprovedKeyboardShortcuts);
// Use a local instance so that the feature is enabled during construction.
AcceleratorManager manager;
manager.SetUsePositionalLookup(true);
@ -244,10 +228,6 @@ TEST_F(AcceleratorManagerTest, PositionalShortcuts_NotMatchingDomCode) {
}
TEST_F(AcceleratorManagerTest, PositionalShortcuts_NonPositionalMatch) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kImprovedKeyboardShortcuts);
// Use a local instance so that the feature is enabled during construction.
AcceleratorManager manager;
manager.SetUsePositionalLookup(true);
@ -268,10 +248,6 @@ TEST_F(AcceleratorManagerTest, PositionalShortcuts_NonPositionalMatch) {
}
TEST_F(AcceleratorManagerTest, PositionalShortcuts_NonPositionalNonMatch) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
features::kImprovedKeyboardShortcuts);
// Use a local instance so that the feature is enabled during construction.
AcceleratorManager manager;
manager.SetUsePositionalLookup(true);

@ -7,10 +7,8 @@
#include <string>
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/base/ui_base_features.h"
#include "ui/events/event.h"
#include "ui/events/types/event_type.h"
@ -139,10 +137,6 @@ TEST_F(AcceleratorTestMac, ModifierFlagsShortFormRepresentation) {
#if BUILDFLAG(IS_CHROMEOS)
TEST(AcceleratorTest, ConversionFromKeyEvent_Ash) {
base::test::ScopedFeatureList scoped_feature_list;
scoped_feature_list.InitAndEnableFeature(
::features::kImprovedKeyboardShortcuts);
ui::KeyEvent key_event(ui::EventType::kKeyPressed, ui::VKEY_F,
ui::EF_ALT_DOWN | ui::EF_CONTROL_DOWN);
Accelerator accelerator(key_event);

@ -82,14 +82,6 @@ bool IsNotificationsIgnoreRequireInteractionEnabled() {
return base::FeatureList::IsEnabled(kNotificationsIgnoreRequireInteraction);
}
BASE_FEATURE(kShortcutCustomization,
"ShortcutCustomization",
base::FEATURE_ENABLED_BY_DEFAULT);
bool IsShortcutCustomizationEnabled() {
return base::FeatureList::IsEnabled(kShortcutCustomization);
}
// Enables settings that allow users to remap the F11 and F12 keys in the
// "Customize keyboard keys" page.
BASE_FEATURE(kSupportF11AndF12KeyShortcuts,
@ -252,13 +244,7 @@ BASE_FEATURE(kFocusFollowsCursor,
base::FEATURE_DISABLED_BY_DEFAULT);
#if BUILDFLAG(IS_CHROMEOS)
// This feature supersedes kNewShortcutMapping.
BASE_FEATURE(kImprovedKeyboardShortcuts,
"ImprovedKeyboardShortcuts",
base::FEATURE_ENABLED_BY_DEFAULT);
bool IsImprovedKeyboardShortcutsEnabled() {
#if BUILDFLAG(IS_CHROMEOS)
// TODO(crbug.com/40203434): Remove this once kDeviceI18nShortcutsEnabled
// policy is deprecated.
if (::ui::ShortcutMappingPrefDelegate::IsInitialized()) {
@ -268,9 +254,7 @@ bool IsImprovedKeyboardShortcutsEnabled() {
return instance->IsI18nShortcutPrefEnabled();
}
}
#endif // BUILDFLAG(IS_CHROMEOS)
return base::FeatureList::IsEnabled(kImprovedKeyboardShortcuts);
return true;
}
#endif // BUILDFLAG(IS_CHROMEOS)

@ -61,8 +61,6 @@ extern const char kApplyNativeOcclusionToCompositorTypeThrottleAndRelease[];
#if BUILDFLAG(IS_CHROMEOS)
COMPONENT_EXPORT(UI_BASE_FEATURES)
BASE_DECLARE_FEATURE(kImprovedKeyboardShortcuts);
COMPONENT_EXPORT(UI_BASE_FEATURES)
bool IsImprovedKeyboardShortcutsEnabled();
#endif // BUILDFLAG(IS_CHROMEOS)
@ -103,12 +101,6 @@ BASE_DECLARE_FEATURE(kNotificationsIgnoreRequireInteraction);
COMPONENT_EXPORT(UI_BASE_FEATURES)
bool IsNotificationsIgnoreRequireInteractionEnabled();
COMPONENT_EXPORT(UI_BASE_FEATURES)
BASE_DECLARE_FEATURE(kShortcutCustomization);
COMPONENT_EXPORT(UI_BASE_FEATURES)
bool IsShortcutCustomizationEnabled();
COMPONENT_EXPORT(UI_BASE_FEATURES)
BASE_DECLARE_FEATURE(kSupportF11AndF12KeyShortcuts);