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/extension_infobar_gtk.h" | 5 #include "chrome/browser/ui/gtk/infobars/extension_infobar_gtk.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "chrome/browser/extensions/extension_context_menu_model.h" | 8 #include "chrome/browser/extensions/extension_context_menu_model.h" |
9 #include "chrome/browser/extensions/extension_host.h" | 9 #include "chrome/browser/extensions/extension_host.h" |
10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 static const int kDropArrowLeftMargin = 3; | 85 static const int kDropArrowLeftMargin = 3; |
86 scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas( | 86 scoped_ptr<gfx::Canvas> canvas(new gfx::Canvas( |
87 gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), | 87 gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), |
88 image_size), false)); | 88 image_size), false)); |
89 canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, | 89 canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, |
90 image_size, image_size, false); | 90 image_size, image_size, false); |
91 canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, | 91 canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, |
92 image_size / 2); | 92 image_size / 2); |
93 | 93 |
94 SkBitmap bitmap = canvas->ExtractBitmap(); | 94 SkBitmap bitmap = canvas->ExtractBitmap(); |
95 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&bitmap); | 95 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(bitmap); |
96 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), pixbuf); | 96 gtk_image_set_from_pixbuf(GTK_IMAGE(icon_), pixbuf); |
97 g_object_unref(pixbuf); | 97 g_object_unref(pixbuf); |
98 } | 98 } |
99 | 99 |
100 void ExtensionInfoBarGtk::BuildWidgets() { | 100 void ExtensionInfoBarGtk::BuildWidgets() { |
101 button_ = gtk_chrome_button_new(); | 101 button_ = gtk_chrome_button_new(); |
102 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button_), FALSE); | 102 gtk_chrome_button_set_use_gtk_rendering(GTK_CHROME_BUTTON(button_), FALSE); |
103 g_object_set_data(G_OBJECT(button_), "left-align-popup", | 103 g_object_set_data(G_OBJECT(button_), "left-align-popup", |
104 reinterpret_cast<void*>(true)); | 104 reinterpret_cast<void*>(true)); |
105 | 105 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 // We also need to draw our infobar arrows over the renderer. | 196 // We also need to draw our infobar arrows over the renderer. |
197 static_cast<InfoBarContainerGtk*>(container())-> | 197 static_cast<InfoBarContainerGtk*>(container())-> |
198 PaintInfobarBitsOn(sender, event, this); | 198 PaintInfobarBitsOn(sender, event, this); |
199 | 199 |
200 return FALSE; | 200 return FALSE; |
201 } | 201 } |
202 | 202 |
203 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 203 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { |
204 return new ExtensionInfoBarGtk(owner, this); | 204 return new ExtensionInfoBarGtk(owner, this); |
205 } | 205 } |
OLD | NEW |