Chromium Code Reviews| 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..9dabdfb348961adf9524b80cd64749f80c760ed2 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, |
| + const gfx::Size& icon_size) |
|
Matt Giuca
2014/08/12 06:43:24
nit: May be simpler to just take an int here inste
calamity
2014/08/13 06:03:17
Chose the other one.
Matt Giuca
2014/08/13 06:15:25
Acknowledged.
|
| + : 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,8 @@ 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)); |
| + gfx::Size icon_size(GetPreferredIconSize(), GetPreferredIconSize()); |
|
Matt Giuca
2014/08/12 06:43:24
If you don't take my advice above, please make a v
calamity
2014/08/13 06:03:17
Done.
|
| + icon_ = gfx::ImageSkia(new BadgedIconSource(icon_, icon_size), icon_size); |
| SetIcon(icon_); |
| } |