diff options
Diffstat (limited to 'chrome/browser/views/tabs')
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_controller.cc | 4 | ||||
-rw-r--r-- | chrome/browser/views/tabs/dragged_tab_view.cc | 2 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.cc | 11 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_renderer.h | 3 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.cc | 11 | ||||
-rw-r--r-- | chrome/browser/views/tabs/tab_strip.h | 3 |
6 files changed, 25 insertions, 9 deletions
diff --git a/chrome/browser/views/tabs/dragged_tab_controller.cc b/chrome/browser/views/tabs/dragged_tab_controller.cc index f7f81b8..e354e56 100644 --- a/chrome/browser/views/tabs/dragged_tab_controller.cc +++ b/chrome/browser/views/tabs/dragged_tab_controller.cc @@ -959,7 +959,7 @@ void DraggedTabController::Detach() { } // If we've removed the last Tab from the TabStrip, hide the frame now. - if (attached_model->empty()) + if (!attached_model->HasNonPhantomTabs()) HideFrame(); // Set up the photo booth to start capturing the contents of the dragged @@ -1343,7 +1343,7 @@ void DraggedTabController::HideFrame() { void DraggedTabController::CleanUpHiddenFrame() { // If the model we started dragging from is now empty, we must ask the // delegate to close the frame. - if (source_tabstrip_->model()->empty()) + if (!source_tabstrip_->model()->HasNonPhantomTabs()) source_tabstrip_->model()->delegate()->CloseFrameAfterDragSession(); } diff --git a/chrome/browser/views/tabs/dragged_tab_view.cc b/chrome/browser/views/tabs/dragged_tab_view.cc index d3a9263..5cd7531 100644 --- a/chrome/browser/views/tabs/dragged_tab_view.cc +++ b/chrome/browser/views/tabs/dragged_tab_view.cc @@ -42,7 +42,7 @@ DraggedTabView::DraggedTabView(TabContents* datasource, tab_width_(0) { set_parent_owned(false); - renderer_->UpdateData(datasource, false); + renderer_->UpdateData(datasource, false, false); #if defined(OS_WIN) container_.reset(new views::WidgetWin); diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 60d24c9..34bee57 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -258,6 +258,7 @@ TabRenderer::TabRenderer() data_.blocked = false; data_.pinned = false; data_.animating_pinned_change = false; + data_.phantom = false; // Add the Close Button. close_button_ = new TabCloseButton(this); @@ -293,13 +294,16 @@ ThemeProvider* TabRenderer::GetThemeProvider() { return NULL; } -void TabRenderer::UpdateData(TabContents* contents, bool loading_only) { +void TabRenderer::UpdateData(TabContents* contents, + bool phantom, + bool loading_only) { DCHECK(contents); - if (!loading_only) { + if (data_.phantom != phantom || !loading_only) { data_.title = contents->GetTitle(); data_.off_the_record = contents->profile()->IsOffTheRecord(); data_.crashed = contents->is_crashed(); data_.favicon = contents->GetFavIcon(); + data_.phantom = phantom; } // TODO(glen): Temporary hax. @@ -457,7 +461,8 @@ void TabRenderer::Paint(gfx::Canvas* canvas) { show_close_button != showing_close_button_) Layout(); - PaintTabBackground(canvas); + if (!data_.phantom) + PaintTabBackground(canvas); SkColor title_color = GetThemeProvider()-> GetColor(IsSelected() ? diff --git a/chrome/browser/views/tabs/tab_renderer.h b/chrome/browser/views/tabs/tab_renderer.h index 4cecfbe..c08dd8a 100644 --- a/chrome/browser/views/tabs/tab_renderer.h +++ b/chrome/browser/views/tabs/tab_renderer.h @@ -45,7 +45,7 @@ class TabRenderer : public views::View, // TabContents. // // See TabStripModel::TabChangedAt documentation for what loading_only means. - void UpdateData(TabContents* contents, bool loading_only); + void UpdateData(TabContents* contents, bool phantom, bool loading_only); // Sets the pinned state of the tab. void SetBlocked(bool blocked); @@ -207,6 +207,7 @@ class TabRenderer : public views::View, bool pinned; bool blocked; bool animating_pinned_change; + bool phantom; }; TabData data_; diff --git a/chrome/browser/views/tabs/tab_strip.cc b/chrome/browser/views/tabs/tab_strip.cc index 27bbb68..e051f7d 100644 --- a/chrome/browser/views/tabs/tab_strip.cc +++ b/chrome/browser/views/tabs/tab_strip.cc @@ -1111,7 +1111,7 @@ void TabStrip::TabInsertedAt(TabContents* contents, if (!contains_tab) { TabData d = { tab, gfx::Rect() }; tab_data_.insert(tab_data_.begin() + index, d); - tab->UpdateData(contents, false); + tab->UpdateData(contents, model_->IsPhantomTab(index), false); } tab->set_pinned(model_->IsTabPinned(index)); tab->SetBlocked(model_->IsTabBlocked(index)); @@ -1186,10 +1186,17 @@ void TabStrip::TabChangedAt(TabContents* contents, int index, // We'll receive another notification of the change asynchronously. return; } - tab->UpdateData(contents, change_type == LOADING_ONLY); + tab->UpdateData(contents, model_->IsPhantomTab(index), + change_type == LOADING_ONLY); tab->UpdateFromModel(); } +void TabStrip::TabReplacedAt(TabContents* old_contents, + TabContents* new_contents, + int index) { + TabChangedAt(new_contents, index, ALL); +} + void TabStrip::TabPinnedStateChanged(TabContents* contents, int index) { GetTabAt(index)->set_pinned(model_->IsTabPinned(index)); StartPinnedTabAnimation(index); diff --git a/chrome/browser/views/tabs/tab_strip.h b/chrome/browser/views/tabs/tab_strip.h index 27f6a97..309a9f3 100644 --- a/chrome/browser/views/tabs/tab_strip.h +++ b/chrome/browser/views/tabs/tab_strip.h @@ -139,6 +139,9 @@ class TabStrip : public views::View, bool pinned_state_changed); virtual void TabChangedAt(TabContents* contents, int index, TabChangeType change_type); + virtual void TabReplacedAt(TabContents* old_contents, + TabContents* new_contents, + int index); virtual void TabPinnedStateChanged(TabContents* contents, int index); virtual void TabBlockedStateChanged(TabContents* contents, int index); |