diff options
author | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 17:42:07 +0000 |
---|---|---|
committer | jhawkins@chromium.org <jhawkins@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-02 17:42:07 +0000 |
commit | 08f6a95a4713ef1ac942c983d3af69427ad8db3a (patch) | |
tree | 06c37dd5ead8619bd3b5a8ece10ec4cdd5823940 /chrome/browser/gtk | |
parent | 8f7b4d425b421c5602523dc3633f144c1692979a (diff) | |
download | chromium_src-08f6a95a4713ef1ac942c983d3af69427ad8db3a.zip chromium_src-08f6a95a4713ef1ac942c983d3af69427ad8db3a.tar.gz chromium_src-08f6a95a4713ef1ac942c983d3af69427ad8db3a.tar.bz2 |
gtk: Restore the window that is hidden when the last tab is dragged out of the window.
BUG=21002
TEST=Drag the last tab out of a window and press esc. The window should be restored.
Review URL: http://codereview.chromium.org/257026
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk')
-rw-r--r-- | chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc | 18 | ||||
-rw-r--r-- | chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h | 9 |
2 files changed, 21 insertions, 6 deletions
diff --git a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc index ed6af39..ae063b7 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc +++ b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.cc @@ -552,7 +552,7 @@ void DraggedTabControllerGtk::Detach() { // If we've removed the last tab from the tabstrip, hide the frame now. if (attached_model->empty()) - HideFrame(); + HideWindow(); // Update the dragged tab. This NULL check is necessary apparently in some // conditions during automation where the view_ is destroyed inside a @@ -736,8 +736,8 @@ bool DraggedTabControllerGtk::EndDragImpl(EndDragType type) { } void DraggedTabControllerGtk::RevertDrag() { - // TODO(jhawkins): Restore the window frame. // We save this here because code below will modify |attached_tabstrip_|. + bool restore_window = attached_tabstrip_ != source_tabstrip_; if (attached_tabstrip_) { int index = attached_tabstrip_->model()->GetIndexOfTabContents( dragged_contents_); @@ -768,6 +768,12 @@ void DraggedTabControllerGtk::RevertDrag() { } source_tabstrip_->model()->SetTabPinned(source_model_index_, was_pinned_); + // If we're not attached to any tab strip, or attached to some other tab + // strip, we need to restore the bounds of the original tab strip's frame, in + // case it has been hidden. + if (restore_window) + ShowWindow(); + source_tab_->SetVisible(true); } @@ -835,12 +841,18 @@ gfx::Rect DraggedTabControllerGtk::GetTabScreenBounds(TabGtk* tab) { return gfx::Rect(bounds.x(), bounds.y(), bounds.width(), bounds.height()); } -void DraggedTabControllerGtk::HideFrame() { +void DraggedTabControllerGtk::HideWindow() { GtkWidget* tabstrip = source_tabstrip_->widget(); GtkWindow* window = platform_util::GetTopLevel(tabstrip); gtk_widget_hide(GTK_WIDGET(window)); } +void DraggedTabControllerGtk::ShowWindow() { + GtkWidget* tabstrip = source_tabstrip_->widget(); + GtkWindow* window = platform_util::GetTopLevel(tabstrip); + gtk_window_present(window); +} + void DraggedTabControllerGtk::CleanUpHiddenFrame() { // If the model we started dragging from is now empty, we must ask the // delegate to close the frame. diff --git a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h index 1b4b1ee..ebdf799 100644 --- a/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h +++ b/chrome/browser/gtk/tabs/dragged_tab_controller_gtk.h @@ -199,9 +199,12 @@ class DraggedTabControllerGtk : public NotificationObserver, // for the attached TabStrip. int NormalizeIndexToAttachedTabStrip(int index) const; - // Hides the frame for the window that contains the TabStrip the current - // drag session was initiated from. - void HideFrame(); + // Hides the window that contains the tab strip the current drag session was + // initiated from. + void HideWindow(); + + // Presents the window that was hidden by HideWindow. + void ShowWindow(); // Closes a hidden frame at the end of a drag session. void CleanUpHiddenFrame(); |