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

Unified Diff: chrome/browser/tabs/tab_strip_model.cc

Issue 6933037: Multi-tab selection for Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adding TabSelectionChanged callback and removing unnecessary method Created 9 years, 7 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/tabs/tab_strip_model.cc
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index d1ded2fb870b424509045ebb4b63ded573a3a98a..4ec94b13618b2d8486fb72c84ca5259d2c70be03 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -569,8 +569,11 @@ int TabStripModel::ConstrainInsertionIndex(int index, bool mini_tab) {
void TabStripModel::ExtendSelectionTo(int index) {
DCHECK(ContainsIndex(index));
int old_active = active_index();
+ std::vector<int> old_selected_indices(
James Hawkins 2011/05/18 18:03:10 nit: You use indices here and indexes in the Notif
dpapad 2011/06/01 18:05:41 Done.
+ selection_model().selected_indices());
selection_model_.SetSelectionFromAnchorTo(index);
// This may not have resulted in a change, but we assume it did.
+ NotifyMultipleSelectionChanged(old_selected_indices);
NotifySelectionChanged(old_active);
}
@@ -1235,6 +1238,20 @@ void TabStripModel::NotifySelectionChanged(int old_selected_index) {
TabSelectedAt(old_tab, new_tab, active_index(), true));
}
+void TabStripModel::NotifyMultipleSelectionChanged(
+ const std::vector<int>& old_selected_indices) {
+ std::set<int> indices_affected;
+ size_t i = 0;
+ for (i = 0; i < old_selected_indices.size(); i++) {
+ if (old_selected_indices[i] != TabStripSelectionModel::kUnselectedIndex)
+ indices_affected.insert(old_selected_indices[i]);
+ }
+ for (i = 0; i < selection_model().selected_indices().size(); i++)
+ indices_affected.insert(selection_model().selected_indices()[i]);
+ FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
+ TabSelectionChanged(indices_affected));
+}
+
void TabStripModel::SelectRelativeTab(bool next) {
// This may happen during automated testing or if a user somehow buffers
// many key accelerators.

Powered by Google App Engine
This is Rietveld 408576698