Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5062)

Unified Diff: chrome/browser/extensions/image_loading_tracker.h

Issue 9428025: Add support for multiple icon sizes for Mac platform apps (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comment Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a4e3cd9f71ef15bfca863b8239ba9a331bc49dc6 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);
Finnur 2012/02/23 12:05:42 nit: Personally, I would define the dtor in the .c
sail 2012/02/27 23:58:37 Done.
+ ExtensionResource resource;
+ gfx::Size max_size;
+ };
+
explicit ImageLoadingTracker(Observer* observer);
virtual ~ImageLoadingTracker();
@@ -72,13 +79,31 @@ class ImageLoadingTracker : public content::NotificationObserver {
const gfx::Size& max_size,
CacheParam cache);
+ // Same as LoadImage() above except it loads multiple images from the same
+ // extension. This is used 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 {
Finnur 2012/02/23 12:05:42 nit: Document this struct (and other struct above)
sail 2012/02/27 23:58:37 Done.
+ PendingLoadInfo();
+ ~PendingLoadInfo();
+
+ const Extension* extension;
+ std::string extension_id;
Finnur 2012/02/23 12:05:42 Why do you need this if you have the pointer to th
sail 2012/02/27 23:58:37 This is needed incase the extension is unload. Add
+ CacheParam cache;
+ size_t pending_count;
+ std::vector<SkBitmap> bitmaps;
+ };
+
+ typedef std::map<int, PendingLoadInfo> LoadMap;
Finnur 2012/02/23 12:05:42 Not your fault, but can you document this mapping?
sail 2012/02/27 23:58:37 Done.
class ImageLoader;

Powered by Google App Engine
This is Rietveld 408576698