Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7078)

Unified Diff: chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc

Issue 657633004: [Password Generation] Add accessibility alert when popup is shown in Views (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
diff --git a/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc b/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
index 47a4cef3f3d8b863733bfe25e715a4167e765447..cf90a93b45632ed3e077bfe5a55f3dac2d803df0 100644
--- a/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
+++ b/chrome/browser/ui/views/autofill/password_generation_popup_view_views.cc
@@ -8,6 +8,7 @@
#include "chrome/browser/ui/autofill/password_generation_popup_controller.h"
#include "chrome/browser/ui/autofill/popup_constants.h"
#include "grit/theme_resources.h"
+#include "ui/accessibility/ax_view_state.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
#include "ui/views/background.h"
@@ -84,7 +85,10 @@ class PasswordGenerationPopupViewViews::PasswordBox : public views::View {
// the text.
void Init(const base::string16& password,
const base::string16& suggestion,
+ const base::string16& accessible_name,
const gfx::FontList& font_list) {
+ accessible_name_ = accessible_name;
+
views::BoxLayout* box_layout = new views::BoxLayout(
views::BoxLayout::kHorizontal,
PasswordGenerationPopupController::kHorizontalPadding,
@@ -103,6 +107,8 @@ class PasswordGenerationPopupViewViews::PasswordBox : public views::View {
PasswordTextBox* password_text_box = new PasswordTextBox();
password_text_box->Init(suggestion, password, font_list);
AddChildView(password_text_box);
+
+ NotifyAccessibilityEvent(ui::AX_EVENT_ALERT, true);
}
// views::View:
@@ -111,7 +117,14 @@ class PasswordGenerationPopupViewViews::PasswordBox : public views::View {
return false;
}
+ virtual void GetAccessibleState(ui::AXViewState* state) override {
+ state->role = ui::AX_ROLE_ALERT;
+ state->name = accessible_name_;
+ }
+
private:
+ base::string16 accessible_name_;
+
DISALLOW_COPY_AND_ASSIGN(PasswordBox);
};
@@ -162,6 +175,7 @@ void PasswordGenerationPopupViewViews::CreatePasswordView() {
password_view_ = new PasswordBox();
password_view_->Init(controller_->password(),
controller_->SuggestedText(),
+ controller_->AccessibleName(),
font_list_);
password_view_->SetPosition(gfx::Point(kPopupBorderThickness,
kPopupBorderThickness));
« no previous file with comments | « chrome/browser/ui/cocoa/autofill/password_generation_popup_view_cocoa_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698