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

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

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