summaryrefslogtreecommitdiffstats
path: root/chrome/browser/icon_loader_mac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/icon_loader_mac.mm')
-rw-r--r--chrome/browser/icon_loader_mac.mm19
1 files changed, 18 insertions, 1 deletions
diff --git a/chrome/browser/icon_loader_mac.mm b/chrome/browser/icon_loader_mac.mm
index 83a8305..028edf7 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));