Chromium Code Reviews| Index: chrome/browser/extensions/image_loading_tracker.h |
| diff --git a/chrome/browser/extensions/image_loading_tracker.h b/chrome/browser/extensions/image_loading_tracker.h |
| index e59371d08ca376d246e47e212ae01b98bb9613c9..a3c89f241ce1d1d968fc623aad4b5ae1f4866850 100644 |
| --- a/chrome/browser/extensions/image_loading_tracker.h |
| +++ b/chrome/browser/extensions/image_loading_tracker.h |
| @@ -10,15 +10,16 @@ |
| #include "base/compiler_specific.h" |
| #include "base/memory/ref_counted.h" |
| +#include "chrome/common/extensions/extension_resource.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "ui/gfx/size.h" |
| class Extension; |
| -class ExtensionResource; |
| class SkBitmap; |
| namespace gfx { |
| - class Size; |
| + class Image; |
| } |
| // The views need to load their icons asynchronously but might be deleted before |
| @@ -52,14 +53,20 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| // ExtensionResource where the |image| came from and the |index| represents |
| // the index of the image just loaded (starts at 0 and increments every |
| // time LoadImage is called). |
| - virtual void OnImageLoaded(SkBitmap* image, |
| - const ExtensionResource& resource, |
| + virtual void OnImageLoaded(const gfx::Image* image, |
| + const std::string& extension_id, |
| int index) = 0; |
| protected: |
| virtual ~Observer(); |
| }; |
| + struct ImageInfo { |
| + ImageInfo(const ExtensionResource resource, gfx::Size max_size); |
| + ExtensionResource resource; |
| + gfx::Size max_size; |
| + }; |
| + |
| explicit ImageLoadingTracker(Observer* observer); |
| virtual ~ImageLoadingTracker(); |
| @@ -72,13 +79,30 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| const gfx::Size& max_size, |
| CacheParam cache); |
| + // Same as LoadImage() above except it loads multiple images. This is used |
|
Mihai Parparita -not on Chrome
2012/02/23 00:19:41
"loads multiple images from the same extension" se
sail
2012/02/23 02:54:27
Done.
|
| + // to load multiple resolutions of the same image type. |
| + void LoadImages(const Extension* extension, |
| + const std::vector<ImageInfo>& info_list, |
| + CacheParam cache); |
| + |
| // Returns the ID used for the next image that is loaded. That is, the return |
| // value from this method corresponds to the int that is passed to |
| // OnImageLoaded() the next time LoadImage() is invoked. |
| int next_id() const { return next_id_; } |
| private: |
| - typedef std::map<int, const Extension*> LoadMap; |
| + struct PendingLoadInfo { |
| + PendingLoadInfo(); |
| + ~PendingLoadInfo(); |
| + |
| + const Extension* extension; |
| + std::string extension_id; |
| + CacheParam cache; |
| + size_t pending_count; |
| + std::vector<SkBitmap> bitmaps; |
| + }; |
| + |
| + typedef std::map<int, PendingLoadInfo> LoadMap; |
| class ImageLoader; |