summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 17:19:03 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 17:19:03 +0000
commitf1cd5e88af6f0d088d7b90a8f4b69da63aa994af (patch)
treeba1f8cd8109f97b8f7b559f1cda022d9485d00ca /chrome
parent00f6b77b89dcd900c873ed9da13dbaa2e90fe022 (diff)
downloadchromium_src-f1cd5e88af6f0d088d7b90a8f4b69da63aa994af.zip
chromium_src-f1cd5e88af6f0d088d7b90a8f4b69da63aa994af.tar.gz
chromium_src-f1cd5e88af6f0d088d7b90a8f4b69da63aa994af.tar.bz2
Makes inactive pinned tabs on linux throb when the title changes. I
need to resolve with Glen/Nicholas how to handle the windows side. BUG=25308 TEST=none Review URL: http://codereview.chromium.org/314010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29903 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser.cc21
-rw-r--r--chrome/browser/cocoa/tab_strip_model_observer_bridge.h2
-rw-r--r--chrome/browser/cocoa/tab_strip_model_observer_bridge.mm9
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.cc2
-rw-r--r--chrome/browser/extensions/extension_browser_event_router.h3
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.cc61
-rw-r--r--chrome/browser/gtk/tabs/tab_renderer_gtk.h13
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.cc14
-rw-r--r--chrome/browser/gtk/tabs/tab_strip_gtk.h2
-rw-r--r--chrome/browser/tab_contents/interstitial_page.cc4
-rw-r--r--chrome/browser/tab_contents/tab_contents.cc2
-rw-r--r--chrome/browser/tab_contents/tab_contents.h3
-rw-r--r--chrome/browser/tabs/tab_strip_model.cc5
-rw-r--r--chrome/browser/tabs/tab_strip_model.h30
-rw-r--r--chrome/browser/tabs/tab_strip_model_unittest.cc4
-rw-r--r--chrome/browser/views/tabs/tab_overview_controller.cc2
-rw-r--r--chrome/browser/views/tabs/tab_overview_controller.h2
-rw-r--r--chrome/browser/views/tabs/tab_strip.cc11
-rw-r--r--chrome/browser/views/tabs/tab_strip.h2
19 files changed, 139 insertions, 53 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index da092b3..07058af 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -2461,12 +2461,23 @@ void Browser::ScheduleUIUpdate(const TabContents* source,
// immediately start/stop, which gives a more snappy feel. We want to do
// this for any tab so they start & stop quickly.
tabstrip_model_.UpdateTabContentsStateAt(
- tabstrip_model_.GetIndexOfController(&source->controller()), true);
+ tabstrip_model_.GetIndexOfController(&source->controller()),
+ TabStripModelObserver::LOADING_ONLY);
// The status bubble needs to be updated during INVALIDATE_LOAD too, but
// we do that asynchronously by not stripping INVALIDATE_LOAD from
// changed_flags.
}
+ if (changed_flags & TabContents::INVALIDATE_TITLE && !source->is_loading()) {
+ // To correctly calculate whether the title changed while not loading
+ // we need to process the update synchronously. This state only matters for
+ // the TabStripModel, so we notify the TabStripModel now and notify others
+ // asynchronously.
+ tabstrip_model_.UpdateTabContentsStateAt(
+ tabstrip_model_.GetIndexOfController(&source->controller()),
+ TabStripModelObserver::TITLE_NOT_LOADING);
+ }
+
if (changed_flags & TabContents::INVALIDATE_BOOKMARK_BAR ||
changed_flags & TabContents::INVALIDATE_EXTENSION_SHELF) {
window()->ShelfVisibilityChanged();
@@ -2526,7 +2537,8 @@ void Browser::ProcessPendingUIUpdates() {
if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble())
GetStatusBubble()->SetStatus(contents->GetStatusText());
- if (flags & TabContents::INVALIDATE_TAB) {
+ if (flags & (TabContents::INVALIDATE_TAB |
+ TabContents::INVALIDATE_TITLE)) {
command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS,
!contents->GetFavIcon().isNull());
window_->UpdateTitleBar();
@@ -2534,9 +2546,10 @@ void Browser::ProcessPendingUIUpdates() {
}
// Updates that don't depend upon the selected state go here.
- if (flags & TabContents::INVALIDATE_TAB) {
+ if (flags & (TabContents::INVALIDATE_TAB | TabContents::INVALIDATE_TITLE)) {
tabstrip_model_.UpdateTabContentsStateAt(
- tabstrip_model_.GetIndexOfTabContents(contents), false);
+ tabstrip_model_.GetIndexOfTabContents(contents),
+ TabStripModelObserver::ALL);
}
// We don't need to process INVALIDATE_STATE, since that's not visible.
diff --git a/chrome/browser/cocoa/tab_strip_model_observer_bridge.h b/chrome/browser/cocoa/tab_strip_model_observer_bridge.h
index 1934979..0f3783f 100644
--- a/chrome/browser/cocoa/tab_strip_model_observer_bridge.h
+++ b/chrome/browser/cocoa/tab_strip_model_observer_bridge.h
@@ -36,7 +36,7 @@ class TabStripModelObserverBridge : public TabStripModelObserver {
int to_index,
bool pinned_state_changed);
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only);
+ TabChangeType change_type);
virtual void TabStripEmpty();
private:
diff --git a/chrome/browser/cocoa/tab_strip_model_observer_bridge.mm b/chrome/browser/cocoa/tab_strip_model_observer_bridge.mm
index 8a306ab..d11da02 100644
--- a/chrome/browser/cocoa/tab_strip_model_observer_bridge.mm
+++ b/chrome/browser/cocoa/tab_strip_model_observer_bridge.mm
@@ -73,12 +73,17 @@ void TabStripModelObserverBridge::TabMoved(TabContents* contents,
void TabStripModelObserverBridge::TabChangedAt(TabContents* contents,
int index,
- bool loading_only) {
+ TabChangeType change_type) {
+ if (change_type == TITLE_NOT_LOADING) {
+ // TODO(sky): make this work.
+ // We'll receive another notification of the change asynchronously.
+ return;
+ }
if ([controller_ respondsToSelector:
@selector(tabChangedWithContents:atIndex:loadingOnly:)]) {
[controller_ tabChangedWithContents:contents
atIndex:index
- loadingOnly:loading_only ? YES : NO];
+ loadingOnly:change_type == LOADING_ONLY ? YES : NO];
}
}
diff --git a/chrome/browser/extensions/extension_browser_event_router.cc b/chrome/browser/extensions/extension_browser_event_router.cc
index 63ef0f7..fceb610 100644
--- a/chrome/browser/extensions/extension_browser_event_router.cc
+++ b/chrome/browser/extensions/extension_browser_event_router.cc
@@ -345,7 +345,7 @@ void ExtensionBrowserEventRouter::Observe(NotificationType type,
void ExtensionBrowserEventRouter::TabChangedAt(TabContents* contents,
int index,
- bool loading_only) {
+ TabChangeType change_type) {
TabUpdated(contents, false);
}
diff --git a/chrome/browser/extensions/extension_browser_event_router.h b/chrome/browser/extensions/extension_browser_event_router.h
index dd56d29..788229d 100644
--- a/chrome/browser/extensions/extension_browser_event_router.h
+++ b/chrome/browser/extensions/extension_browser_event_router.h
@@ -49,7 +49,8 @@ class ExtensionBrowserEventRouter : public TabStripModelObserver,
bool user_gesture);
void TabMoved(TabContents* contents, int from_index, int to_index,
bool pinned_state_changed);
- void TabChangedAt(TabContents* contents, int index, bool loading_only);
+ void TabChangedAt(TabContents* contents, int index,
+ TabChangeType change_type);
void TabStripEmpty();
// Page Action execute event.
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
index 658d01f..e41f6a5 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc
@@ -12,6 +12,7 @@
#include "app/gfx/skbitmap_operations.h"
#include "app/l10n_util.h"
#include "app/resource_bundle.h"
+#include "app/throb_animation.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/defaults.h"
#include "chrome/browser/gtk/bookmark_utils_gtk.h"
@@ -55,6 +56,12 @@ const int kHoverDurationMs = 90;
// How opaque to make the hover state (out of 1).
const double kHoverOpacity = 0.33;
+// Max opacity for the pinned tab title change animation.
+const double kPinnedThrobOpacity = 0.75;
+
+// Duration for when the title of an inactive pinned tab changes.
+const int kPinnedDuration = 1000;
+
const SkScalar kTabCapWidth = 15;
const SkScalar kTabTopCurveWidth = 4;
const SkScalar kTabBottomCurveWidth = 3;
@@ -376,16 +383,14 @@ void TabRendererGtk::PaintFavIconArea(GdkEventExpose* event) {
favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.width(), favicon_bounds_.height());
- // Draw our hover state.
if (!IsSelected()) {
- Animation* animation = hover_animation_.get();
- if (animation->GetCurrentValue() > 0) {
+ double throb_value = GetThrobValue();
+ if (throb_value > 0) {
SkRect bounds;
bounds.set(favicon_bounds_.x(), favicon_bounds_.y(),
favicon_bounds_.right(), favicon_bounds_.bottom());
- canvas.saveLayerAlpha(&bounds,
- static_cast<int>(animation->GetCurrentValue() * kHoverOpacity * 0xff),
- SkCanvas::kARGB_ClipLayer_SaveFlag);
+ canvas.saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff),
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
canvas.drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
SkBitmap* active_bg = theme_provider_->GetBitmapNamed(IDR_THEME_TOOLBAR);
canvas.TileImageInt(*active_bg,
@@ -486,6 +491,28 @@ gfx::Rect TabRendererGtk::GetRequisition() const {
requisition_.width(), requisition_.height());
}
+void TabRendererGtk::StartPinnedTabTitleAnimation() {
+ if (!pinned_title_animation_.get()) {
+ pinned_title_animation_.reset(new ThrobAnimation(this));
+ pinned_title_animation_->SetThrobDuration(kPinnedDuration);
+ }
+
+ if (!pinned_title_animation_->IsAnimating()) {
+ pinned_title_animation_->StartThrobbing(2);
+ } else if (pinned_title_animation_->cycles_remaining() <= 2) {
+ // The title changed while we're already animating. Add at most one more
+ // cycle. This is done in an attempt to smooth out pages that continuously
+ // change the title.
+ pinned_title_animation_->set_cycles_remaining(
+ pinned_title_animation_->cycles_remaining() + 2);
+ }
+}
+
+void TabRendererGtk::StopPinnedTabTitleAnimation() {
+ if (pinned_title_animation_.get())
+ pinned_title_animation_->Stop();
+}
+
void TabRendererGtk::SetBounds(const gfx::Rect& bounds) {
requisition_ = bounds;
gtk_widget_set_size_request(tab_.get(), bounds.width(), bounds.height());
@@ -789,17 +816,14 @@ void TabRendererGtk::PaintTabBackground(gfx::Canvas* canvas) {
// the active representation for the dragged tab.
PaintActiveTabBackground(canvas);
} else {
- // Draw our hover state.
- Animation* animation = hover_animation_.get();
-
PaintInactiveTabBackground(canvas);
- if (animation->GetCurrentValue() > 0) {
+
+ double throb_value = GetThrobValue();
+ if (throb_value > 0) {
SkRect bounds;
- bounds.set(0, 0,
- SkIntToScalar(width()), SkIntToScalar(height()));
- canvas->saveLayerAlpha(&bounds,
- static_cast<int>(animation->GetCurrentValue() * kHoverOpacity * 0xff),
- SkCanvas::kARGB_ClipLayer_SaveFlag);
+ bounds.set(0, 0, SkIntToScalar(width()), SkIntToScalar(height()));
+ canvas->saveLayerAlpha(&bounds, static_cast<int>(throb_value * 0xff),
+ SkCanvas::kARGB_ClipLayer_SaveFlag);
canvas->drawARGB(0, 255, 255, 255, SkXfermode::kClear_Mode);
PaintActiveTabBackground(canvas);
canvas->restore();
@@ -933,6 +957,13 @@ CustomDrawButton* TabRendererGtk::MakeCloseButton() {
return button;
}
+double TabRendererGtk::GetThrobValue() {
+ if (pinned_title_animation_.get() && pinned_title_animation_->IsAnimating())
+ return pinned_title_animation_->GetCurrentValue() * kPinnedThrobOpacity;
+ return hover_animation_.get() ?
+ kHoverOpacity * hover_animation_->GetCurrentValue() : 0;
+}
+
void TabRendererGtk::CloseButtonClicked() {
// Nothing to do.
}
diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.h b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
index e0fc2d7..2544e6e9 100644
--- a/chrome/browser/gtk/tabs/tab_renderer_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.h
@@ -28,6 +28,7 @@ class CustomDrawButton;
class GtkThemeProvider;
class TabContents;
class ThemeProvider;
+class ThrobAnimation;
class TabRendererGtk : public AnimationDelegate {
public:
@@ -185,6 +186,10 @@ class TabRendererGtk : public AnimationDelegate {
GtkWidget* widget() const { return tab_.get(); }
+ // Start/stop the pinned tab title animation.
+ void StartPinnedTabTitleAnimation();
+ void StopPinnedTabTitleAnimation();
+
protected:
const gfx::Rect& title_bounds() const { return title_bounds_; }
const gfx::Rect& close_button_bounds() const { return close_button_bounds_; }
@@ -301,6 +306,11 @@ class TabRendererGtk : public AnimationDelegate {
CustomDrawButton* MakeCloseButton();
+ // Gets the throb value for the tab. When a tab is not selected the
+ // active background is drawn at |GetThrobValue()|%. This is used for hover
+ // and pinned tab title change effects.
+ double GetThrobValue();
+
// Handles the clicked signal for the close button.
static void OnCloseButtonClicked(GtkWidget* widget, TabRendererGtk* tab);
@@ -371,6 +381,9 @@ class TabRendererGtk : public AnimationDelegate {
// Hover animation.
scoped_ptr<SlideAnimation> hover_animation_;
+ // Animation used when the title of an inactive pinned tab changes.
+ scoped_ptr<ThrobAnimation> pinned_title_animation_;
+
// Contains the loading animation state.
LoadingAnimation loading_animation_;
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.cc b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
index 4c742ab..7b85532 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.cc
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.cc
@@ -990,8 +990,10 @@ void TabStripGtk::TabSelectedAt(TabContents* old_contents,
GetTabAt(index)->SchedulePaint();
int old_index = model_->GetIndexOfTabContents(old_contents);
- if (old_index >= 0)
+ if (old_index >= 0) {
GetTabAt(old_index)->SchedulePaint();
+ GetTabAt(old_index)->StopPinnedTabTitleAnimation();
+ }
}
}
@@ -1014,11 +1016,17 @@ void TabStripGtk::TabMoved(TabContents* contents,
}
void TabStripGtk::TabChangedAt(TabContents* contents, int index,
- bool loading_only) {
+ TabChangeType change_type) {
// Index is in terms of the model. Need to make sure we adjust that index in
// case we have an animation going.
TabGtk* tab = GetTabAtAdjustForAnimation(index);
- tab->UpdateData(contents, loading_only);
+ if (change_type == TITLE_NOT_LOADING) {
+ if (tab->is_pinned() && !tab->IsSelected())
+ tab->StartPinnedTabTitleAnimation();
+ // We'll receive another notification of the change asynchronously.
+ return;
+ }
+ tab->UpdateData(contents, change_type == LOADING_ONLY);
tab->UpdateFromModel();
}
diff --git a/chrome/browser/gtk/tabs/tab_strip_gtk.h b/chrome/browser/gtk/tabs/tab_strip_gtk.h
index 21c5c18..b8173c3 100644
--- a/chrome/browser/gtk/tabs/tab_strip_gtk.h
+++ b/chrome/browser/gtk/tabs/tab_strip_gtk.h
@@ -105,7 +105,7 @@ class TabStripGtk : public TabStripModelObserver,
int to_index,
bool pinned_state_changed);
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only);
+ TabChangeType change_type);
virtual void TabPinnedStateChanged(TabContents* contents, int index);
// TabGtk::TabDelegate implementation:
diff --git a/chrome/browser/tab_contents/interstitial_page.cc b/chrome/browser/tab_contents/interstitial_page.cc
index 024f250..3a6b7c6 100644
--- a/chrome/browser/tab_contents/interstitial_page.cc
+++ b/chrome/browser/tab_contents/interstitial_page.cc
@@ -242,7 +242,7 @@ void InterstitialPage::Hide() {
NavigationEntry* entry = tab_->controller().GetActiveEntry();
if (!new_navigation_ && should_revert_tab_title_) {
entry->set_title(WideToUTF16Hack(original_tab_title_));
- tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB);
+ tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
}
delete this;
}
@@ -369,7 +369,7 @@ void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host,
should_revert_tab_title_ = true;
}
entry->set_title(WideToUTF16Hack(title));
- tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TAB);
+ tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE);
}
void InterstitialPage::DomOperationResponse(const std::string& json_string,
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 089545f..e33df336 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -2129,7 +2129,7 @@ void TabContents::UpdateTitle(RenderViewHost* rvh,
// Broadcast notifications when the UI should be updated.
if (entry == controller_.GetEntryAtOffset(0))
- NotifyNavigationStateChanged(INVALIDATE_TAB);
+ NotifyNavigationStateChanged(INVALIDATE_TITLE);
}
void TabContents::UpdateEncoding(RenderViewHost* render_view_host,
diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h
index 78ccc14..98e2d2c 100644
--- a/chrome/browser/tab_contents/tab_contents.h
+++ b/chrome/browser/tab_contents/tab_contents.h
@@ -104,7 +104,7 @@ class TabContents : public PageNavigator,
// what has changed. Combine them to update more than one thing.
enum InvalidateTypes {
INVALIDATE_URL = 1 << 0, // The URL has changed.
- INVALIDATE_TAB = 1 << 1, // The tab (favicon, title, etc.) has
+ INVALIDATE_TAB = 1 << 1, // The favicon, or crashed state
// changed.
INVALIDATE_LOAD = 1 << 2, // The loading state has changed.
INVALIDATE_PAGE_ACTIONS = 1 << 3, // Page action icons have changed.
@@ -113,6 +113,7 @@ class TabContents : public PageNavigator,
INVALIDATE_EXTENSION_SHELF = 1 << 5, // State of
// IsExtensionShelfAlwaysVisible
// changed.
+ INVALIDATE_TITLE = 1 << 6, // The title changed.
};
// |base_tab_contents| is used if we want to size the new tab contents view
diff --git a/chrome/browser/tabs/tab_strip_model.cc b/chrome/browser/tabs/tab_strip_model.cc
index 2d3126c..1d0e9d9 100644
--- a/chrome/browser/tabs/tab_strip_model.cc
+++ b/chrome/browser/tabs/tab_strip_model.cc
@@ -202,11 +202,12 @@ int TabStripModel::GetIndexOfController(
return kNoTab;
}
-void TabStripModel::UpdateTabContentsStateAt(int index, bool loading_only) {
+void TabStripModel::UpdateTabContentsStateAt(int index,
+ TabStripModelObserver::TabChangeType change_type) {
DCHECK(ContainsIndex(index));
FOR_EACH_OBSERVER(TabStripModelObserver, observers_,
- TabChangedAt(GetContentsAt(index), index, loading_only));
+ TabChangedAt(GetContentsAt(index), index, change_type));
}
void TabStripModel::CloseAllTabs() {
diff --git a/chrome/browser/tabs/tab_strip_model.h b/chrome/browser/tabs/tab_strip_model.h
index 0c70378..d7643b1 100644
--- a/chrome/browser/tabs/tab_strip_model.h
+++ b/chrome/browser/tabs/tab_strip_model.h
@@ -42,6 +42,18 @@ class TabStripModel;
////////////////////////////////////////////////////////////////////////////////
class TabStripModelObserver {
public:
+ // Enumeration of the possible values supplied to TabChangedAt.
+ enum TabChangeType {
+ // Only the loading state changed.
+ LOADING_ONLY,
+
+ // Only the title changed and page isn't loading.
+ TITLE_NOT_LOADING,
+
+ // Change not characterized by LOADING_ONLY or TITLE_NOT_LOADING.
+ ALL
+ };
+
// A new TabContents was inserted into the TabStripModel at the specified
// index. |foreground| is whether or not it was opened in the foreground
// (selected).
@@ -83,16 +95,9 @@ class TabStripModelObserver {
// be an entirely different object and the old value is no longer available
// by the time this message is delivered.
//
- // If only the loading state was updated, the loading_only flag should be
- // specified. The tab model will update only the throbber, loading status,
- // and crashed state.
- //
- // If other things change, set this flag to false to update all state,
- // including the title and favicon. This allows us to start/stop throbbing
- // without updating the title (which may be an ugly URL if the real title
- // hasn't come in yet).
+ // See TabChangeType for a description of |change_type|.
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only) { }
+ TabChangeType change_type) {}
// Invoked when the pinned state of a tab changes.
// NOTE: this is only invoked if the tab doesn't move as a result of its
@@ -351,9 +356,10 @@ class TabStripModel : public NotificationObserver {
int GetIndexOfController(const NavigationController* controller) const;
// Notify any observers that the TabContents at the specified index has
- // changed in some way. Loading only specifies whether only the loading state
- // has changed.
- void UpdateTabContentsStateAt(int index, bool loading_only);
+ // changed in some way. See TabChangeType for details of |change_type|.
+ void UpdateTabContentsStateAt(
+ int index,
+ TabStripModelObserver::TabChangeType change_type);
// Make sure there is an auto-generated New Tab tab in the TabStripModel.
// If |force_create| is true, the New Tab will be created even if the
diff --git a/chrome/browser/tabs/tab_strip_model_unittest.cc b/chrome/browser/tabs/tab_strip_model_unittest.cc
index 081f1b4..70331f9 100644
--- a/chrome/browser/tabs/tab_strip_model_unittest.cc
+++ b/chrome/browser/tabs/tab_strip_model_unittest.cc
@@ -258,7 +258,7 @@ class MockTabStripModelObserver : public TabStripModelObserver {
states_.push_back(new State(contents, index, DETACH));
}
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only) {
+ TabChangeType change_type) {
states_.push_back(new State(contents, index, CHANGE));
}
virtual void TabPinnedStateChanged(TabContents* contents, int index) {
@@ -441,7 +441,7 @@ TEST_F(TabStripModelTest, TestBasicAPI) {
// Test UpdateTabContentsStateAt
{
- tabstrip.UpdateTabContentsStateAt(0, false);
+ tabstrip.UpdateTabContentsStateAt(0, TabStripModelObserver::ALL);
EXPECT_EQ(1, observer.GetStateCount());
State s1(contents2, 0, MockTabStripModelObserver::CHANGE);
EXPECT_TRUE(observer.StateEquals(0, s1));
diff --git a/chrome/browser/views/tabs/tab_overview_controller.cc b/chrome/browser/views/tabs/tab_overview_controller.cc
index 91e9dd6..ac5a251 100644
--- a/chrome/browser/views/tabs/tab_overview_controller.cc
+++ b/chrome/browser/views/tabs/tab_overview_controller.cc
@@ -279,7 +279,7 @@ void TabOverviewController::TabMoved(TabContents* contents,
}
void TabOverviewController::TabChangedAt(TabContents* contents, int index,
- bool loading_only) {
+ TabChangeType change_type) {
ConfigureCell(grid_->GetTabOverviewCellAt(index), index);
}
diff --git a/chrome/browser/views/tabs/tab_overview_controller.h b/chrome/browser/views/tabs/tab_overview_controller.h
index b71ba71..4fc2cf8 100644
--- a/chrome/browser/views/tabs/tab_overview_controller.h
+++ b/chrome/browser/views/tabs/tab_overview_controller.h
@@ -93,7 +93,7 @@ class TabOverviewController : public TabStripModelObserver {
int to_index,
bool pinned_state_changed);
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only);
+ TabChangeType change_type);
virtual void TabStripEmpty();
// Currently don't care about these as we're not rendering the selection.
virtual void TabDeselectedAt(TabContents* contents, int index) { }
diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc
index d94aa9a..d2fd993 100644
--- a/chrome/browser/views/tabs/tab_strip.cc
+++ b/chrome/browser/views/tabs/tab_strip.cc
@@ -1076,11 +1076,18 @@ void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index,
}
void TabStrip::TabChangedAt(TabContents* contents, int index,
- bool loading_only) {
+ TabChangeType change_type) {
// Index is in terms of the model. Need to make sure we adjust that index in
// case we have an animation going.
Tab* tab = GetTabAtAdjustForAnimation(index);
- tab->UpdateData(contents, loading_only);
+ if (change_type == TITLE_NOT_LOADING) {
+ // TODO(sky): make this work.
+ // if (tab->is_pinned() && !tab->IsSelected())
+ // tab->StartPinnedTabTitleAnimation();
+ // We'll receive another notification of the change asynchronously.
+ return;
+ }
+ tab->UpdateData(contents, change_type == LOADING_ONLY);
tab->UpdateFromModel();
}
diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h
index c84527a..e16a6573 100644
--- a/chrome/browser/views/tabs/tab_strip.h
+++ b/chrome/browser/views/tabs/tab_strip.h
@@ -102,7 +102,7 @@ class TabStrip : public views::View,
virtual void TabMoved(TabContents* contents, int from_index, int to_index,
bool pinned_state_changed);
virtual void TabChangedAt(TabContents* contents, int index,
- bool loading_only);
+ TabChangeType change_type);
virtual void TabPinnedStateChanged(TabContents* contents, int index);
// Tab::Delegate implementation: