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

Unified Diff: chrome/browser/ui/gtk/infobars/confirm_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/confirm_infobar_gtk.cc
===================================================================
--- chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc (revision 194662)
+++ chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.cc (working copy)
@@ -24,7 +24,18 @@
ConfirmInfoBarGtk::ConfirmInfoBarGtk(InfoBarService* owner,
ConfirmInfoBarDelegate* delegate)
: InfoBarGtk(owner, delegate),
+ confirm_hbox_(NULL),
size_group_(NULL) {
+}
+
+ConfirmInfoBarGtk::~ConfirmInfoBarGtk() {
+ if (size_group_)
+ g_object_unref(size_group_);
+}
+
+void ConfirmInfoBarGtk::InitWidgets() {
+ InfoBarGtk::InitWidgets();
+
confirm_hbox_ = gtk_chrome_shrinkable_hbox_new(FALSE, FALSE,
kEndOfLabelSpacing);
// This alignment allocates the confirm hbox only as much space as it
@@ -38,7 +49,7 @@
AddButton(ConfirmInfoBarDelegate::BUTTON_OK);
AddButton(ConfirmInfoBarDelegate::BUTTON_CANCEL);
- std::string label_text = UTF16ToUTF8(delegate->GetMessageText());
+ std::string label_text = UTF16ToUTF8(GetDelegate()->GetMessageText());
GtkWidget* label = CreateLabel(label_text);
gtk_util::ForceFontSizePixels(label, 13.4);
gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);
@@ -47,7 +58,7 @@
G_CALLBACK(gtk_util::InitLabelSizeRequestAndEllipsizeMode),
NULL);
- std::string link_text = UTF16ToUTF8(delegate->GetLinkText());
+ std::string link_text = UTF16ToUTF8(GetDelegate()->GetLinkText());
if (link_text.empty())
return;
@@ -61,12 +72,12 @@
gtk_util::CenterWidgetInHBox(hbox_, link, true, kEndOfLabelSpacing);
}
-ConfirmInfoBarGtk::~ConfirmInfoBarGtk() {
- if (size_group_)
- g_object_unref(size_group_);
+ConfirmInfoBarDelegate* ConfirmInfoBarGtk::GetDelegate() {
+ return delegate()->AsConfirmInfoBarDelegate();
}
void ConfirmInfoBarGtk::AddButton(ConfirmInfoBarDelegate::InfoBarButton type) {
+ DCHECK(confirm_hbox_);
if (delegate()->AsConfirmInfoBarDelegate()->GetButtons() & type) {
if (!size_group_)
size_group_ = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
« no previous file with comments | « chrome/browser/ui/gtk/infobars/confirm_infobar_gtk.h ('k') | chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698