[A11y] A11y feature notifications update accelerators dynamically
Previously accelerators were hard-coded so these notifications didn't make sense if a user had changed their keyboard shortcuts. Bug: b/346420542 Change-Id: Iba5a10ce15c29d47a525fad302c416f8c0c5f079 AX-Relnotes: Show correct accelerators in dialogs Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5619145 Commit-Queue: Katie Dektar <katie@chromium.org> Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org> Cr-Commit-Position: refs/heads/main@{#1313622}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
c4a6ece6c0
commit
1de6bbe98d
@ -149,12 +149,14 @@ void NotifyAccessibilityFeatureDisabledByAdmin(
|
||||
void ShowAccessibilityNotification(
|
||||
int title_id,
|
||||
int message_id,
|
||||
const std::u16string& accelerator,
|
||||
const std::string& notification_id,
|
||||
const NotificationCatalogName& catalog_name) {
|
||||
// Show a notification that times out.
|
||||
CreateAndShowNotification(
|
||||
notification_id, catalog_name, l10n_util::GetStringUTF16(title_id),
|
||||
l10n_util::GetStringUTF16(message_id), kNotificationAccessibilityIcon);
|
||||
CreateAndShowNotification(notification_id, catalog_name,
|
||||
l10n_util::GetStringUTF16(title_id),
|
||||
l10n_util::GetStringFUTF16(message_id, accelerator),
|
||||
kNotificationAccessibilityIcon);
|
||||
}
|
||||
|
||||
void RemoveNotification(const std::string& notification_id) {
|
||||
@ -208,9 +210,17 @@ void MaybeShowDeprecatedAcceleratorNotification(const char* notification_id,
|
||||
}
|
||||
|
||||
void ShowDockedMagnifierNotification() {
|
||||
std::vector<AcceleratorLookup::AcceleratorDetails> details =
|
||||
Shell::Get()->accelerator_lookup()->GetAvailableAcceleratorsForAction(
|
||||
AcceleratorAction::kToggleDockedMagnifier);
|
||||
// This dialog is only shown when docked magnification was enabled from the
|
||||
// accelerator.
|
||||
CHECK(!details.empty());
|
||||
std::u16string accelerator =
|
||||
AcceleratorLookup::GetAcceleratorDetailsText(details[0]);
|
||||
ShowAccessibilityNotification(
|
||||
IDS_DOCKED_MAGNIFIER_ACCEL_TITLE, IDS_DOCKED_MAGNIFIER_ACCEL_MSG,
|
||||
kDockedMagnifierToggleAccelNotificationId,
|
||||
accelerator, kDockedMagnifierToggleAccelNotificationId,
|
||||
NotificationCatalogName::kDockedMagnifierEnabled);
|
||||
}
|
||||
|
||||
@ -225,9 +235,17 @@ void RemoveDockedMagnifierNotification() {
|
||||
}
|
||||
|
||||
void ShowFullscreenMagnifierNotification() {
|
||||
std::vector<AcceleratorLookup::AcceleratorDetails> details =
|
||||
Shell::Get()->accelerator_lookup()->GetAvailableAcceleratorsForAction(
|
||||
AcceleratorAction::kToggleFullscreenMagnifier);
|
||||
// This dialog is only shown when fullscreen magnification was enabled from
|
||||
// the accelerator.
|
||||
CHECK(!details.empty());
|
||||
std::u16string accelerator =
|
||||
AcceleratorLookup::GetAcceleratorDetailsText(details[0]);
|
||||
ShowAccessibilityNotification(
|
||||
IDS_FULLSCREEN_MAGNIFIER_ACCEL_TITLE, IDS_FULLSCREEN_MAGNIFIER_ACCEL_MSG,
|
||||
kFullscreenMagnifierToggleAccelNotificationId,
|
||||
accelerator, kFullscreenMagnifierToggleAccelNotificationId,
|
||||
NotificationCatalogName::kFullScreenMagnifierEnabled);
|
||||
}
|
||||
|
||||
@ -242,8 +260,16 @@ void RemoveFullscreenMagnifierNotification() {
|
||||
}
|
||||
|
||||
void ShowHighContrastNotification() {
|
||||
std::vector<AcceleratorLookup::AcceleratorDetails> details =
|
||||
Shell::Get()->accelerator_lookup()->GetAvailableAcceleratorsForAction(
|
||||
AcceleratorAction::kToggleHighContrast);
|
||||
// This dialog is only shown when high conrast was enabled from the
|
||||
// accelerator.
|
||||
CHECK(!details.empty());
|
||||
std::u16string accelerator =
|
||||
AcceleratorLookup::GetAcceleratorDetailsText(details[0]);
|
||||
ShowAccessibilityNotification(IDS_HIGH_CONTRAST_ACCEL_TITLE,
|
||||
IDS_HIGH_CONTRAST_ACCEL_MSG,
|
||||
IDS_HIGH_CONTRAST_ACCEL_MSG, accelerator,
|
||||
kHighContrastToggleAccelNotificationId,
|
||||
NotificationCatalogName::kHighContrastEnabled);
|
||||
}
|
||||
|
@ -4018,32 +4018,32 @@ No devices connected.
|
||||
|
||||
<!-- Notification that an accelerator was pressed, so the user knows how to toggle it back -->
|
||||
<message name="IDS_HIGH_CONTRAST_ACCEL_TITLE"
|
||||
desc="Notification title to tell users that they just pressed the Ctrl+Search+H shortcut to toggle Color Inversion Mode (formerly known as High Contrast), and that pressing it again will toggle it off.">
|
||||
desc="Notification title to tell users that they just pressed an accelerator keyboard shortcut shortcut to toggle Color Inversion Mode (formerly known as High Contrast), and that pressing it again will toggle it off.">
|
||||
Color Inversion Mode
|
||||
</message>
|
||||
<message name="IDS_HIGH_CONTRAST_ACCEL_MSG"
|
||||
desc="Notification message to tell users that they just pressed the Ctrl+Search+H shortcut to toggle Color Inversion Mode (formerly known as High Contrast), and that pressing it again will toggle it off.">
|
||||
Color Inversion Mode enabled. Press Ctrl+Search+H again to toggle it off.
|
||||
desc="Notification message to tell users that they just pressed an accelerator keyboard shortcut to toggle Color Inversion Mode (formerly known as High Contrast), and that pressing it again will toggle it off.">
|
||||
Color Inversion Mode enabled. Press <ph name="accelerator">$1<ex>ctrl+search+h</ex></ph> again to toggle it off.
|
||||
</message>
|
||||
|
||||
<!-- Notification that an accelerator was pressed, so the user knows how to toggle it back -->
|
||||
<message name="IDS_DOCKED_MAGNIFIER_ACCEL_TITLE"
|
||||
desc="Notification title to tell users that they just pressed the Ctrl+Search+D shortcut to toggle Docked Magnifier, and that pressing it again will toggle it off.">
|
||||
desc="Notification title to tell users that they just pressed the accelerator keyboard shortcut to toggle Docked Magnifier, and that pressing it again will toggle it off.">
|
||||
Docked Magnifier
|
||||
</message>
|
||||
<message name="IDS_DOCKED_MAGNIFIER_ACCEL_MSG"
|
||||
desc="Notification message to tell users that they just pressed the Ctrl+Search+D shortcut to toggle Docked Magnifier, and that pressing it again will toggle it off.">
|
||||
Docked Magnifier enabled. Press Ctrl+Search+D again to toggle it off.
|
||||
desc="Notification message to tell users that they just pressed the accelerator keyboard shortcut to toggle Docked Magnifier, and that pressing it again will toggle it off.">
|
||||
Docked Magnifier enabled. Press <ph name="accelerator">$1<ex>ctrl+search+d</ex></ph> again to toggle it off.
|
||||
</message>
|
||||
|
||||
<!-- Notification that an accelerator was pressed, so the user knows how to toggle it back -->
|
||||
<message name="IDS_FULLSCREEN_MAGNIFIER_ACCEL_TITLE"
|
||||
desc="Notification title to tell users that they just pressed the Ctrl+Search+M shortcut to toggle Full-screen Magnifier, and that pressing it again will toggle it off.">
|
||||
desc="Notification title to tell users that they just pressed an accelerator keyboard shortcut to toggle Full-screen Magnifier, and that pressing it again will toggle it off.">
|
||||
Full-screen Magnifier
|
||||
</message>
|
||||
<message name="IDS_FULLSCREEN_MAGNIFIER_ACCEL_MSG"
|
||||
desc="Notification message to tell users that they just pressed the Ctrl+Search+M shortcut to toggle Full-screen Magnifier, and that pressing it again will toggle it off.">
|
||||
Full-screen Magnifier enabled. Press Ctrl+Search+M again to toggle it off.
|
||||
desc="Notification message to tell users that they just pressed an accelerator keyboard shortcut to toggle Full-screen Magnifier, and that pressing it again will toggle it off.">
|
||||
Full-screen Magnifier enabled. Press <ph name="accelerator">$1<ex>ctrl+search+m</ex></ph> again to toggle it off.
|
||||
</message>
|
||||
|
||||
<message name="IDS_ASH_ACCELERATOR_LAUNCHER_KEY" desc="Label for the launcher key in ChromeOS keyboards.">
|
||||
|
@ -0,0 +1 @@
|
||||
e9d158a949142b17b89c1891b9d74bafd084f7c0
|
@ -0,0 +1 @@
|
||||
7c49f21f6807ca344bd7fdfe65f5a0a1d505d1fd
|
@ -1 +1 @@
|
||||
c74a86d78f2f228fb13548fb9bc841e5f1002620
|
||||
f0ade74c1e0ed58a4ed541f079d96f8e4edb3fcb
|
Reference in New Issue
Block a user