Commit bf146e62 authored by Jon Mann's avatar Jon Mann Committed by Commit Bot

[a11y] Announce network connection status in tray.

When navigating through the network list in quick settings, announce
the connection status of the highlighted network when available.

Bug: 1006005
Change-Id: Ib2a640af72742817118dea76e2b210e12180bff0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879435
Commit-Queue: Jon Mann <jonmann@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710457}
parent ae891958
...@@ -877,6 +877,9 @@ This file contains the strings for ash. ...@@ -877,6 +877,9 @@ This file contains the strings for ash.
<message name="IDS_ASH_STATUS_TRAY_NETWORK" desc="The label used in the network dialog header."> <message name="IDS_ASH_STATUS_TRAY_NETWORK" desc="The label used in the network dialog header.">
Network Network
</message> </message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_ACCESSIBILITY_LABEL" desc="Accessibility label for a network in the quick settings network list, to be read outloud by a screenreader or braile console.">
<ph name="NETWORK_NAME">$1<ex>GuestNetwork</ex></ph> - <ph name="CONNECTION_STATUS">$2<ex>Connecting</ex></ph>
</message>
<message name="IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED" desc="The label used when a network connection is connected."> <message name="IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED" desc="The label used when a network connection is connected.">
Connected Connected
</message> </message>
......
...@@ -362,25 +362,37 @@ void TrayDetailedView::SetupConnectedScrollListItem( ...@@ -362,25 +362,37 @@ void TrayDetailedView::SetupConnectedScrollListItem(
base::Optional<uint8_t> battery_percentage) { base::Optional<uint8_t> battery_percentage) {
DCHECK(view->is_populated()); DCHECK(view->is_populated());
base::string16 status;
if (battery_percentage) { if (battery_percentage) {
view->SetSubText(l10n_util::GetStringFUTF16( status = l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_WITH_BATTERY_LABEL, IDS_ASH_STATUS_TRAY_BLUETOOTH_DEVICE_CONNECTED_WITH_BATTERY_LABEL,
base::NumberToString16(battery_percentage.value()))); base::NumberToString16(battery_percentage.value()));
} else { } else {
view->SetSubText(l10n_util::GetStringUTF16( status =
IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED)); l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTED);
} }
view->SetSubText(status);
TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION); TrayPopupItemStyle style(TrayPopupItemStyle::FontStyle::CAPTION);
style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED); style.set_color_style(TrayPopupItemStyle::ColorStyle::CONNECTED);
style.SetupLabel(view->sub_text_label()); style.SetupLabel(view->sub_text_label());
view->SetAccessibleName(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_ACCESSIBILITY_LABEL,
view->text_label()->GetText(), status));
} }
void TrayDetailedView::SetupConnectingScrollListItem(HoverHighlightView* view) { void TrayDetailedView::SetupConnectingScrollListItem(HoverHighlightView* view) {
DCHECK(view->is_populated()); DCHECK(view->is_populated());
view->SetSubText( base::string16 status =
l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING)); l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_NETWORK_STATUS_CONNECTING);
view->SetSubText(status);
view->SetAccessibleName(l10n_util::GetStringFUTF16(
IDS_ASH_STATUS_TRAY_NETWORK_ACCESSIBILITY_LABEL,
view->text_label()->GetText(), status));
} }
TriView* TrayDetailedView::AddScrollListSubHeader(const gfx::VectorIcon& icon, TriView* TrayDetailedView::AddScrollListSubHeader(const gfx::VectorIcon& icon,
......
...@@ -89,15 +89,17 @@ class ASH_EXPORT TrayDetailedView : public views::View, ...@@ -89,15 +89,17 @@ class ASH_EXPORT TrayDetailedView : public views::View,
bool checked, bool checked,
bool enterprise_managed = false); bool enterprise_managed = false);
// Adds connected sub label to the |view| with appropriate style. // Adds connected sub label to the |view| with appropriate style and updates
// accessibility label.
void SetupConnectedScrollListItem(HoverHighlightView* view); void SetupConnectedScrollListItem(HoverHighlightView* view);
// Adds connected sub label with the device's battery percentage to the |view| // Adds connected sub label with the device's battery percentage to the |view|
// with appropriate style. // with appropriate style and updates accessibility label.
void SetupConnectedScrollListItem(HoverHighlightView* view, void SetupConnectedScrollListItem(HoverHighlightView* view,
base::Optional<uint8_t> battery_percentage); base::Optional<uint8_t> battery_percentage);
// Adds connecting sub label to the |view| with appropriate style. // Adds connecting sub label to the |view| with appropriate style and updates
// accessibility label.
void SetupConnectingScrollListItem(HoverHighlightView* view); void SetupConnectingScrollListItem(HoverHighlightView* view);
// Adds a sticky sub header to |scroll_content_| containing |icon| and a text // Adds a sticky sub header to |scroll_content_| containing |icon| and a text
......
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