| Index: chrome/browser/gtk/tab_contents_container_gtk.cc
|
| ===================================================================
|
| --- chrome/browser/gtk/tab_contents_container_gtk.cc (revision 14624)
|
| +++ chrome/browser/gtk/tab_contents_container_gtk.cc (working copy)
|
| @@ -12,8 +12,14 @@
|
|
|
| TabContentsContainerGtk::TabContentsContainerGtk()
|
| : tab_contents_(NULL),
|
| - vbox_(gtk_vbox_new(FALSE, 0)) {
|
| - gtk_widget_show(vbox_);
|
| + vbox_(gtk_vbox_new(FALSE, 0)),
|
| + fixed_(gtk_fixed_new()),
|
| + findbar_(NULL) {
|
| + gtk_widget_set_size_request(fixed_, -1, 0);
|
| + gtk_box_pack_start(GTK_BOX(vbox_), fixed_, FALSE, FALSE, 0);
|
| + gtk_widget_show_all(vbox_);
|
| + g_signal_connect(fixed_, "size-allocate",
|
| + G_CALLBACK(OnSizeAllocate), this);
|
| }
|
|
|
| TabContentsContainerGtk::~TabContentsContainerGtk() {
|
| @@ -26,7 +32,9 @@
|
| }
|
|
|
| void TabContentsContainerGtk::AddFindBar(GtkWidget* findbar) {
|
| - gtk_box_pack_start(GTK_BOX(vbox_), findbar, FALSE, FALSE, 0);
|
| + findbar_ = findbar;
|
| + // We will reposition it later (when we get a size-allocate event).
|
| + gtk_fixed_put(GTK_FIXED(fixed_), findbar, 0, 0);
|
| }
|
|
|
| void TabContentsContainerGtk::SetTabContents(TabContents* tab_contents) {
|
| @@ -114,3 +122,20 @@
|
| DCHECK(contents == tab_contents_);
|
| SetTabContents(NULL);
|
| }
|
| +
|
| +void TabContentsContainerGtk::OnSizeAllocate(GtkWidget* fixed,
|
| + GtkAllocation* allocation, TabContentsContainerGtk* contents_container) {
|
| + GtkWidget* findbar = contents_container->findbar_;
|
| + DCHECK(findbar);
|
| + if (!GTK_WIDGET_VISIBLE(findbar))
|
| + return;
|
| +
|
| + // TODO(port): Logic for the positioning of the find bar should be factored
|
| + // out of here and browser/views/* and into FindBarController.
|
| + int xposition = allocation->width - findbar->allocation.width - 50;
|
| + if (xposition == findbar->allocation.x) {
|
| + return;
|
| + } else {
|
| + gtk_fixed_move(GTK_FIXED(fixed), findbar, xposition, 0);
|
| + }
|
| +}
|
|
|