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

Unified Diff: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc

Issue 14327008: Add InitWidgets() phase for GTK infobars. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 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
Index: chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc (revision 194662)
+++ chrome/browser/ui/gtk/infobars/extension_infobar_gtk.cc (working copy)
@@ -35,20 +35,12 @@
view_(NULL),
button_(NULL),
icon_(NULL),
+ alignment_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(weak_ptr_factory_(this)) {
delegate->set_observer(this);
- // Always render the close button as if we were doing chrome style widget
- // rendering. For extension infobars, we force chrome style rendering because
- // extension authors are going to expect to match the declared gradient in
- // extensions_infobar.css, and the close button provided by some GTK+ themes
- // won't look good on this background.
- close_button_->ForceChromeTheme();
-
int height = delegate->height();
SetBarTargetHeight((height > 0) ? (height + kSeparatorLineHeight) : 0);
-
- BuildWidgets();
}
ExtensionInfoBarGtk::~ExtensionInfoBarGtk() {
@@ -57,8 +49,7 @@
}
void ExtensionInfoBarGtk::PlatformSpecificHide(bool animate) {
- // This view is not owned by us; we can't unparent it because we aren't the
- // owning container.
+ DCHECK(alignment_);
gtk_util::RemoveAllChildren(alignment_);
}
@@ -77,6 +68,7 @@
if (!delegate_)
return; // The delegate can go away while we asynchronously load images.
+ DCHECK(icon_);
// TODO(erg): IDR_EXTENSIONS_SECTION should have an IDR_INFOBAR_EXTENSIONS
// icon of the correct size with real subpixel shading and such.
const gfx::ImageSkia* icon = NULL;
@@ -110,7 +102,16 @@
g_object_unref(pixbuf);
}
-void ExtensionInfoBarGtk::BuildWidgets() {
+void ExtensionInfoBarGtk::InitWidgets() {
+ InfoBarGtk::InitWidgets();
+
+ // Always render the close button as if we were doing chrome style widget
+ // rendering. For extension infobars, we force chrome style rendering because
+ // extension authors are going to expect to match the declared gradient in
+ // extensions_infobar.css, and the close button provided by some GTK+ themes
+ // won't look good on this background.
+ close_button_->ForceChromeTheme();
+
icon_ = gtk_image_new();
gtk_misc_set_alignment(GTK_MISC(icon_), 0.5, 0.5);
@@ -178,6 +179,7 @@
}
Browser* ExtensionInfoBarGtk::GetBrowser() {
+ DCHECK(icon_);
// Get the Browser object this infobar is attached to.
GtkWindow* parent = platform_util::GetTopLevel(icon_);
if (!parent)
« no previous file with comments | « chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h ('k') | chrome/browser/ui/gtk/infobars/infobar_container_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698