| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtk/gtk.h> | 7 #include <gtk/gtk.h> |
| 8 | 8 |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 G_CALLBACK(OnBackgroundExposeThunk), this); | 56 G_CALLBACK(OnBackgroundExposeThunk), this); |
| 57 gtk_container_add(GTK_CONTAINER(padding), hbox_); | 57 gtk_container_add(GTK_CONTAINER(padding), hbox_); |
| 58 gtk_container_add(GTK_CONTAINER(bg_box_), padding); | 58 gtk_container_add(GTK_CONTAINER(bg_box_), padding); |
| 59 gtk_widget_set_size_request(bg_box_, -1, kInfoBarHeight); | 59 gtk_widget_set_size_request(bg_box_, -1, kInfoBarHeight); |
| 60 | 60 |
| 61 // Add the icon on the left, if any. | 61 // Add the icon on the left, if any. |
| 62 gfx::Image* icon = delegate->GetIcon(); | 62 gfx::Image* icon = delegate->GetIcon(); |
| 63 if (icon) { | 63 if (icon) { |
| 64 GtkWidget* image = gtk_image_new_from_pixbuf(*icon); | 64 GtkWidget* image = gtk_image_new_from_pixbuf(*icon); |
| 65 | 65 |
| 66 gtk_widget_set_size_request( |
| 67 image, GetInfoBarIconSizePixels(), GetInfoBarIconSizePixels()); |
| 66 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); | 68 gtk_misc_set_alignment(GTK_MISC(image), 0.5, 0.5); |
| 67 | 69 |
| 68 gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0); | 70 gtk_box_pack_start(GTK_BOX(hbox_), image, FALSE, FALSE, 0); |
| 69 } | 71 } |
| 70 | 72 |
| 71 close_button_.reset(CustomDrawButton::CloseButton(NULL)); | 73 close_button_.reset(CustomDrawButton::CloseButton(NULL)); |
| 72 gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0); | 74 gtk_util::CenterWidgetInHBox(hbox_, close_button_->widget(), true, 0); |
| 73 g_signal_connect(close_button_->widget(), "clicked", | 75 g_signal_connect(close_button_->widget(), "clicked", |
| 74 G_CALLBACK(OnCloseButtonThunk), this); | 76 G_CALLBACK(OnCloseButtonThunk), this); |
| 75 | 77 |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); | 266 BrowserWindowGtk::GetBrowserWindowForNativeWindow(parent); |
| 265 int x = browser_window ? | 267 int x = browser_window ? |
| 266 browser_window->GetXPositionOfLocationIcon(sender) : 0; | 268 browser_window->GetXPositionOfLocationIcon(sender) : 0; |
| 267 | 269 |
| 268 size_t size = InfoBarArrowModel::kDefaultArrowSize; | 270 size_t size = InfoBarArrowModel::kDefaultArrowSize; |
| 269 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size); | 271 gfx::Rect arrow_bounds(x - size, y - size, 2 * size, size); |
| 270 arrow_model_.Paint(sender, event, arrow_bounds, border_color); | 272 arrow_model_.Paint(sender, event, arrow_bounds, border_color); |
| 271 | 273 |
| 272 return FALSE; | 274 return FALSE; |
| 273 } | 275 } |
| OLD | NEW |