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

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

Issue 329021: Makes inactive pinned tabs throb on views when the title changes.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 1 month 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/views/tabs/tab_renderer.cc ('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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/views/tabs/tab_strip.h" 5 #include "chrome/browser/views/tabs/tab_strip.h"
6 6
7 #include "app/drag_drop_types.h" 7 #include "app/drag_drop_types.h"
8 #include "app/gfx/canvas.h" 8 #include "app/gfx/canvas.h"
9 #include "app/gfx/path.h" 9 #include "app/gfx/path.h"
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 1038 matching lines...) Expand 10 before | Expand all | Expand 10 after
1049 DCHECK(index >= 0 && index < GetTabCount()); 1049 DCHECK(index >= 0 && index < GetTabCount());
1050 if (CanUpdateDisplay()) { 1050 if (CanUpdateDisplay()) {
1051 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are 1051 // We have "tiny tabs" if the tabs are so tiny that the unselected ones are
1052 // a different size to the selected ones. 1052 // a different size to the selected ones.
1053 bool tiny_tabs = current_unselected_width_ != current_selected_width_; 1053 bool tiny_tabs = current_unselected_width_ != current_selected_width_;
1054 if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) { 1054 if (!IsAnimating() && (!resize_layout_scheduled_ || tiny_tabs)) {
1055 Layout(); 1055 Layout();
1056 } else { 1056 } else {
1057 SchedulePaint(); 1057 SchedulePaint();
1058 } 1058 }
1059
1060 int old_index = model_->GetIndexOfTabContents(old_contents);
1061 if (old_index >= 0)
1062 GetTabAt(old_index)->StopPinnedTabTitleAnimation();
1059 } 1063 }
1060 } 1064 }
1061 1065
1062 void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index, 1066 void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index,
1063 bool pinned_state_changed) { 1067 bool pinned_state_changed) {
1064 gfx::Rect start_bounds = GetIdealBounds(from_index); 1068 gfx::Rect start_bounds = GetIdealBounds(from_index);
1065 Tab* tab = GetTabAt(from_index); 1069 Tab* tab = GetTabAt(from_index);
1066 tab_data_.erase(tab_data_.begin() + from_index); 1070 tab_data_.erase(tab_data_.begin() + from_index);
1067 TabData data = {tab, gfx::Rect()}; 1071 TabData data = {tab, gfx::Rect()};
1068 tab->set_pinned(model_->IsTabPinned(to_index)); 1072 tab->set_pinned(model_->IsTabPinned(to_index));
1069 tab_data_.insert(tab_data_.begin() + to_index, data); 1073 tab_data_.insert(tab_data_.begin() + to_index, data);
1070 if (pinned_state_changed) { 1074 if (pinned_state_changed) {
1071 StartPinAndMoveTabAnimation(from_index, to_index, start_bounds); 1075 StartPinAndMoveTabAnimation(from_index, to_index, start_bounds);
1072 } else { 1076 } else {
1073 GenerateIdealBounds(); 1077 GenerateIdealBounds();
1074 StartMoveTabAnimation(from_index, to_index); 1078 StartMoveTabAnimation(from_index, to_index);
1075 } 1079 }
1076 } 1080 }
1077 1081
1078 void TabStrip::TabChangedAt(TabContents* contents, int index, 1082 void TabStrip::TabChangedAt(TabContents* contents, int index,
1079 TabChangeType change_type) { 1083 TabChangeType change_type) {
1080 // Index is in terms of the model. Need to make sure we adjust that index in 1084 // Index is in terms of the model. Need to make sure we adjust that index in
1081 // case we have an animation going. 1085 // case we have an animation going.
1082 Tab* tab = GetTabAtAdjustForAnimation(index); 1086 Tab* tab = GetTabAtAdjustForAnimation(index);
1083 if (change_type == TITLE_NOT_LOADING) { 1087 if (change_type == TITLE_NOT_LOADING) {
1084 // TODO(sky): make this work. 1088 if (tab->pinned() && !tab->IsSelected())
1085 // if (tab->is_pinned() && !tab->IsSelected()) 1089 tab->StartPinnedTabTitleAnimation();
1086 // tab->StartPinnedTabTitleAnimation();
1087 // We'll receive another notification of the change asynchronously. 1090 // We'll receive another notification of the change asynchronously.
1088 return; 1091 return;
1089 } 1092 }
1090 tab->UpdateData(contents, change_type == LOADING_ONLY); 1093 tab->UpdateData(contents, change_type == LOADING_ONLY);
1091 tab->UpdateFromModel(); 1094 tab->UpdateFromModel();
1092 } 1095 }
1093 1096
1094 void TabStrip::TabPinnedStateChanged(TabContents* contents, int index) { 1097 void TabStrip::TabPinnedStateChanged(TabContents* contents, int index) {
1095 GetTabAt(index)->set_pinned(model_->IsTabPinned(index)); 1098 GetTabAt(index)->set_pinned(model_->IsTabPinned(index));
1096 StartPinnedTabAnimation(index); 1099 StartPinnedTabAnimation(index);
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after
1987 &TabStrip::ResizeLayoutTabs), 1990 &TabStrip::ResizeLayoutTabs),
1988 kResizeTabsTimeMs); 1991 kResizeTabsTimeMs);
1989 } 1992 }
1990 } else { 1993 } else {
1991 // Mouse moved quickly out of the tab strip and then into it again, so 1994 // Mouse moved quickly out of the tab strip and then into it again, so
1992 // cancel the timer so that the strip doesn't move when the mouse moves 1995 // cancel the timer so that the strip doesn't move when the mouse moves
1993 // back over it. 1996 // back over it.
1994 resize_layout_factory_.RevokeAll(); 1997 resize_layout_factory_.RevokeAll();
1995 } 1998 }
1996 } 1999 }
OLDNEW
« no previous file with comments | « chrome/browser/views/tabs/tab_renderer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698