diff options
author | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 19:19:40 +0000 |
---|---|---|
committer | erg@google.com <erg@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-01 19:19:40 +0000 |
commit | 27ff0aa2b00bb4a029bab6a556c3e30994b82a79 (patch) | |
tree | 52db7884c081f0c6929dea8356f41b0dca05204c /chrome/browser/ui/gtk | |
parent | 7e2041201c0de2336b80f5afb9e7bebeda6be68e (diff) | |
download | chromium_src-27ff0aa2b00bb4a029bab6a556c3e30994b82a79.zip chromium_src-27ff0aa2b00bb4a029bab6a556c3e30994b82a79.tar.gz chromium_src-27ff0aa2b00bb4a029bab6a556c3e30994b82a79.tar.bz2 |
GTK: Fix remaining issues with extension infobars
- Infobars on GTK+ don't resize correctly when not exactly 37 pixels. Propagate
the desired size in.
- Extension infobars should draw arrows over their own content when needed.
BUG=39916
TEST=Extension infobars are the requested size; doesn't regress any other infobar behaviour on gtk+.
Review URL: http://codereview.chromium.org/7819014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99224 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/ui/gtk')
-rw-r--r-- | chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc | 17 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h | 3 | ||||
-rw-r--r-- | chrome/browser/ui/gtk/infobars/infobar_gtk.cc | 10 |
3 files changed, 22 insertions, 8 deletions
diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc index 2d6ec0f..27eddd3 100644 --- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc @@ -11,6 +11,7 @@ #include "chrome/browser/ui/gtk/custom_button.h" #include "chrome/browser/ui/gtk/gtk_chrome_button.h" #include "chrome/browser/ui/gtk/gtk_util.h" +#include "chrome/browser/ui/gtk/infobars/infobar_container_gtk.h" #include "chrome/common/extensions/extension.h" #include "chrome/common/extensions/extension_icon_set.h" #include "chrome/common/extensions/extension_resource.h" @@ -35,6 +36,9 @@ ExtensionInfoBarGtk::ExtensionInfoBarGtk(TabContentsWrapper* owner, // won't look good on this background. close_button_->ForceChromeTheme(); + int height = delegate->height(); + SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0); + BuildWidgets(); } @@ -129,7 +133,9 @@ void ExtensionInfoBarGtk::BuildWidgets() { } signals_.Connect(button_, "button-press-event", - G_CALLBACK(OnButtonPressThunk), this); + G_CALLBACK(&OnButtonPressThunk), this); + signals_.Connect(view_->native_view(), "expose-event", + G_CALLBACK(&OnExposeThunk), this); signals_.Connect(view_->native_view(), "size_allocate", G_CALLBACK(&OnSizeAllocateThunk), this); } @@ -185,6 +191,15 @@ gboolean ExtensionInfoBarGtk::OnButtonPress(GtkWidget* widget, return TRUE; } +gboolean ExtensionInfoBarGtk::OnExpose(GtkWidget* sender, + GdkEventExpose* event) { + // We also need to draw our infobar arrows over the renderer. + static_cast<InfoBarContainerGtk*>(container())-> + PaintInfobarBitsOn(sender, event, this); + + return FALSE; +} + InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(TabContentsWrapper* owner) { return new ExtensionInfoBarGtk(owner, this); } diff --git a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h index 1f01205..152eec7 100644 --- a/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h +++ b/chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h @@ -62,6 +62,9 @@ class ExtensionInfoBarGtk : public InfoBarGtk, CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnButtonPress, GdkEventButton*); + CHROMEGTK_CALLBACK_1(ExtensionInfoBarGtk, gboolean, OnExpose, + GdkEventExpose*); + ImageLoadingTracker tracker_; ExtensionInfoBarDelegate* delegate_; diff --git a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc index 7c3990f..1cafddf 100644 --- a/chrome/browser/ui/gtk/infobars/infobar_gtk.cc +++ b/chrome/browser/ui/gtk/infobars/infobar_gtk.cc @@ -28,9 +28,6 @@ const int kElementPadding = 5; const int kLeftPadding = 5; const int kRightPadding = 5; -// The total height of the info bar. -const int kInfoBarHeight = 37; - // Spacing between buttons. const int kButtonButtonSpacing = 3; @@ -67,7 +64,6 @@ InfoBarGtk::InfoBarGtk(TabContentsWrapper* owner, InfoBarDelegate* delegate) G_CALLBACK(OnBackgroundExposeThunk), this); gtk_container_add(GTK_CONTAINER(padding), hbox_); gtk_container_add(GTK_CONTAINER(bg_box_), padding); - gtk_widget_set_size_request(bg_box_, -1, kInfoBarHeight); // Add the icon on the left, if any. gfx::Image* icon = delegate->GetIcon(); @@ -247,10 +243,10 @@ void InfoBarGtk::PlatformSpecificShow(bool animate) { } void InfoBarGtk::PlatformSpecificOnHeightsRecalculated() { - GtkRequisition req; - gtk_widget_size_request(bg_box_, &req); + gtk_widget_set_size_request(bg_box_, -1, bar_target_height()); gtk_expanded_container_move(GTK_EXPANDED_CONTAINER(widget_.get()), - bg_box_, 0, bar_height() - req.height); + bg_box_, 0, + bar_height() - bar_target_height()); gtk_widget_set_size_request(widget_.get(), -1, bar_height()); gtk_widget_queue_draw(widget_.get()); |