Commit ea2a0501 authored by Aaron Leventhal's avatar Aaron Leventhal Committed by Commit Bot

Accessible info for notification header view

This is split out from the CL to test all widgets and views for nameless
focusable objects. See crrev.com/c/951933.

Bug: 819350

Change-Id: Ic6426632f641ac2bfa83616684c7c61d01228e8c
Reviewed-on: https://chromium-review.googlesource.com/961246Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Aaron Leventhal <aleventhal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#543087}
parent 678a41bb
......@@ -333,6 +333,17 @@ void NotificationHeaderView::ClearOverflowIndicator() {
UpdateSummaryTextVisibility();
}
void NotificationHeaderView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
Button::GetAccessibleNodeData(node_data);
node_data->SetName(app_name_view_->text());
node_data->SetDescription(summary_text_view_->text() +
base::ASCIIToUTF16(" ") + timestamp_view_->text());
if (is_expanded_)
node_data->AddState(ax::mojom::State::kExpanded);
}
void NotificationHeaderView::SetTimestamp(base::Time past) {
timestamp_view_->SetText(FormatToRelativeTime(past));
has_timestamp_ = true;
......@@ -361,6 +372,7 @@ void NotificationHeaderView::SetExpanded(bool expanded) {
expand_button_->SetTooltipText(l10n_util::GetStringUTF16(
expanded ? IDS_MESSAGE_CENTER_COLLAPSE_NOTIFICATION
: IDS_MESSAGE_CENTER_EXPAND_NOTIFICATION));
NotifyAccessibilityEvent(ax::mojom::Event::kStateChanged, true);
}
void NotificationHeaderView::SetAccentColor(SkColor color) {
......
......@@ -42,6 +42,9 @@ class NotificationHeaderView : public views::Button {
bool IsExpandButtonEnabled();
void SetSubpixelRenderingEnabled(bool enabled);
// views::View:
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
// Button override:
std::unique_ptr<views::InkDrop> CreateInkDrop() override;
......
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