summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/gtk/browser_window_gtk.cc5
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc15
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.h3
3 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc
index 49fc667..8417e64 100644
--- a/chrome/browser/gtk/browser_window_gtk.cc
+++ b/chrome/browser/gtk/browser_window_gtk.cc
@@ -619,10 +619,9 @@ void BrowserWindowGtk::TabDetachedAt(TabContents* contents, int index) {
// We use index here rather than comparing |contents| because by this time
// the model has already removed |contents| from its list, so
// browser_->GetSelectedTabContents() will return NULL or something else.
- if (index == browser_->tabstrip_model()->selected_index()) {
+ if (index == browser_->tabstrip_model()->selected_index())
infobar_container_->ChangeTabContents(NULL);
- contents_container_->SetTabContents(NULL);
- }
+ contents_container_->DetachTabContents(contents);
}
// TODO(estade): this function should probably be unforked from the BrowserView
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc
index ef4db61..be8fe19 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/gtk/tab_contents_container_gtk.cc
@@ -28,7 +28,7 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
if (tab_contents_) {
gfx::NativeView widget = tab_contents_->GetNativeView();
if (widget)
- gtk_container_remove(GTK_CONTAINER(vbox_), widget);
+ gtk_widget_hide(widget);
tab_contents_->WasHidden();
@@ -44,9 +44,12 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
gfx::NativeView widget = tab_contents_->GetNativeView();
if (widget) {
- gtk_box_pack_end(GTK_BOX(vbox_), widget, TRUE, TRUE, 0);
+ // Pack it into |vbox_| if it isn't already.
+ if (widget->parent != vbox_)
+ gtk_box_pack_end(GTK_BOX(vbox_), widget, TRUE, TRUE, 0);
gtk_widget_show(widget);
}
+
// We need to make sure that we are below the findbar.
// Sometimes the content native view will be null.
// TODO(estade): will this case ever cause findbar occlusion problems?
@@ -59,6 +62,14 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
}
}
+void TabContentsContainerGtk::DetachTabContents(TabContents* tab_contents) {
+ gfx::NativeView widget = tab_contents_->GetNativeView();
+ if (widget) {
+ DCHECK_EQ(widget->parent, vbox_);
+ gtk_container_remove(GTK_CONTAINER(vbox_), widget);
+ }
+}
+
void TabContentsContainerGtk::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.h b/chrome/browser/gtk/tab_contents_container_gtk.h
index 6b4697b..1cb72e5 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.h
+++ b/chrome/browser/gtk/tab_contents_container_gtk.h
@@ -25,6 +25,9 @@ class TabContentsContainerGtk : public NotificationObserver {
void SetTabContents(TabContents* tab_contents);
TabContents* GetTabContents() const { return tab_contents_; }
+ // Remove the tab from the hierarchy.
+ void DetachTabContents(TabContents* tab_contents);
+
// NotificationObserver implementation.
virtual void Observe(NotificationType type,
const NotificationSource& source,