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

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: Rebasing 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
« no previous file with comments | « chrome/browser/ui/views/tabs/tab_strip.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include <vector> 8 #include <vector>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/stl_util-inl.h" 11 #include "base/stl_util-inl.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/browser/defaults.h" 13 #include "chrome/browser/defaults.h"
14 #include "chrome/browser/tabs/tab_strip_selection_model.h"
14 #include "chrome/browser/themes/theme_service.h" 15 #include "chrome/browser/themes/theme_service.h"
15 #include "chrome/browser/ui/view_ids.h" 16 #include "chrome/browser/ui/view_ids.h"
16 #include "chrome/browser/ui/views/tabs/tab.h" 17 #include "chrome/browser/ui/views/tabs/tab.h"
17 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h" 18 #include "chrome/browser/ui/views/tabs/tab_strip_controller.h"
18 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
19 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
20 #include "grit/theme_resources_standard.h" 21 #include "grit/theme_resources_standard.h"
21 #include "ui/base/accessibility/accessible_view_state.h" 22 #include "ui/base/accessibility/accessible_view_state.h"
22 #include "ui/base/animation/animation_container.h" 23 #include "ui/base/animation/animation_container.h"
23 #include "ui/base/dragdrop/drag_drop_types.h" 24 #include "ui/base/dragdrop/drag_drop_types.h"
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 AddMessageLoopObserver(); 230 AddMessageLoopObserver();
230 } 231 }
231 232
232 void TabStrip::RemoveTabAt(int model_index) { 233 void TabStrip::RemoveTabAt(int model_index) {
233 if (in_tab_close_ && model_index != GetModelCount()) 234 if (in_tab_close_ && model_index != GetModelCount())
234 StartMouseInitiatedRemoveTabAnimation(model_index); 235 StartMouseInitiatedRemoveTabAnimation(model_index);
235 else 236 else
236 StartRemoveTabAnimation(model_index); 237 StartRemoveTabAnimation(model_index);
237 } 238 }
238 239
239 void TabStrip::SelectTabAt(int old_model_index, int new_model_index) { 240 void TabStrip::SetSelection(const TabStripSelectionModel& old_selection,
241 const TabStripSelectionModel& new_selection) {
240 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are 242 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are
241 // a different size to the selected ones. 243 // a different size to the selected ones.
242 bool tiny_tabs = current_unselected_width_ != current_selected_width_; 244 bool tiny_tabs = current_unselected_width_ != current_selected_width_;
243 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) { 245 if (!IsAnimating() && (!in_tab_close_ || tiny_tabs)) {
244 DoLayout(); 246 DoLayout();
245 } else { 247 } else {
246 SchedulePaint(); 248 SchedulePaint();
247 } 249 }
248 250
249 if (old_model_index >= 0) { 251 TabStripSelectionModel::SelectedIndices no_longer_selected;
250 GetTabAtTabDataIndex(ModelIndexToTabIndex(old_model_index))-> 252 std::insert_iterator<TabStripSelectionModel::SelectedIndices>
253 it(no_longer_selected, no_longer_selected.begin());
254 std::set_difference(old_selection.selected_indices().begin(),
255 old_selection.selected_indices().end(),
256 new_selection.selected_indices().begin(),
257 new_selection.selected_indices().end(),
258 it);
259 for (size_t i = 0; i < no_longer_selected.size(); ++i) {
260 GetTabAtTabDataIndex(ModelIndexToTabIndex(no_longer_selected[i]))->
251 StopMiniTabTitleAnimation(); 261 StopMiniTabTitleAnimation();
252 } 262 }
253 } 263 }
254 264
255 void TabStrip::TabTitleChangedNotLoading(int model_index) { 265 void TabStrip::TabTitleChangedNotLoading(int model_index) {
256 Tab* tab = GetTabAtModelIndex(model_index); 266 Tab* tab = GetTabAtModelIndex(model_index);
257 if (tab->data().mini && !tab->IsActive()) 267 if (tab->data().mini && !tab->IsActive())
258 tab->StartMiniTabTitleAnimation(); 268 tab->StartMiniTabTitleAnimation();
259 } 269 }
260 270
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 } 1014 }
1005 return mini_count; 1015 return mini_count;
1006 } 1016 }
1007 1017
1008 bool TabStrip::IsPointInTab(Tab* tab, 1018 bool TabStrip::IsPointInTab(Tab* tab,
1009 const gfx::Point& point_in_tabstrip_coords) { 1019 const gfx::Point& point_in_tabstrip_coords) {
1010 gfx::Point point_in_tab_coords(point_in_tabstrip_coords); 1020 gfx::Point point_in_tab_coords(point_in_tabstrip_coords);
1011 View::ConvertPointToView(this, tab, &point_in_tab_coords); 1021 View::ConvertPointToView(this, tab, &point_in_tab_coords);
1012 return tab->HitTest(point_in_tab_coords); 1022 return tab->HitTest(point_in_tab_coords);
1013 } 1023 }
OLDNEW
« no previous file with comments | « 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