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

Unified Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 349033010: Implement accessible states and notifications for the tab strip. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nvda_load_fix_3
Patch Set: Fix compile on other platforms Created 6 years, 5 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/views/tabs/tab.cc ('k') | chrome/common/extensions/api/automation.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/tabs/tab_strip.cc
diff --git a/chrome/browser/ui/views/tabs/tab_strip.cc b/chrome/browser/ui/views/tabs/tab_strip.cc
index 1b3df8a2a05ce44710126aa46bc633da6a3b5a4a..8bf81a261efdb560b7f6aab1cbf6b8b98c504f68 100644
--- a/chrome/browser/ui/views/tabs/tab_strip.cc
+++ b/chrome/browser/ui/views/tabs/tab_strip.cc
@@ -817,12 +817,30 @@ void TabStrip::SetSelection(const ui::ListSelectionModel& old_selection,
}
}
+ // Use STLSetDifference to get the indices of elements newly selected
+ // and no longer selected, since selected_indices() is always sorted.
ui::ListSelectionModel::SelectedIndices no_longer_selected =
base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>(
old_selection.selected_indices(),
new_selection.selected_indices());
- for (size_t i = 0; i < no_longer_selected.size(); ++i)
+ ui::ListSelectionModel::SelectedIndices newly_selected =
+ base::STLSetDifference<ui::ListSelectionModel::SelectedIndices>(
+ new_selection.selected_indices(),
+ old_selection.selected_indices());
+
+ // Fire accessibility events that reflect the changes to selection, and
+ // stop the mini tab title animation on tabs no longer selected.
+ for (size_t i = 0; i < no_longer_selected.size(); ++i) {
tab_at(no_longer_selected[i])->StopMiniTabTitleAnimation();
+ tab_at(no_longer_selected[i])->NotifyAccessibilityEvent(
+ ui::AX_EVENT_SELECTION_REMOVE, true);
+ }
+ for (size_t i = 0; i < newly_selected.size(); ++i) {
+ tab_at(newly_selected[i])->NotifyAccessibilityEvent(
+ ui::AX_EVENT_SELECTION_ADD, true);
+ }
+ tab_at(new_selection.active())->NotifyAccessibilityEvent(
+ ui::AX_EVENT_SELECTION, true);
}
void TabStrip::TabTitleChangedNotLoading(int model_index) {
« no previous file with comments | « chrome/browser/ui/views/tabs/tab.cc ('k') | chrome/common/extensions/api/automation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698