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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 double* r, double* g, double* b) { | 56 double* r, double* g, double* b) { |
57 // Extension infobars are always drawn with chrome-theme colors. | 57 // Extension infobars are always drawn with chrome-theme colors. |
58 *r = *g = *b = 233.0 / 255.0; | 58 *r = *g = *b = 233.0 / 255.0; |
59 } | 59 } |
60 | 60 |
61 void ExtensionInfoBarGtk::GetBottomColor(InfoBarDelegate::Type type, | 61 void ExtensionInfoBarGtk::GetBottomColor(InfoBarDelegate::Type type, |
62 double* r, double* g, double* b) { | 62 double* r, double* g, double* b) { |
63 *r = *g = *b = 218.0 / 255.0; | 63 *r = *g = *b = 218.0 / 255.0; |
64 } | 64 } |
65 | 65 |
66 void ExtensionInfoBarGtk::OnImageLoaded( | 66 void ExtensionInfoBarGtk::OnImageLoaded(const gfx::Image* image, |
67 SkBitmap* image, const ExtensionResource& resource, int index) { | 67 const std::string& extension_id, |
| 68 int index) { |
68 if (!delegate_) | 69 if (!delegate_) |
69 return; // The delegate can go away while we asynchronously load images. | 70 return; // The delegate can go away while we asynchronously load images. |
70 | 71 |
71 // TODO(erg): IDR_EXTENSIONS_SECTION should have an IDR_INFOBAR_EXTENSIONS | 72 // TODO(erg): IDR_EXTENSIONS_SECTION should have an IDR_INFOBAR_EXTENSIONS |
72 // icon of the correct size with real subpixel shading and such. | 73 // icon of the correct size with real subpixel shading and such. |
73 SkBitmap* icon = image; | 74 const SkBitmap* icon = NULL; |
74 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); | 75 ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); |
75 if (!image || image->empty()) | 76 if (!image || image->empty()) |
76 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); | 77 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); |
| 78 else |
| 79 icon = image->ToSkBitmap(); |
77 | 80 |
78 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); | 81 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); |
79 | 82 |
80 int image_size = Extension::EXTENSION_ICON_BITTY; | 83 int image_size = Extension::EXTENSION_ICON_BITTY; |
81 // 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. |
82 static const int kDropArrowLeftMargin = 3; | 85 static const int kDropArrowLeftMargin = 3; |
83 scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia( | 86 scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia( |
84 gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), | 87 gfx::Size(image_size + kDropArrowLeftMargin + drop_image->width(), |
85 image_size), | 88 image_size), |
86 false)); | 89 false)); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 // We also need to draw our infobar arrows over the renderer. | 201 // We also need to draw our infobar arrows over the renderer. |
199 static_cast<InfoBarContainerGtk*>(container())-> | 202 static_cast<InfoBarContainerGtk*>(container())-> |
200 PaintInfobarBitsOn(sender, event, this); | 203 PaintInfobarBitsOn(sender, event, this); |
201 | 204 |
202 return FALSE; | 205 return FALSE; |
203 } | 206 } |
204 | 207 |
205 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { | 208 InfoBar* ExtensionInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { |
206 return new ExtensionInfoBarGtk(owner, this); | 209 return new ExtensionInfoBarGtk(owner, this); |
207 } | 210 } |
OLD | NEW |