| 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 ea3977e2999eb562da80c0ac1da047155999f80e..d194844a1522d7f233eaac1c3ece5220cae89f35 100644
|
| --- a/chrome/browser/tabs/tab_strip_model.cc
|
| +++ b/chrome/browser/tabs/tab_strip_model.cc
|
| @@ -244,6 +244,7 @@ TabContentsWrapper* TabStripModel::DetachTabContentsAt(int index) {
|
| void TabStripModel::ActivateTabAt(int index, bool user_gesture) {
|
| DCHECK(ContainsIndex(index));
|
| bool had_multi = selection_model_.selected_indices().size() > 1;
|
| + std::vector<int> old_selected_indices(selection_model().selected_indices());
|
| TabContentsWrapper* old_contents =
|
| (active_index() == TabStripSelectionModel::kUnselectedIndex) ?
|
| NULL : GetSelectedTabContents();
|
| @@ -257,6 +258,7 @@ void TabStripModel::ActivateTabAt(int index, bool user_gesture) {
|
| FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
|
| ActiveTabChanged(old_contents, new_contents,
|
| active_index(), user_gesture));
|
| + NotifySelectionChanged(old_selected_indices);
|
| }
|
| }
|
|
|
| @@ -570,14 +572,17 @@ 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(selection_model().selected_indices());
|
| selection_model_.SetSelectionFromAnchorTo(index);
|
| // This may not have resulted in a change, but we assume it did.
|
| NotifyActiveTabChanged(old_active);
|
| + NotifySelectionChanged(old_selected_indices);
|
| }
|
|
|
| void TabStripModel::ToggleSelectionAt(int index) {
|
| DCHECK(ContainsIndex(index));
|
| int old_active = active_index();
|
| + std::vector<int> old_selected_indices(selection_model().selected_indices());
|
| if (selection_model_.IsSelected(index)) {
|
| if (selection_model_.size() == 1) {
|
| // One tab must be selected and this tab is currently selected so we can't
|
| @@ -594,12 +599,15 @@ void TabStripModel::ToggleSelectionAt(int index) {
|
| selection_model_.set_active(index);
|
| }
|
| NotifyActiveTabChanged(old_active);
|
| + NotifySelectionChanged(old_selected_indices);
|
| }
|
|
|
| void TabStripModel::AddSelectionFromAnchorTo(int index) {
|
| int old_active = active_index();
|
| + std::vector<int> old_selected_indices(selection_model().selected_indices());
|
| selection_model_.AddSelectionFromAnchorTo(index);
|
| NotifyActiveTabChanged(old_active);
|
| + NotifySelectionChanged(old_selected_indices);
|
| }
|
|
|
| bool TabStripModel::IsTabSelected(int index) const {
|
| @@ -611,9 +619,11 @@ void TabStripModel::SetSelectionFromModel(
|
| const TabStripSelectionModel& source) {
|
| DCHECK_NE(TabStripSelectionModel::kUnselectedIndex, source.active());
|
| int old_active_index = active_index();
|
| + std::vector<int> old_selected_indices(selection_model().selected_indices());
|
| selection_model_.Copy(source);
|
| // This may not have resulted in a change, but we assume it did.
|
| NotifyActiveTabChanged(old_active_index);
|
| + NotifySelectionChanged(old_selected_indices);
|
| }
|
|
|
| void TabStripModel::AddTabContents(TabContentsWrapper* contents,
|
| @@ -1236,6 +1246,13 @@ void TabStripModel::NotifyActiveTabChanged(int old_active_index) {
|
| ActiveTabChanged(old_tab, new_tab, active_index(), true));
|
| }
|
|
|
| +void TabStripModel::NotifySelectionChanged(
|
| + const std::vector<int>& old_selected_indices) {
|
| + FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
|
| + TabSelectionChanged(old_selected_indices,
|
| + selection_model().selected_indices()));
|
| +}
|
| +
|
| void TabStripModel::SelectRelativeTab(bool next) {
|
| // This may happen during automated testing or if a user somehow buffers
|
| // many key accelerators.
|
|
|