| 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/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_infobar_delegate.h" | 8 #include "chrome/browser/extensions/extension_infobar_delegate.h" |
| 9 #include "chrome/browser/extensions/extension_view_host.h" | 9 #include "chrome/browser/extensions/extension_view_host.h" |
| 10 #include "chrome/browser/extensions/image_loader.h" | 10 #include "chrome/browser/extensions/image_loader.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 icon = rb.GetImageNamed(IDR_EXTENSIONS_SECTION).ToImageSkia(); | 201 icon = rb.GetImageNamed(IDR_EXTENSIONS_SECTION).ToImageSkia(); |
| 202 else | 202 else |
| 203 icon = image.ToImageSkia(); | 203 icon = image.ToImageSkia(); |
| 204 | 204 |
| 205 if (icon_as_menu_) { | 205 if (icon_as_menu_) { |
| 206 const gfx::ImageSkia* drop_image = | 206 const gfx::ImageSkia* drop_image = |
| 207 rb.GetImageNamed(IDR_APP_DROPARROW).ToImageSkia(); | 207 rb.GetImageNamed(IDR_APP_DROPARROW).ToImageSkia(); |
| 208 | 208 |
| 209 gfx::CanvasImageSource* source = new MenuImageSource(*icon, *drop_image); | 209 gfx::CanvasImageSource* source = new MenuImageSource(*icon, *drop_image); |
| 210 gfx::ImageSkia menu_image = gfx::ImageSkia(source, source->size()); | 210 gfx::ImageSkia menu_image = gfx::ImageSkia(source, source->size()); |
| 211 icon_as_menu_->SetIcon(menu_image); | 211 icon_as_menu_->SetImage(views::Button::STATE_NORMAL, menu_image); |
| 212 } else { | 212 } else { |
| 213 icon_as_image_->SetImage(*icon); | 213 icon_as_image_->SetImage(*icon); |
| 214 } | 214 } |
| 215 | 215 |
| 216 infobar_icon_->SizeToPreferredSize(); | 216 infobar_icon_->SizeToPreferredSize(); |
| 217 infobar_icon_->SetVisible(true); | 217 infobar_icon_->SetVisible(true); |
| 218 | 218 |
| 219 Layout(); | 219 Layout(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { | 222 ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() { |
| 223 return delegate()->AsExtensionInfoBarDelegate(); | 223 return delegate()->AsExtensionInfoBarDelegate(); |
| 224 } | 224 } |
| 225 | 225 |
| 226 const ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() const { | 226 const ExtensionInfoBarDelegate* ExtensionInfoBar::GetDelegate() const { |
| 227 return delegate()->AsExtensionInfoBarDelegate(); | 227 return delegate()->AsExtensionInfoBarDelegate(); |
| 228 } | 228 } |
| 229 | 229 |
| 230 int ExtensionInfoBar::NonExtensionViewWidth() const { | 230 int ExtensionInfoBar::NonExtensionViewWidth() const { |
| 231 return infobar_icon_->width() + kIconHorizontalMargin; | 231 return infobar_icon_->width() + kIconHorizontalMargin; |
| 232 } | 232 } |
| OLD | NEW |