diff options
Diffstat (limited to 'chrome/browser/views')
-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; |