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

Unified Diff: chrome/browser/icon_loader_mac.mm

Issue 118488: Add file icons to chrome://downloads/ on the Mac. Add Skia helper CGImageToSkBitmap(). (Closed)
Patch Set: Switch to using |-drawInRect:| rather than |-drawAtPoint:| Created 11 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
« no previous file with comments | « chrome/browser/dom_ui/fileicon_source.cc ('k') | chrome/browser/icon_manager_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/icon_loader_mac.mm
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
index 83a8305df72992896035ca2095dd07276051ba56..744b6cb338c83f6805db5c886194f6732fff7aa6 100644
--- a/chrome/browser/icon_loader_mac.mm
+++ b/chrome/browser/icon_loader_mac.mm
@@ -4,11 +4,28 @@
#include "chrome/browser/icon_loader.h"
+#import <AppKit/AppKit.h>
+
#include "base/message_loop.h"
#include "base/thread.h"
+#include "base/sys_string_conversions.h"
+#include "skia/ext/skia_utils_mac.h"
+#include "third_party/skia/include/core/SkBitmap.h"
void IconLoader::ReadIcon() {
- NOTIMPLEMENTED();
+ NSString* group = base::SysUTF8ToNSString(group_);
+ NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
+ NSImage* icon = [workspace iconForFileType:group];
+
+ NSSize size;
+ if (icon_size_ == NORMAL)
+ size = NSMakeSize(32, 32);
+ else if (icon_size_ == SMALL)
+ size = NSMakeSize(16, 16);
+ else
+ return;
+
+ bitmap_ = new SkBitmap(gfx::NSImageToSkBitmap(icon, size, false));
target_message_loop_->PostTask(FROM_HERE,
NewRunnableMethod(this, &IconLoader::NotifyDelegate));
« no previous file with comments | « chrome/browser/dom_ui/fileicon_source.cc ('k') | chrome/browser/icon_manager_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698