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

Unified Diff: chrome/browser/profiles/profile_shortcut_manager_win.cc

Issue 1408063012: Replaced GetAppIconForSize with GetAppIconImageFamily. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master-plus
Patch Set: Split off ImageFamily stuff into CL 1424913007. Created 5 years, 1 month 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/profiles/profile_shortcut_manager_win.cc
diff --git a/chrome/browser/profiles/profile_shortcut_manager_win.cc b/chrome/browser/profiles/profile_shortcut_manager_win.cc
index 942e4263f9f661c2f2fb07627ee4fac756d673bd..6003ee8f8d539b3a2aeb26fd0b5ec1c9b4653bc7 100644
--- a/chrome/browser/profiles/profile_shortcut_manager_win.cc
+++ b/chrome/browser/profiles/profile_shortcut_manager_win.cc
@@ -171,29 +171,38 @@ base::FilePath CreateOrUpdateShortcutIconForProfile(
return base::FilePath();
}
- scoped_ptr<SkBitmap> app_icon_bitmap(GetAppIconForSize(kShortcutIconSize));
- if (!app_icon_bitmap)
+ scoped_ptr<gfx::ImageFamily> family = GetAppIconImageFamily();
+ if (!family)
+ return base::FilePath();
+
+ // TODO(mgiuca): A better approach would be to badge each image in the
+ // ImageFamily (scaling the badge to the correct size), and then re-export the
+ // family (as opposed to making a family with just 48 and 256, then scaling
+ // those images to about a dozen different sizes).
+ SkBitmap app_icon_bitmap =
+ family->CreateExact(kShortcutIconSize, kShortcutIconSize).AsBitmap();
+ if (app_icon_bitmap.isNull())
return base::FilePath();
gfx::ImageFamily badged_bitmaps;
if (!avatar_bitmap_1x.empty()) {
badged_bitmaps.Add(gfx::Image::CreateFrom1xBitmap(
- BadgeIcon(*app_icon_bitmap, avatar_bitmap_1x, 1)));
+ BadgeIcon(app_icon_bitmap, avatar_bitmap_1x, 1)));
}
- scoped_ptr<SkBitmap> large_app_icon_bitmap(
- GetAppIconForSize(IconUtil::kLargeIconSize));
- if (large_app_icon_bitmap && !avatar_bitmap_2x.empty()) {
+ SkBitmap large_app_icon_bitmap =
+ family->CreateExact(IconUtil::kLargeIconSize, IconUtil::kLargeIconSize)
+ .AsBitmap();
+ if (!large_app_icon_bitmap.isNull() && !avatar_bitmap_2x.empty()) {
badged_bitmaps.Add(gfx::Image::CreateFrom1xBitmap(
- BadgeIcon(*large_app_icon_bitmap, avatar_bitmap_2x, 2)));
+ BadgeIcon(large_app_icon_bitmap, avatar_bitmap_2x, 2)));
}
// If we have no badged bitmaps, we should just use the default chrome icon.
if (badged_bitmaps.empty()) {
- badged_bitmaps.Add(gfx::Image::CreateFrom1xBitmap(*app_icon_bitmap));
- if (large_app_icon_bitmap) {
- badged_bitmaps.Add(
- gfx::Image::CreateFrom1xBitmap(*large_app_icon_bitmap));
+ badged_bitmaps.Add(gfx::Image::CreateFrom1xBitmap(app_icon_bitmap));
+ if (!large_app_icon_bitmap.isNull()) {
+ badged_bitmaps.Add(gfx::Image::CreateFrom1xBitmap(large_app_icon_bitmap));
}
}
// Finally, write the .ico file containing this new bitmap.

Powered by Google App Engine
This is Rietveld 408576698