| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 else | 78 else |
| 79 icon = image.ToSkBitmap(); | 79 icon = image.ToSkBitmap(); |
| 80 | 80 |
| 81 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); | 81 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); |
| 82 | 82 |
| 83 int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; | 83 int image_size = ExtensionIconSet::EXTENSION_ICON_BITTY; |
| 84 // The margin between the extension icon and the drop-down arrow bitmap. | 84 // The margin between the extension icon and the drop-down arrow bitmap. |
| 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), ui::SCALE_FACTOR_100P, false)); |
| 89 canvas->DrawImageInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, | 89 canvas->DrawImageInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, |
| 90 image_size, image_size, false); | 90 image_size, image_size, false); |
| 91 canvas->DrawImageInt(*drop_image, image_size + kDropArrowLeftMargin, | 91 canvas->DrawImageInt(*drop_image, image_size + kDropArrowLeftMargin, |
| 92 image_size / 2); | 92 image_size / 2); |
| 93 | 93 |
| 94 SkBitmap bitmap = canvas->ExtractBitmap(); | 94 SkBitmap bitmap = canvas->ExtractImageRep().sk_bitmap(); |
| 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)); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // We also need to draw our infobar arrows over the renderer. | 197 // We also need to draw our infobar arrows over the renderer. |
| 198 static_cast<InfoBarContainerGtk*>(container())-> | 198 static_cast<InfoBarContainerGtk*>(container())-> |
| 199 PaintInfobarBitsOn(sender, event, this); | 199 PaintInfobarBitsOn(sender, event, this); |
| 200 | 200 |
| 201 return FALSE; | 201 return FALSE; |
| 202 } | 202 } |
| 203 | 203 |
| 204 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 204 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { |
| 205 return new ExtensionInfoBarGtk(owner, this); | 205 return new ExtensionInfoBarGtk(owner, this); |
| 206 } | 206 } |
| OLD | NEW |