Commit 886df0ee authored by James Wallace-Lee's avatar James Wallace-Lee Committed by Commit Bot

Add extension dialog title to accessible node data

Screen readers should read the title ("Add <extension>?") of extension
install dialogs.

Bug: 849910
Change-Id: I9d37b3810c046419f4c5a3b4428a57cb0a5f3289
Reviewed-on: https://chromium-review.googlesource.com/1135595
Commit-Queue: James Wallace-Lee <jamwalla@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#578713}
parent 1d4a058c
......@@ -240,6 +240,7 @@ ExtensionInstallDialogView::ExtensionInstallDialogView(
navigator_(navigator),
done_callback_(done_callback),
prompt_(std::move(prompt)),
title_(prompt_->GetDialogTitle()),
scroll_view_(nullptr),
handled_result_(false),
install_button_enabled_(false) {
......@@ -471,8 +472,7 @@ void ExtensionInstallDialogView::AddedToWidget() {
layout->AddView(icon);
std::unique_ptr<views::Label> title_label =
views::BubbleFrameView::CreateDefaultTitleLabel(
prompt_->GetDialogTitle());
views::BubbleFrameView::CreateDefaultTitleLabel(title_);
// Setting the title's preferred size to 0 ensures it won't influence the
// overall size of the dialog. It will be expanded by GridLayout.
title_label->SetPreferredSize(gfx::Size(0, 0));
......@@ -547,6 +547,14 @@ void ExtensionInstallDialogView::UpdateInstallResultHistogram(bool accepted)
UMA_HISTOGRAM_BOOLEAN("Extensions.InstallPrompt.Accepted", accepted);
}
ax::mojom::Role ExtensionInstallDialogView::GetAccessibleWindowRole() const {
return ax::mojom::Role::kAlertDialog;
}
base::string16 ExtensionInstallDialogView::GetAccessibleWindowTitle() const {
return title_;
}
// ExpandableContainerView::DetailsView ----------------------------------------
ExpandableContainerView::DetailsView::DetailsView(
......
......@@ -60,6 +60,8 @@ class ExtensionInstallDialogView : public views::DialogDelegateView,
ui::ModalType GetModalType() const override;
views::View* CreateExtraView() override;
bool IsDialogButtonEnabled(ui::DialogButton button) const override;
ax::mojom::Role GetAccessibleWindowRole() const override;
base::string16 GetAccessibleWindowTitle() const override;
// views::LinkListener:
void LinkClicked(views::Link* source, int event_flags) override;
......@@ -82,6 +84,7 @@ class ExtensionInstallDialogView : public views::DialogDelegateView,
content::PageNavigator* navigator_;
ExtensionInstallPrompt::DoneCallback done_callback_;
std::unique_ptr<ExtensionInstallPrompt::Prompt> prompt_;
base::string16 title_;
// The scroll view containing all the details for the dialog (including all
// collapsible/expandable sections).
......
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