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 8c92bf66ef72c1f875542aeb3aa288df217f6622..655869e1c60a14fdb70d7ad40b4800acd729f4e9 100644 |
| --- a/chrome/browser/extensions/image_loading_tracker.h |
| +++ b/chrome/browser/extensions/image_loading_tracker.h |
| @@ -7,6 +7,8 @@ |
| #pragma once |
| #include <map> |
| +#include <string> |
| +#include <vector> |
| #include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| @@ -14,6 +16,8 @@ |
| #include "chrome/common/extensions/extension_resource.h" |
| #include "content/public/browser/notification_observer.h" |
| #include "content/public/browser/notification_registrar.h" |
| +#include "ui/base/layout.h" |
| +#include "ui/gfx/image/image_skia.h" |
| #include "ui/gfx/size.h" |
| class SkBitmap; |
| @@ -65,12 +69,17 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| // Information about a single image to load from a extension resource. |
| struct ImageInfo { |
| - ImageInfo(const ExtensionResource& resource, gfx::Size max_size); |
| + ImageInfo(const ExtensionResource& resource, |
| + const gfx::Size& max_size, |
| + ui::ScaleFactor scale_factor); |
| ~ImageInfo(); |
| + |
| ExtensionResource resource; |
| // If the loaded image is larger than |max_size| it will be resized to those |
| // dimensions. |
| gfx::Size max_size; |
| + // |scale_factor| is used to construct loaded gfx::ImageSkia. |
| + ui::ScaleFactor scale_factor; |
| }; |
| explicit ImageLoadingTracker(Observer* observer); |
| @@ -85,6 +94,14 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| const gfx::Size& max_size, |
| CacheParam cache); |
| + // Loads an extension image for given DIP size. On non-DIP enabled screen, |
| + // this is the same as above LoadImage. On DIP screen, this function would try |
| + // to load hi-res icons with proper scale factor. |
| + void LoadDIPImage(const extensions::Extension* extension, |
|
pkotwicz
2012/07/11 21:02:25
Nit: I am not a fan of this method name, but I don
oshima
2012/07/11 21:09:33
LoadImageInDIP is better
xiyuan
2012/07/13 18:35:46
Changed name to LoadImageInDIP and pass in match_t
|
| + int preferred_dip_size, |
| + gfx::Size max_dip_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. |
| @@ -109,7 +126,7 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| std::string extension_id; |
| CacheParam cache; |
| size_t pending_count; |
| - std::vector<SkBitmap> bitmaps; |
| + gfx::ImageSkia images; |
| }; |
| // Maps an integer identifying a load request to a PendingLoadInfo. |
| @@ -123,7 +140,7 @@ class ImageLoadingTracker : public content::NotificationObserver { |
| // it was the last image in the list. The |original_size| should be the size |
| // of the image before any resizing was done. |
| // |image| may be null if the file failed to decode. |
| - void OnImageLoaded(SkBitmap* image, const ExtensionResource& resource, |
| + void OnImageLoaded(SkBitmap* image, const ImageInfo& image_info, |
| const gfx::Size& original_size, int id, bool should_cache); |
| // Checks whether image is a component extension resource. Returns false |