Commit 0ef16c30 authored by Anastasia Helfinstein's avatar Anastasia Helfinstein Committed by Commit Bot

[Switch Access] Add sticky notification on enabled

Similar to ChromeVox, show a sticky notification when Switch Access is
enabled that explains how to disable the feature.

Relnotes: N/A
Bug: 996351
Change-Id: I56546ddfe0d5a4e76eb07e5e55fcdf88ef6b2a1c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2131015
Commit-Queue: Anastasia Helfinstein <anastasi@google.com>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756015}
parent 8460b635
...@@ -269,15 +269,22 @@ enum class A11yNotificationType { ...@@ -269,15 +269,22 @@ enum class A11yNotificationType {
// enabled yet. Note: in this case braille display connected would enable // enabled yet. Note: in this case braille display connected would enable
// spoken feeback. // spoken feeback.
kSpokenFeedbackBrailleEnabled, kSpokenFeedbackBrailleEnabled,
// Shown when Switch Access is enabled.
kSwitchAccessEnabled,
}; };
// Returns notification icon based on the A11yNotificationType. // Returns notification icon based on the A11yNotificationType.
const gfx::VectorIcon& GetNotificationIcon(A11yNotificationType type) { const gfx::VectorIcon& GetNotificationIcon(A11yNotificationType type) {
if (type == A11yNotificationType::kSpokenFeedbackBrailleEnabled) switch (type) {
return kNotificationAccessibilityIcon; case A11yNotificationType::kSpokenFeedbackBrailleEnabled:
if (type == A11yNotificationType::kBrailleDisplayConnected) return kNotificationAccessibilityIcon;
return kNotificationAccessibilityBrailleIcon; case A11yNotificationType::kBrailleDisplayConnected:
return kNotificationChromevoxIcon; return kNotificationAccessibilityBrailleIcon;
case A11yNotificationType::kSwitchAccessEnabled:
return kSwitchAccessIcon;
default:
return kNotificationChromevoxIcon;
}
} }
void ShowAccessibilityNotification(A11yNotificationType type) { void ShowAccessibilityNotification(A11yNotificationType type) {
...@@ -293,6 +300,10 @@ void ShowAccessibilityNotification(A11yNotificationType type) { ...@@ -293,6 +300,10 @@ void ShowAccessibilityNotification(A11yNotificationType type) {
if (type == A11yNotificationType::kBrailleDisplayConnected) { if (type == A11yNotificationType::kBrailleDisplayConnected) {
text = l10n_util::GetStringUTF16( text = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED); IDS_ASH_STATUS_TRAY_BRAILLE_DISPLAY_CONNECTED);
} else if (type == A11yNotificationType::kSwitchAccessEnabled) {
title = l10n_util::GetStringUTF16(
IDS_ASH_STATUS_TRAY_SWITCH_ACCESS_ENABLED_TITLE);
text = l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_SWITCH_ACCESS_ENABLED);
} else { } else {
bool is_tablet = Shell::Get()->tablet_mode_controller()->InTabletMode(); bool is_tablet = Shell::Get()->tablet_mode_controller()->InTabletMode();
...@@ -1798,6 +1809,8 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) { ...@@ -1798,6 +1809,8 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) {
case FeatureType::kSwitchAccess: case FeatureType::kSwitchAccess:
// Show a dialog before disabling Switch Access. // Show a dialog before disabling Switch Access.
if (!enabled) { if (!enabled) {
ShowAccessibilityNotification(A11yNotificationType::kNone);
if (no_switch_access_disable_confirmation_dialog_for_testing_) { if (no_switch_access_disable_confirmation_dialog_for_testing_) {
switch_access_event_handler_.reset(); switch_access_event_handler_.reset();
} else { } else {
...@@ -1814,6 +1827,8 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) { ...@@ -1814,6 +1827,8 @@ void AccessibilityControllerImpl::UpdateFeatureFromPref(FeatureType feature) {
} }
} else { } else {
MaybeCreateSwitchAccessEventHandler(); MaybeCreateSwitchAccessEventHandler();
ShowAccessibilityNotification(
A11yNotificationType::kSwitchAccessEnabled);
} }
break; break;
case FeatureType::kVirtualKeyboard: case FeatureType::kVirtualKeyboard:
......
...@@ -249,6 +249,12 @@ This file contains the strings for ash. ...@@ -249,6 +249,12 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_BRAILLE_ENABLED_TITLE" desc="The message shown on a notification when both the spoken feedback and braille are enabled"> <message name="IDS_ASH_STATUS_TRAY_SPOKEN_FEEDBACK_BRAILLE_ENABLED_TITLE" desc="The message shown on a notification when both the spoken feedback and braille are enabled">
Braille and ChromeVox are enabled Braille and ChromeVox are enabled
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_SWITCH_ACCESS_ENABLED" desc="The message shown on a notification when Switch Access is enabled">
Switch Access can be disabled in Settings > Accessibility.
</message>
<message name="IDS_ASH_STATUS_TRAY_SWITCH_ACCESS_ENABLED_TITLE" desc="The title message shown on a notification when Switch Access is enabled.">
Switch Access enabled
</message>
<message name="IDS_ASH_STATUS_TRAY_USER_INFO_ACCESSIBILITY" desc="The accessibility string used for an item in user chooser that tells the user name and the mail address."> <message name="IDS_ASH_STATUS_TRAY_USER_INFO_ACCESSIBILITY" desc="The accessibility string used for an item in user chooser that tells the user name and the mail address.">
<ph name="USERNAME">$1<ex>Jane Doe</ex></ph> (<ph name="MAIL">$2<ex>janedoe@example.com</ex></ph>) <ph name="USERNAME">$1<ex>Jane Doe</ex></ph> (<ph name="MAIL">$2<ex>janedoe@example.com</ex></ph>)
</message> </message>
......
a9cca38cee3f290d97f7d64b8e9e18dda1190c08
\ No newline at end of file
a9cca38cee3f290d97f7d64b8e9e18dda1190c08
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment