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

Side by Side Diff: chrome/browser/ui/views/tabs/tab_strip.cc

Issue 7033048: Multi-tab: Adding new Notification when tab selection changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing comments Created 9 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 AddMessageLoopObserver(); 222 AddMessageLoopObserver();
223 } 223 }
224 224
225 void TabStrip::RemoveTabAt(int model_index) { 225 void TabStrip::RemoveTabAt(int model_index) {
226 if (in_tab_close_ && model_index != GetModelCount()) 226 if (in_tab_close_ && model_index != GetModelCount())
227 StartMouseInitiatedRemoveTabAnimation(model_index); 227 StartMouseInitiatedRemoveTabAnimation(model_index);
228 else 228 else
229 StartRemoveTabAnimation(model_index); 229 StartRemoveTabAnimation(model_index);
230 } 230 }
231 231
232 void TabStrip::SelectTabAt(int old_model_index, int new_model_index) { 232 void TabStrip::SetSelection(const TabStripSelectionModel& old_selection,
233 const TabStripSelectionModel& new_selection) {
233 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are 234 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are
234 // a different size to the selected ones. 235 // a different size to the selected ones.
235 bool tiny_tabs = current_unselected_width_ != current_selected_width_; 236 bool tiny_tabs = current_unselected_width_ != current_selected_width_;
236 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { 237 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) {
237 DoLayout(); 238 DoLayout();
238 } else { 239 } else {
239 SchedulePaint(); 240 SchedulePaint();
240 } 241 }
241 242
242 if (old_model_index >= 0) { 243 TabStripSelectionModel::SelectedIndices no_longer_selected;
243 GetTabAtTabDataIndex(ModelIndexToTabIndex(old_model_index))-> 244 std::set_difference(old_selection.selected_indices().begin(),
245 old_selection.selected_indices().end(),
246 new_selection.selected_indices().begin(),
247 new_selection.selected_indices().end(),
248 no_longer_selected.begin());
249 for (size_t i = 0; i < no_longer_selected.size(); ++i) {
250 GetTabAtTabDataIndex(ModelIndexToTabIndex(no_longer_selected[i]))->
244 StopMiniTabTitleAnimation(); 251 StopMiniTabTitleAnimation();
245 } 252 }
246 } 253 }
247 254
248 void TabStrip::TabTitleChangedNotLoading(int model_index) { 255 void TabStrip::TabTitleChangedNotLoading(int model_index) {
249 Tab* tab = GetTabAtModelIndex(model_index); 256 Tab* tab = GetTabAtModelIndex(model_index);
250 if (tab->data().mini && !tab->IsActive()) 257 if (tab->data().mini && !tab->IsActive())
251 tab->StartMiniTabTitleAnimation(); 258 tab->StartMiniTabTitleAnimation();
252 } 259 }
253 260
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
999 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const { 1006 int TabStrip::GetAvailableWidthForTabs(Tab* last_tab) const {
1000 return last_tab->x() + last_tab->width(); 1007 return last_tab->x() + last_tab->width();
1001 } 1008 }
1002 1009
1003 bool TabStrip::IsPointInTab(Tab* tab, 1010 bool TabStrip::IsPointInTab(Tab* tab,
1004 const gfx::Point& point_in_tabstrip_coords) { 1011 const gfx::Point& point_in_tabstrip_coords) {
1005 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 1012 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
1006 View::ConvertPointToView(this, tab, &point_in_tab_coords); 1013 View::ConvertPointToView(this, tab, &point_in_tab_coords);
1007 return tab->HitTest(point_in_tab_coords); 1014 return tab->HitTest(point_in_tab_coords);
1008 } 1015 }
OLDNEW
« chrome/browser/ui/views/tabs/side_tab_strip.h ('K') | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698