summaryrefslogtreecommitdiffstats
path: root/chrome/browser/tabs
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/browser/tabs
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/browser/tabs')
-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
3 files changed, 23 insertions, 16 deletions
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));