Chromium Code Reviews| Index: chrome/browser/extensions/extension_icon_image.cc |
| diff --git a/chrome/browser/extensions/extension_icon_image.cc b/chrome/browser/extensions/extension_icon_image.cc |
| index dcd096815c03ab6c26653705b041539a73703acc..8d48b105022d37aed0b5fbbb04a6664fa5d38af3 100644 |
| --- a/chrome/browser/extensions/extension_icon_image.cc |
| +++ b/chrome/browser/extensions/extension_icon_image.cc |
| @@ -34,7 +34,7 @@ ExtensionResource GetExtensionIconResource( |
| namespace extensions { |
| //////////////////////////////////////////////////////////////////////////////// |
| -// ExtensionIconImage::Source |
| +// IconImage::Source |
| class IconImage::Source : public gfx::ImageSkiaSource { |
| public: |
| @@ -71,7 +71,7 @@ gfx::ImageSkiaRep IconImage::Source::GetImageForScale( |
| } |
| //////////////////////////////////////////////////////////////////////////////// |
| -// ExtensionIconImage |
| +// IconImage |
| IconImage::IconImage( |
| const Extension* extension, |
| @@ -98,6 +98,12 @@ IconImage::~IconImage() { |
| source_->ResetHost(); |
| } |
| +void IconImage::SetRepresentation(const gfx::ImageSkiaRep& rep) { |
| + image_skia_.AddRepresentation(rep); |
| + if (observer_) |
| + observer_->OnExtensionIconImageChanged(this); |
| +} |
| + |
| void IconImage::LoadImageForScaleFactor(ui::ScaleFactor scale_factor) { |
| // Do nothing if extension is unloaded. |
| if (!extension_) |
| @@ -108,23 +114,27 @@ void IconImage::LoadImageForScaleFactor(ui::ScaleFactor scale_factor) { |
| static_cast<int>(resource_size_in_dip_ * scale); |
| ExtensionResource resource; |
| - // We try loading bigger image only if resource size is >= 32. |
| - if (resource_size_in_pixel >= kMatchBiggerTreshold) { |
| - resource = GetExtensionIconResource(extension_, icon_set_, |
| - resource_size_in_pixel, ExtensionIconSet::MATCH_BIGGER); |
| - } |
| - // If resource is not found by now, try matching smaller one. |
| - if (resource.empty()) { |
| - resource = GetExtensionIconResource(extension_, icon_set_, |
| - resource_size_in_pixel, ExtensionIconSet::MATCH_SMALLER); |
| - } |
| - |
| - // If there is no resource found, bail out and notify observer of failure. |
| - if (resource.empty()) { |
| - if (observer_) |
| - observer_->OnIconImageLoadFailed(this, scale_factor); |
| - return; |
| + // Find extension resource for non bundled component extensions. |
| + if (!ImageLoadingTracker::IsSpecialBundledExtensionId(extension_->id())) { |
|
Aaron Boodman
2012/08/30 06:09:20
I hate this hack so much. It's probably a differen
|
| + // We try loading bigger image only if resource size is >= 32. |
| + if (resource_size_in_pixel >= kMatchBiggerTreshold) { |
| + resource = GetExtensionIconResource(extension_, icon_set_, |
| + resource_size_in_pixel, ExtensionIconSet::MATCH_BIGGER); |
| + } |
| + |
| + // If resource is not found by now, try matching smaller one. |
| + if (resource.empty()) { |
| + resource = GetExtensionIconResource(extension_, icon_set_, |
| + resource_size_in_pixel, ExtensionIconSet::MATCH_SMALLER); |
| + } |
| + |
| + // If there is no resource found, bail out and notify observer of failure. |
| + if (resource.empty()) { |
| + if (observer_) |
| + observer_->OnIconImageLoadFailed(this, scale_factor); |
| + return; |
| + } |
| } |
| int id = tracker_.next_id(); |