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

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

Issue 10699065: chromeos: Fix pixelated icons in app list and launcher (part 1) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, move Resize/CreateDropShadow into ImageSkiaSource Created 8 years, 6 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 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);
oshima 2012/07/03 23:00:06 Can you use ui::ScaleFactor (it'll soon be an obje
xiyuan 2012/07/10 20:02:13 Addressed this in http://codereview.chromium.org/1
~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

Powered by Google App Engine
This is Rietveld 408576698