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

Side by Side Diff: chrome/browser/icon_loader_mac.mm

Issue 12211049: Removing base::ThreadRestrictions::ScopedAllowIO from icon_manager_linux.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix presubmit. Created 7 years, 8 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/icon_loader_linux.cc ('k') | chrome/browser/icon_loader_win.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h"
10 #include "base/files/file_path.h"
10 #include "base/message_loop.h" 11 #include "base/message_loop.h"
11 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
12 #include "base/strings/sys_string_conversions.h" 13 #include "base/strings/sys_string_conversions.h"
13 #include "ui/gfx/image/image_skia.h" 14 #include "ui/gfx/image/image_skia.h"
14 #include "ui/gfx/image/image_skia_util_mac.h" 15 #include "ui/gfx/image/image_skia_util_mac.h"
15 16
17 // static
18 IconGroupID IconLoader::ReadGroupIDFromFilepath(
19 const base::FilePath& filepath) {
20 return filepath.Extension();
21 }
22
16 void IconLoader::ReadIcon() { 23 void IconLoader::ReadIcon() {
17 NSString* group = base::SysUTF8ToNSString(group_); 24 NSString* group = base::SysUTF8ToNSString(group_);
18 NSWorkspace* workspace = [NSWorkspace sharedWorkspace]; 25 NSWorkspace* workspace = [NSWorkspace sharedWorkspace];
19 NSImage* icon = [workspace iconForFileType:group]; 26 NSImage* icon = [workspace iconForFileType:group];
20 27
21 if (icon_size_ == ALL) { 28 if (icon_size_ == ALL) {
22 // The NSImage already has all sizes. 29 // The NSImage already has all sizes.
23 image_.reset(new gfx::Image([icon retain])); 30 image_.reset(new gfx::Image([icon retain]));
24 } else { 31 } else {
25 NSSize size = NSZeroSize; 32 NSSize size = NSZeroSize;
(...skipping 10 matching lines...) Expand all
36 gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size)); 43 gfx::ImageSkia image_skia(gfx::ImageSkiaFromResizedNSImage(icon, size));
37 if (!image_skia.isNull()) { 44 if (!image_skia.isNull()) {
38 image_skia.MakeThreadSafe(); 45 image_skia.MakeThreadSafe();
39 image_.reset(new gfx::Image(image_skia)); 46 image_.reset(new gfx::Image(image_skia));
40 } 47 }
41 } 48 }
42 49
43 target_message_loop_->PostTask(FROM_HERE, 50 target_message_loop_->PostTask(FROM_HERE,
44 base::Bind(&IconLoader::NotifyDelegate, this)); 51 base::Bind(&IconLoader::NotifyDelegate, this));
45 } 52 }
OLDNEW
« no previous file with comments | « chrome/browser/icon_loader_linux.cc ('k') | chrome/browser/icon_loader_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698