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

Unified Diff: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc

Issue 2670003002: Accessibility for Autofill Popup View in native code (Closed)
Patch Set: Switches to CHECK to ensure crash is caught early. Created 3 years, 10 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
Index: chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
index 487248fba6fdda38fb06cfa215aecb70cb0b4acf..95b7025ff27c2a06001ae006e6743cb31d9fd595 100644
--- a/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_popup_controller_impl.cc
@@ -17,6 +17,7 @@
#include "components/autofill/core/browser/popup_item_ids.h"
#include "components/autofill/core/browser/suggestion.h"
#include "content/public/browser/native_web_keyboard_event.h"
+#include "ui/accessibility/ax_enums.h"
#include "ui/events/event.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/text_elider.h"
@@ -401,7 +402,9 @@ void AutofillPopupControllerImpl::SetSelectedLine(int selected_line) {
if (selected_line != kNoSelection) {
InvalidateRow(selected_line);
- if (!CanAccept(suggestions_[selected_line].frontend_id))
+ if (CanAccept(suggestions_[selected_line].frontend_id))
+ NotifyAccessibilityEventForRow(ui::AX_EVENT_SELECTION, selected_line);
+ else
selected_line = kNoSelection;
}
@@ -487,11 +490,19 @@ void AutofillPopupControllerImpl::ShowView() {
}
void AutofillPopupControllerImpl::InvalidateRow(size_t row) {
- DCHECK(0 <= row);
- DCHECK(row < suggestions_.size());
+ DCHECK_GE(row, (size_t)0);
+ DCHECK_LT(row, suggestions_.size());
view_->InvalidateRow(row);
}
+void AutofillPopupControllerImpl::NotifyAccessibilityEventForRow(
+ ui::AXEvent event_type,
+ size_t row) {
+ CHECK_GE(row, (size_t)0);
+ CHECK_LT(row, suggestions_.size());
+ view_->NotifyAccessibilityEventForRow(event_type, row);
+}
+
WeakPtr<AutofillPopupControllerImpl> AutofillPopupControllerImpl::GetWeakPtr() {
return weak_ptr_factory_.GetWeakPtr();
}

Powered by Google App Engine
This is Rietveld 408576698