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/views/infobars/extension_infobar.h" | 5 #include "chrome/browser/ui/views/infobars/extension_infobar.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_context_menu_model.h" | 7 #include "chrome/browser/extensions/extension_context_menu_model.h" |
8 #include "chrome/browser/extensions/extension_host.h" | 8 #include "chrome/browser/extensions/extension_host.h" |
9 #include "chrome/browser/extensions/extension_infobar_delegate.h" | 9 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
10 #include "chrome/browser/platform_util.h" | 10 #include "chrome/browser/platform_util.h" |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 // Fall back on the default extension icon on failure. | 146 // Fall back on the default extension icon on failure. |
147 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); | 147 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); |
148 if (!image || image->empty()) | 148 if (!image || image->empty()) |
149 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); | 149 icon = rb.GetBitmapNamed(IDR_EXTENSIONS_SECTION); |
150 | 150 |
151 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); | 151 SkBitmap* drop_image = rb.GetBitmapNamed(IDR_APP_DROPARROW); |
152 | 152 |
153 int image_size = Extension::EXTENSION_ICON_BITTY; | 153 int image_size = Extension::EXTENSION_ICON_BITTY; |
154 // The margin between the extension icon and the drop-down arrow bitmap. | 154 // The margin between the extension icon and the drop-down arrow bitmap. |
155 static const int kDropArrowLeftMargin = 3; | 155 static const int kDropArrowLeftMargin = 3; |
156 scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia( | 156 scoped_ptr<gfx::CanvasSkia> canvas(new gfx::CanvasSkia); |
157 image_size + kDropArrowLeftMargin + drop_image->width(), image_size, | 157 canvas->Init( |
158 false)); | 158 image_size + kDropArrowLeftMargin + drop_image->width(), |
| 159 image_size, |
| 160 false); |
159 canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, | 161 canvas->DrawBitmapInt(*icon, 0, 0, icon->width(), icon->height(), 0, 0, |
160 image_size, image_size, false); | 162 image_size, image_size, false); |
161 canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, | 163 canvas->DrawBitmapInt(*drop_image, image_size + kDropArrowLeftMargin, |
162 image_size / 2); | 164 image_size / 2); |
163 menu_->SetIcon(canvas->ExtractBitmap()); | 165 menu_->SetIcon(canvas->ExtractBitmap()); |
164 menu_->SetVisible(true); | 166 menu_->SetVisible(true); |
165 | 167 |
166 Layout(); | 168 Layout(); |
167 } | 169 } |
168 | 170 |
(...skipping 15 matching lines...) Expand all Loading... |
184 NULL); | 186 NULL); |
185 } | 187 } |
186 | 188 |
187 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); | 189 options_menu_menu_.reset(new views::Menu2(options_menu_contents_.get())); |
188 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); | 190 options_menu_menu_->RunMenuAt(pt, views::Menu2::ALIGN_TOPLEFT); |
189 } | 191 } |
190 | 192 |
191 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 193 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
192 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; | 194 return delegate_ ? delegate_->AsExtensionInfoBarDelegate() : NULL; |
193 } | 195 } |
OLD | NEW |