| Index: chrome/browser/extensions/extension_icon_image.h
|
| diff --git a/chrome/browser/extensions/extension_icon_image.h b/chrome/browser/extensions/extension_icon_image.h
|
| index c2f98526e4224985aa7fdbe983876f76b9af956e..1c2e04870905832bae40e863235fa2d3ccf2d4ed 100644
|
| --- a/chrome/browser/extensions/extension_icon_image.h
|
| +++ b/chrome/browser/extensions/extension_icon_image.h
|
| @@ -31,7 +31,12 @@ namespace extensions {
|
| // should be outlived by the observer. In painting code, UI code paints with the
|
| // ImageSkia provided by this class. If required extension icon resource is not
|
| // present, this class uses ImageLoadingTracker to load it and call on its
|
| -// observer interface when the resource is loaded.
|
| +// observer interface when the resource is loaded. Until the resource is loaded,
|
| +// the UI code will be provided with blank, transparent image representation.
|
| +// UI code can supply default icon whose representations will be added to the
|
| +// icon if icon's own representation for some scale factor cannot be loaded.
|
| +// If default icon is supplied, it is assumed that it contains representations
|
| +// for all the scale factors we need.
|
| class IconImage : public ImageLoadingTracker::Observer,
|
| public content::NotificationObserver {
|
| public:
|
| @@ -41,10 +46,6 @@ class IconImage : public ImageLoadingTracker::Observer,
|
| // is loaded and added to |image|.
|
| virtual void OnExtensionIconImageChanged(IconImage* image) = 0;
|
|
|
| - // Invoked when the icon image couldn't be loaded.
|
| - virtual void OnIconImageLoadFailed(IconImage* image,
|
| - ui::ScaleFactor scale_factor) = 0;
|
| -
|
| protected:
|
| virtual ~Observer() {}
|
| };
|
| @@ -52,6 +53,7 @@ class IconImage : public ImageLoadingTracker::Observer,
|
| IconImage(const Extension* extension,
|
| const ExtensionIconSet& icon_set,
|
| int resource_size_in_dip,
|
| + const gfx::ImageSkia& default_icon,
|
| Observer* observer);
|
| virtual ~IconImage();
|
|
|
| @@ -60,10 +62,15 @@ class IconImage : public ImageLoadingTracker::Observer,
|
| private:
|
| class Source;
|
|
|
| - typedef std::map<int, ui::ScaleFactor> LoadMap;
|
| + struct LoadRequest {
|
| + ui::ScaleFactor scale_factor;
|
| + bool is_async;
|
| + };
|
| +
|
| + typedef std::map<int, LoadRequest> LoadMap;
|
|
|
| // Loads bitmap for additional scale factor.
|
| - void LoadImageForScaleFactor(ui::ScaleFactor scale_factor);
|
| + gfx::ImageSkiaRep LoadImageForScaleFactor(ui::ScaleFactor scale_factor);
|
|
|
| // ImageLoadingTracker::Observer overrides:
|
| virtual void OnImageLoaded(const gfx::Image& image,
|
| @@ -84,6 +91,9 @@ class IconImage : public ImageLoadingTracker::Observer,
|
|
|
| Source* source_; // Owned by ImageSkia storage.
|
| gfx::ImageSkia image_skia_;
|
| + // The icon with whose representation |image_skia_| should be updated if
|
| + // its own representation load fails.
|
| + gfx::ImageSkia default_icon_;
|
|
|
| ImageLoadingTracker tracker_;
|
| content::NotificationRegistrar registrar_;
|
|
|