| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/icon_loader.h" | 5 #include "chrome/browser/icon_loader.h" |
| 6 | 6 |
| 7 #import <AppKit/AppKit.h> | 7 #import <AppKit/AppKit.h> |
| 8 | 8 |
| 9 #include "base/bind.h" |
| 9 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 10 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 11 #include "base/sys_string_conversions.h" | 12 #include "base/sys_string_conversions.h" |
| 12 #include "skia/ext/skia_utils_mac.h" | 13 #include "skia/ext/skia_utils_mac.h" |
| 13 #include "third_party/skia/include/core/SkBitmap.h" | 14 #include "third_party/skia/include/core/SkBitmap.h" |
| 14 | 15 |
| 15 void IconLoader::ReadIcon() { | 16 void IconLoader::ReadIcon() { |
| 16 NSString* group = base::SysUTF8ToNSString(group_); | 17 NSString* group = base::SysUTF8ToNSString(group_); |
| 17 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; | 18 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; |
| 18 NSImage* icon = [workspace iconForFileType:group]; | 19 NSImage* icon = [workspace iconForFileType:group]; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 30 size = NSMakeSize(32, 32); | 31 size = NSMakeSize(32, 32); |
| 31 break; | 32 break; |
| 32 default: | 33 default: |
| 33 NOTREACHED(); | 34 NOTREACHED(); |
| 34 } | 35 } |
| 35 image_.reset(new gfx::Image(new SkBitmap( | 36 image_.reset(new gfx::Image(new SkBitmap( |
| 36 gfx::NSImageToSkBitmap(icon, size, false)))); | 37 gfx::NSImageToSkBitmap(icon, size, false)))); |
| 37 } | 38 } |
| 38 | 39 |
| 39 target_message_loop_->PostTask(FROM_HERE, | 40 target_message_loop_->PostTask(FROM_HERE, |
| 40 NewRunnableMethod(this, &IconLoader::NotifyDelegate)); | 41 base::Bind(&IconLoader::NotifyDelegate, this)); |
| 41 } | 42 } |
| OLD | NEW |