Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1643)

Unified Diff: chrome/browser/gtk/tab_contents_container_gtk.cc

Issue 100077: Linux: Make the findbar hang over the render view. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
+}
« no previous file with comments | « chrome/browser/gtk/tab_contents_container_gtk.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698