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

Unified Diff: chrome/browser/ui/app_list/search/webstore/webstore_result.cc

Issue 458983004: Move app list search result icon sizes to app_list_constants. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 6 years, 4 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/ui/app_list/search/webstore/webstore_result.cc
diff --git a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
index df9cfcf26f2e15e67254054301e6c530d3ee1da3..6a0682d49dd664703620844e722e5a4af0423aea 100644
--- a/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
+++ b/chrome/browser/ui/app_list/search/webstore/webstore_result.cc
@@ -34,16 +34,14 @@
namespace {
-const int kIconSize = 32;
const int kLaunchEphemeralAppAction = 1;
// BadgedImageSource adds a webstore badge to a webstore app icon.
class BadgedIconSource : public gfx::CanvasImageSource {
public:
- explicit BadgedIconSource(const gfx::ImageSkia& icon)
- : CanvasImageSource(gfx::Size(kIconSize, kIconSize), false),
- icon_(icon) {
- }
+ explicit BadgedIconSource(const gfx::ImageSkia& icon,
tapted 2014/08/13 08:09:06 nit: explicit not needed
calamity 2014/08/13 08:25:09 Done.
+ const gfx::Size& icon_size)
+ : CanvasImageSource(icon_size, false), icon_(icon) {}
virtual void Draw(gfx::Canvas* canvas) OVERRIDE {
canvas->DrawImageInt(icon_, 0, 0);
@@ -87,14 +85,15 @@ WebstoreResult::WebstoreResult(Profile* profile,
InitAndStartObserving();
UpdateActions();
+ int icon_dimension = GetPreferredIconSize();
icon_ = gfx::ImageSkia(
- new UrlIconSource(base::Bind(&WebstoreResult::OnIconLoaded,
- weak_factory_.GetWeakPtr()),
- profile_->GetRequestContext(),
- icon_url_,
- kIconSize,
- IDR_WEBSTORE_ICON_32),
- gfx::Size(kIconSize, kIconSize));
+ new UrlIconSource(
+ base::Bind(&WebstoreResult::OnIconLoaded, weak_factory_.GetWeakPtr()),
+ profile_->GetRequestContext(),
+ icon_url_,
+ icon_dimension,
+ IDR_WEBSTORE_ICON_32),
+ gfx::Size(icon_dimension, icon_dimension));
SetIcon(icon_);
}
@@ -193,9 +192,9 @@ void WebstoreResult::OnIconLoaded() {
const std::vector<gfx::ImageSkiaRep>& image_reps = icon_.image_reps();
for (size_t i = 0; i < image_reps.size(); ++i)
icon_.RemoveRepresentation(image_reps[i].scale());
-
- icon_ = gfx::ImageSkia(new BadgedIconSource(icon_),
- gfx::Size(kIconSize, kIconSize));
+ int icon_dimension = GetPreferredIconSize();
+ gfx::Size icon_size(icon_dimension, icon_dimension);
+ icon_ = gfx::ImageSkia(new BadgedIconSource(icon_, icon_size), icon_size);
SetIcon(icon_);
}

Powered by Google App Engine
This is Rietveld 408576698