OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 5 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 AddMessageLoopObserver(); | 228 AddMessageLoopObserver(); |
229 } | 229 } |
230 | 230 |
231 void TabStrip::RemoveTabAt(int model_index) { | 231 void TabStrip::RemoveTabAt(int model_index) { |
232 if (in_tab_close_ && model_index != GetModelCount()) | 232 if (in_tab_close_ && model_index != GetModelCount()) |
233 StartMouseInitiatedRemoveTabAnimation(model_index); | 233 StartMouseInitiatedRemoveTabAnimation(model_index); |
234 else | 234 else |
235 StartRemoveTabAnimation(model_index); | 235 StartRemoveTabAnimation(model_index); |
236 } | 236 } |
237 | 237 |
238 void TabStrip::SelectTabAt(int old_model_index, int new_model_index) { | 238 void TabStrip::SetSelection(const TabStripSelectionModel& old_selection, |
| 239 const TabStripSelectionModel& new_selection) { |
239 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are | 240 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are |
240 // a different size to the selected ones. | 241 // a different size to the selected ones. |
241 bool tiny_tabs = current_unselected_width_ != current_selected_width_; | 242 bool tiny_tabs = current_unselected_width_ != current_selected_width_; |
242 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { | 243 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { |
243 DoLayout(); | 244 DoLayout(); |
244 } else { | 245 } else { |
245 SchedulePaint(); | 246 SchedulePaint(); |
246 } | 247 } |
247 | 248 |
248 if (old_model_index >= 0) { | 249 TabStripSelectionModel::SelectedIndices no_longer_selected; |
249 GetTabAtTabDataIndex(ModelIndexToTabIndex(old_model_index))-> | 250 std::set_difference(old_selection.selected_indices().begin(), |
| 251 old_selection.selected_indices().end(), |
| 252 new_selection.selected_indices().begin(), |
| 253 new_selection.selected_indices().end(), |
| 254 no_longer_selected.begin()); |
| 255 for (size_t i = 0; i < no_longer_selected.size(); ++i) { |
| 256 GetTabAtTabDataIndex(ModelIndexToTabIndex(no_longer_selected[i]))-> |
250 StopMiniTabTitleAnimation(); | 257 StopMiniTabTitleAnimation(); |
251 } | 258 } |
252 } | 259 } |
253 | 260 |
254 void TabStrip::TabTitleChangedNotLoading(int model_index) { | 261 void TabStrip::TabTitleChangedNotLoading(int model_index) { |
255 Tab* tab = GetTabAtModelIndex(model_index); | 262 Tab* tab = GetTabAtModelIndex(model_index); |
256 if (tab->data().mini && !tab->IsActive()) | 263 if (tab->data().mini && !tab->IsActive()) |
257 tab->StartMiniTabTitleAnimation(); | 264 tab->StartMiniTabTitleAnimation(); |
258 } | 265 } |
259 | 266 |
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 } | 1008 } |
1002 return mini_count; | 1009 return mini_count; |
1003 } | 1010 } |
1004 | 1011 |
1005 bool TabStrip::IsPointInTab(Tab* tab, | 1012 bool TabStrip::IsPointInTab(Tab* tab, |
1006 const gfx::Point& point_in_tabstrip_coords) { | 1013 const gfx::Point& point_in_tabstrip_coords) { |
1007 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); | 1014 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); |
1008 View::ConvertPointToView(this, tab, &point_in_tab_coords); | 1015 View::ConvertPointToView(this, tab, &point_in_tab_coords); |
1009 return tab->HitTest(point_in_tab_coords); | 1016 return tab->HitTest(point_in_tab_coords); |
1010 } | 1017 } |
OLD | NEW |