| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/infobar_gtk.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/infobars/infobar_service.h" | 9 #include "chrome/browser/infobars/infobar_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 0, 0, kLeftPadding, kRightPadding); | 84 0, 0, kLeftPadding, kRightPadding); |
| 85 | 85 |
| 86 bg_box_ = gtk_event_box_new(); | 86 bg_box_ = gtk_event_box_new(); |
| 87 gtk_widget_set_app_paintable(bg_box_, TRUE); | 87 gtk_widget_set_app_paintable(bg_box_, TRUE); |
| 88 g_signal_connect(bg_box_, "expose-event", | 88 g_signal_connect(bg_box_, "expose-event", |
| 89 G_CALLBACK(OnBackgroundExposeThunk), this); | 89 G_CALLBACK(OnBackgroundExposeThunk), this); |
| 90 gtk_container_add(GTK_CONTAINER(padding), hbox_); | 90 gtk_container_add(GTK_CONTAINER(padding), hbox_); |
| 91 gtk_container_add(GTK_CONTAINER(bg_box_), padding); | 91 gtk_container_add(GTK_CONTAINER(bg_box_), padding); |
| 92 | 92 |
| 93 // Add the icon on the left, if any. | 93 // Add the icon on the left, if any. |
| 94 gfx::Image* icon = delegate()->GetIcon(); | 94 gfx::Image icon = delegate()->GetIcon(); |
| 95 if (icon) { | 95 if (!icon.IsEmpty()) { |
| 96 GtkWidget* image = gtk_image_new_from_pixbuf(icon->ToGdkPixbuf()); | 96 GtkWidget* image = gtk_image_new_from_pixbuf(icon.ToGdkPixbuf()); |
| 97 | 97 |
| 98 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); | 98 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); |
| 99 | 99 |
| 100 gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0); | 100 gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0); |
| 101 } | 101 } |
| 102 | 102 |
| 103 close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_)); | 103 close_button_.reset(CustomDrawButton::CloseButtonBar(theme_service_)); |
| 104 gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0); | 104 gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0); |
| 105 signals_->Connect(close_button_->widget(), "clicked", | 105 signals_->Connect(close_button_->widget(), "clicked", |
| 106 G_CALLBACK(OnCloseButtonThunk), this); | 106 G_CALLBACK(OnCloseButtonThunk), this); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 } | 334 } |
| 335 | 335 |
| 336 return FALSE; | 336 return FALSE; |
| 337 } | 337 } |
| 338 | 338 |
| 339 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, | 339 void InfoBarGtk::OnChildSizeRequest(GtkWidget* expanded, |
| 340 GtkWidget* child, | 340 GtkWidget* child, |
| 341 GtkRequisition* requisition) { | 341 GtkRequisition* requisition) { |
| 342 requisition->height = -1; | 342 requisition->height = -1; |
| 343 } | 343 } |
| OLD | NEW |