diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 17:55:46 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-04 17:55:46 +0000 |
commit | 2b4355c4590724ae676f0ec5a8230e5c8c4cddf9 (patch) | |
tree | a087c519b35898d4f8e097f223f7658fd9315638 /chrome/browser/views/tabs | |
parent | 1d5222071e5876b345e84d475573ef5db14ba1b4 (diff) | |
download | chromium_src-2b4355c4590724ae676f0ec5a8230e5c8c4cddf9.zip chromium_src-2b4355c4590724ae676f0ec5a8230e5c8c4cddf9.tar.gz chromium_src-2b4355c4590724ae676f0ec5a8230e5c8c4cddf9.tar.bz2 |
Make the throbber throb sooner after you navigate. This fixes the new tab page,
which would not start throbbing until the load committed. I think this was always
broken, but switching the tab contents types covered it up.
Now I have a flag that goes along with the tab updating that indicates if it's
a load update or a full update. This is necessary to avoid updating the title
to the page's URL until it does actually commit.
BUG=9310
Review URL: http://codereview.chromium.org/60066
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 17 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.h | 6 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 9 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 3 |
5 files changed, 23 insertions, 14 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index fa45678..4f233d2 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -36,7 +36,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, close_animation_(this) { SetParentOwned(false); - renderer_->UpdateData(datasource); + renderer_->UpdateData(datasource, false); container_.reset(new views::WidgetWin); container_->set_delete_on_destroy(false); diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 4ee10cf..e2d6381 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -236,15 +236,20 @@ TabRenderer::~TabRenderer() { delete crash_animation_; } -void TabRenderer::UpdateData(TabContents* contents) { +void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { DCHECK(contents); - data_.favicon = contents->GetFavIcon(); - data_.title = UTF16ToWideHack(contents->GetTitle()); + if (!loading_only) { + data_.title = UTF16ToWideHack(contents->GetTitle()); + data_.off_the_record = contents->profile()->IsOffTheRecord(); + data_.show_download_icon = contents->IsDownloadShelfVisible(); + data_.crashed = contents->is_crashed(); + data_.favicon = contents->GetFavIcon(); + } + + // Loading state also involves whether we show the favicon, since that's where + // we display the throbber. data_.loading = contents->is_loading(); - data_.off_the_record = contents->profile()->IsOffTheRecord(); data_.show_icon = contents->ShouldDisplayFavIcon(); - data_.show_download_icon = contents->IsDownloadShelfVisible(); - data_.crashed = contents->is_crashed(); } void TabRenderer::UpdateFromModel() { diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h index 1a7a5fc..f652843 100644 --- a/chrome/browser/views/tabs/tab_renderer.h +++ b/chrome/browser/views/tabs/tab_renderer.h @@ -37,8 +37,10 @@ class TabRenderer : public views::View, virtual ~TabRenderer(); // Updates the data the Tab uses to render itself from the specified - // TabContents. - void UpdateData(TabContents* contents); + // TabContents. If only the loading state was updated, the loading_only flag + // should be specified. If other things change, set this flag to false to + // update everything. + void UpdateData(TabContents* contents, bool loading_only); // Updates the display to reflect the contents of this TabRenderer's model. void UpdateFromModel(); diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 01be61a..d377e0b 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -806,11 +806,11 @@ void TabStrip::TabInsertedAt(TabContents* contents, if (index == TabStripModel::kNoTab) { TabData d = { tab, gfx::Rect() }; tab_data_.push_back(d); - tab->UpdateData(contents); + tab->UpdateData(contents, false); } else { TabData d = { tab, gfx::Rect() }; tab_data_.insert(tab_data_.begin() + index, d); - tab->UpdateData(contents); + tab->UpdateData(contents, false); } } @@ -867,11 +867,12 @@ void TabStrip::TabMoved(TabContents* contents, int from_index, int to_index) { StartMoveTabAnimation(from_index, to_index); } -void TabStrip::TabChangedAt(TabContents* contents, int index) { +void TabStrip::TabChangedAt(TabContents* contents, int index, + bool loading_only) { // 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); + tab->UpdateData(contents, loading_only); tab->UpdateFromModel(); } diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 38a212b..ea819a8 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -118,7 +118,8 @@ class TabStrip : public views::View, int index, bool user_gesture); virtual void TabMoved(TabContents* contents, int from_index, int to_index); - virtual void TabChangedAt(TabContents* contents, int index); + virtual void TabChangedAt(TabContents* contents, int index, + bool loading_only); // Tab::Delegate implementation: virtual bool IsTabSelected(const Tab* tab) const; |