summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/tab_contents_container_gtk.cc
diff options
context:
space:
mode:
authorrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 16:46:55 +0000
committerrsesek@chromium.org <rsesek@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-18 16:46:55 +0000
commit5fb7217681b4ff17abe1955794269b13aa27edf2 (patch)
tree7ec8c5b258e930a9c1c1682f451fc877f640f780 /chrome/browser/gtk/tab_contents_container_gtk.cc
parentae272cbc48e7618aac9cd29a0e946777b9f7efcf (diff)
downloadchromium_src-5fb7217681b4ff17abe1955794269b13aa27edf2.zip
chromium_src-5fb7217681b4ff17abe1955794269b13aa27edf2.tar.gz
chromium_src-5fb7217681b4ff17abe1955794269b13aa27edf2.tar.bz2
Revert 34954 - Fix issue 11258: Linux: gracefully handle small browser window
TODO: Make location bar to be freely shrinkable. Will be addressed in another CL. BUG=11258 TEST=See bug report. Review URL: http://codereview.chromium.org/507022 TBR=suzhe@chromium.org Review URL: http://codereview.chromium.org/502073 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34955 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/tab_contents_container_gtk.cc')
-rw-r--r--chrome/browser/gtk/tab_contents_container_gtk.cc46
1 files changed, 37 insertions, 9 deletions
diff --git a/chrome/browser/gtk/tab_contents_container_gtk.cc b/chrome/browser/gtk/tab_contents_container_gtk.cc
index fcf6a3d..a4fe973 100644
--- a/chrome/browser/gtk/tab_contents_container_gtk.cc
+++ b/chrome/browser/gtk/tab_contents_container_gtk.cc
@@ -6,13 +6,30 @@
#include "app/gfx/native_widget_types.h"
#include "app/l10n_util.h"
-#include "chrome/browser/gtk/gtk_expanded_container.h"
#include "chrome/browser/gtk/gtk_floating_container.h"
#include "chrome/browser/gtk/status_bubble_gtk.h"
#include "chrome/browser/tab_contents/tab_contents.h"
#include "chrome/browser/renderer_host/render_widget_host_view_gtk.h"
#include "chrome/common/notification_service.h"
+namespace {
+
+// Allocates all normal tab contents views to the size of the passed in
+// |allocation|.
+void ResizeChildren(GtkWidget* widget, void* param) {
+ GtkAllocation* allocation = reinterpret_cast<GtkAllocation*>(param);
+ if (!GTK_WIDGET_VISIBLE(widget))
+ return;
+
+ if (widget->allocation.width != allocation->width ||
+ widget->allocation.height != allocation->height) {
+ gtk_widget_set_size_request(widget, allocation->width,
+ allocation->height);
+ }
+}
+
+} // namespace
+
TabContentsContainerGtk::TabContentsContainerGtk(StatusBubbleGtk* status_bubble)
: tab_contents_(NULL),
status_bubble_(status_bubble) {
@@ -27,7 +44,7 @@ void TabContentsContainerGtk::Init() {
// A high level overview of the TabContentsContainer:
//
// +- GtkFloatingContainer |floating_| -------------------------------+
- // |+- GtkExpandedContainer |expanded_| -----------------------------+|
+ // |+- GtkFixedContainer |fixed_| -----------------------------------+|
// || ||
// || ||
// || ||
@@ -40,8 +57,10 @@ void TabContentsContainerGtk::Init() {
floating_.Own(gtk_floating_container_new());
gtk_widget_set_name(floating_.get(), "chrome-tab-contents-container");
- expanded_ = gtk_expanded_container_new();
- gtk_container_add(GTK_CONTAINER(floating_.get()), expanded_);
+ fixed_ = gtk_fixed_new();
+ g_signal_connect(fixed_, "size-allocate",
+ G_CALLBACK(OnFixedSizeAllocate), this);
+ gtk_container_add(GTK_CONTAINER(floating_.get()), fixed_);
if (status_bubble_) {
gtk_floating_container_add_floating(GTK_FLOATING_CONTAINER(floating_.get()),
@@ -50,7 +69,7 @@ void TabContentsContainerGtk::Init() {
G_CALLBACK(OnSetFloatingPosition), this);
}
- gtk_widget_show(expanded_);
+ gtk_widget_show(fixed_);
gtk_widget_show(floating_.get());
ViewIDUtil::SetDelegateForWidget(widget(), this);
@@ -86,8 +105,8 @@ void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
gfx::NativeView widget = tab_contents_->GetNativeView();
if (widget) {
- if (widget->parent != expanded_)
- gtk_container_add(GTK_CONTAINER(expanded_), widget);
+ if (widget->parent != fixed_)
+ gtk_fixed_put(GTK_FIXED(fixed_), widget, 0, 0);
gtk_widget_show(widget);
}
@@ -108,8 +127,8 @@ void TabContentsContainerGtk::DetachTabContents(TabContents* tab_contents) {
// It is possible to detach an unrealized, unparented TabContents if you
// slow things down enough in valgrind. Might happen in the real world, too.
if (widget && widget->parent) {
- DCHECK_EQ(widget->parent, expanded_);
- gtk_container_remove(GTK_CONTAINER(expanded_), widget);
+ DCHECK_EQ(widget->parent, fixed_);
+ gtk_container_remove(GTK_CONTAINER(fixed_), widget);
}
}
@@ -157,6 +176,15 @@ GtkWidget* TabContentsContainerGtk::GetWidgetForViewID(ViewID view_id) {
// -----------------------------------------------------------------------------
// static
+void TabContentsContainerGtk::OnFixedSizeAllocate(
+ GtkWidget* fixed,
+ GtkAllocation* allocation,
+ TabContentsContainerGtk* container) {
+ // Set all the tab contents GtkWidgets to the size of the allocation.
+ gtk_container_foreach(GTK_CONTAINER(fixed), ResizeChildren, allocation);
+}
+
+// static
void TabContentsContainerGtk::OnSetFloatingPosition(
GtkFloatingContainer* floating_container, GtkAllocation* allocation,
TabContentsContainerGtk* tab_contents_container) {