| 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..85fec94e4612382321acbf5f15ee819524fb32aa 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,7 @@
|
| #include "chrome/common/extensions/extension_resource.h"
|
| #include "content/public/browser/notification_observer.h"
|
| #include "content/public/browser/notification_registrar.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
| #include "ui/gfx/size.h"
|
|
|
| class SkBitmap;
|
| @@ -65,12 +68,18 @@ 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);
|
| + ImageInfo(const ExtensionResource& resource,
|
| + const gfx::Size& max_size,
|
| + float scale);
|
| ~ImageInfo();
|
| +
|
| ExtensionResource resource;
|
| // If the loaded image is larger than |max_size| it will be resized to those
|
| // dimensions.
|
| gfx::Size max_size;
|
| + // |scale| is used to construct loaded gfx::ImageSkia.
|
| + float scale;
|
| };
|
|
|
| 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,
|
| + 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
|
|
|