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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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>
8
7 #include "base/message_loop.h" 9 #include "base/message_loop.h"
8 #include "base/thread.h" 10 #include "base/thread.h"
11 #include "base/sys_string_conversions.h"
12 #include "skia/ext/skia_utils_mac.h"
13 #include "third_party/skia/include/core/SkBitmap.h"
9 14
10 void IconLoader::ReadIcon() { 15 void IconLoader::ReadIcon() {
11 NOTIMPLEMENTED(); 16 NSString* group = base::SysUTF8ToNSString(group_);
17 NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
18 NSImage* icon = [workspace iconForFileType:group];
19
20 NSSize size;
21 if (icon_size_ == NORMAL)
22 size = NSMakeSize(32, 32);
23 else if (icon_size_ == SMALL)
24 size = NSMakeSize(16, 16);
25 else
26 return;
27
28 bitmap_ = new SkBitmap(gfx::NSImageToSkBitmap(icon, size, false));
12 29
13 target_message_loop_->PostTask(FROM_HERE, 30 target_message_loop_->PostTask(FROM_HERE,
14 NewRunnableMethod(this, &IconLoader::NotifyDelegate)); 31 NewRunnableMethod(this, &IconLoader::NotifyDelegate));
15 } 32 }
OLDNEW
« 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