Chromium Code Reviews| 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..ba198e1540a750fb8a45c46e0c077998e42ea3f6 100644 |
| --- a/chrome/browser/extensions/extension_icon_image.h |
| +++ b/chrome/browser/extensions/extension_icon_image.h |
| @@ -31,7 +31,13 @@ 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. |
|
Jeffrey Yasskin
2012/08/31 18:43:14
Do we want to return a blank image or the default
tbarzic
2012/08/31 22:29:44
blank image.. Aaron had some concerns that returni
|
| +// UI code can supply default icon whose representations will be added to the |
|
Jeffrey Yasskin
2012/08/31 18:43:14
By "can supply", you mean |default_icon| can be em
Jeffrey Yasskin
2012/08/31 18:43:14
I think this comment could use a more detailed des
tbarzic
2012/08/31 22:29:44
yeah, and in that case, if image rep is not loaded
tbarzic
2012/08/31 22:29:44
ok, I've rewritten larger part of the comment, and
|
| +// icon if a representation for some scale factor cannot be loaded from the |
| +// extension. |
| +// If default icon is supplied, it is assumed that it contains representations |
|
Jeffrey Yasskin
2012/08/31 18:43:14
By "contains representations", do you mean that, f
tbarzic
2012/08/31 22:29:44
the latter, clarified the comment..
|
| +// for all the scale factors supported by the current platform (e.g. MacOS). |
| class IconImage : public ImageLoadingTracker::Observer, |
| public content::NotificationObserver { |
| public: |
| @@ -41,10 +47,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 +54,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 +63,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. |
|
Jeffrey Yasskin
2012/08/31 18:43:14
Please describe the meaning of the return value an
tbarzic
2012/08/31 22:29:44
Done.
|
| - void LoadImageForScaleFactor(ui::ScaleFactor scale_factor); |
| + gfx::ImageSkiaRep LoadImageForScaleFactor(ui::ScaleFactor scale_factor); |
| // ImageLoadingTracker::Observer overrides: |
| virtual void OnImageLoaded(const gfx::Image& image, |
| @@ -78,12 +86,14 @@ class IconImage : public ImageLoadingTracker::Observer, |
| const Extension* extension_; |
| const ExtensionIconSet& icon_set_; |
| const int resource_size_in_dip_; |
| - const gfx::Size desired_size_in_dip_; |
| Observer* 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_; |