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

Unified Diff: chrome/browser/web_applications/web_app_mac.mm

Issue 270623003: [Mac] Use full icon for small Chrome Apps custom folder assets (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix eet Created 6 years, 7 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
« no previous file with comments | « chrome/app/theme/mac/apps_folder_overlay_32.png ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/web_applications/web_app_mac.mm
diff --git a/chrome/browser/web_applications/web_app_mac.mm b/chrome/browser/web_applications/web_app_mac.mm
index 531a232c6d3df49fbd3f468256f9d150618f6161..a4a1673fc40acc376d6cbee04d1672ead2109ee9 100644
--- a/chrome/browser/web_applications/web_app_mac.mm
+++ b/chrome/browser/web_applications/web_app_mac.mm
@@ -298,6 +298,16 @@ NSImageRep* OverlayImageRep(NSImage* background, NSImageRep* overlay) {
return canvas.autorelease();
}
+// Helper function to extract the single NSImageRep held in a resource bundle
+// image.
+NSImageRep* ImageRepForResource(int resource_id) {
+ gfx::Image& image =
+ ResourceBundle::GetSharedInstance().GetNativeImageNamed(resource_id);
+ NSArray* image_reps = [image.AsNSImage() representations];
+ DCHECK_EQ(1u, [image_reps count]);
+ return [image_reps objectAtIndex:0];
+}
+
// Adds a localized strings file for the Chrome Apps directory using the current
// locale. OSX will use this for the display name.
// + Chrome Apps.localized (|apps_directory|)
@@ -325,22 +335,26 @@ void UpdateAppShortcutsSubdirLocalizedName(
[strings_dict writeToFile:strings_path
atomically:YES];
- // Brand the folder with an embossed app launcher logo.
+ base::scoped_nsobject<NSImage> folder_icon_image([[NSImage alloc] init]);
+
+ // Use complete assets for the small icon sizes. -[NSWorkspace setIcon:] has a
+ // bug when dealing with named NSImages where it incorrectly handles alpha
+ // premultiplication. This is most noticable with small assets since the 1px
+ // border is a much larger component of the small icons.
jackhou1 2014/05/08 01:27:32 Might be worth linking the bug in this comment.
tapted 2014/05/08 02:55:21 Done.
+ [folder_icon_image addRepresentation:ImageRepForResource(IDR_APPS_FOLDER_16)];
+ [folder_icon_image addRepresentation:ImageRepForResource(IDR_APPS_FOLDER_32)];
+
+ // Brand larger folder assets with an embossed app launcher logo to conserve
+ // distro size and for better consistency with changing hue across OSX
+ // versions. The folder is textured, so compresses poorly without this.
const int kBrandResourceIds[] = {
- IDR_APPS_FOLDER_OVERLAY_16,
- IDR_APPS_FOLDER_OVERLAY_32,
IDR_APPS_FOLDER_OVERLAY_128,
IDR_APPS_FOLDER_OVERLAY_512,
};
- ResourceBundle& rb = ResourceBundle::GetSharedInstance();
NSImage* base_image = [NSImage imageNamed:NSImageNameFolder];
- base::scoped_nsobject<NSImage> folder_icon_image([[NSImage alloc] init]);
for (size_t i = 0; i < arraysize(kBrandResourceIds); ++i) {
- gfx::Image& image_rep = rb.GetNativeImageNamed(kBrandResourceIds[i]);
- NSArray* image_reps = [image_rep.AsNSImage() representations];
- DCHECK_EQ(1u, [image_reps count]);
- NSImageRep* with_overlay = OverlayImageRep(base_image,
- [image_reps objectAtIndex:0]);
+ NSImageRep* with_overlay =
+ OverlayImageRep(base_image, ImageRepForResource(kBrandResourceIds[i]));
DCHECK(with_overlay);
if (with_overlay)
[folder_icon_image addRepresentation:with_overlay];
« no previous file with comments | « chrome/app/theme/mac/apps_folder_overlay_32.png ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698