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

Unified Diff: chrome/browser/icon_loader_mac.mm

Issue 6995068: Mac: Fix icons in download dom UI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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/icon_loader_mac.mm
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
index 9b26ff38a22bdab5b138dce8064a3cc8d7690fd6..8502a7d40157056d609d8c85d4b123c059e9df14 100644
--- a/chrome/browser/icon_loader_mac.mm
+++ b/chrome/browser/icon_loader_mac.mm
@@ -17,9 +17,24 @@ void IconLoader::ReadIcon() {
NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
NSImage* icon = [workspace iconForFileType:group];
- // Mac will ignore the size because icons have multiple size representations
- // and NSImage choses the best at draw-time.
- image_.reset(new gfx::Image([icon retain]));
+ if (icon_size_ == ALL) {
+ // The NSImage already has all sizes.
+ image_.reset(new gfx::Image([icon retain]));
+ } else {
+ NSSize size = NSZeroSize;
+ switch (icon_size_) {
+ case IconLoader::SMALL:
+ size = NSMakeSize(16, 16);
+ break;
+ case IconLoader::NORMAL:
+ size = NSMakeSize(32, 32);
+ break;
+ default:
+ NOTREACHED();
+ }
+ image_.reset(new gfx::Image(new SkBitmap(
Robert Sesek 2011/06/08 12:57:31 Why go through Skia? Can't this be done the Cocoa
sail 2011/06/08 19:23:42 Do you mean doing -[NSImage setSize:]? If so that
Robert Sesek 2011/06/08 20:09:48 Yes, but you could pull out an individual represen
+ gfx::NSImageToSkBitmap(icon, size, false))));
+ }
target_message_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &IconLoader::NotifyDelegate));

Powered by Google App Engine
This is Rietveld 408576698