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

Side by Side Diff: chrome/browser/ui/webui/fileicon_source.cc

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/ui/webui/downloads_dom_handler.cc ('k') | chrome/chrome_browser.gypi » ('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/ui/webui/fileicon_source.h" 5 #include "chrome/browser/ui/webui/fileicon_source.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 FileIconSource::FileIconSource() {} 99 FileIconSource::FileIconSource() {}
100 100
101 FileIconSource::~FileIconSource() {} 101 FileIconSource::~FileIconSource() {}
102 102
103 void FileIconSource::FetchFileIcon( 103 void FileIconSource::FetchFileIcon(
104 const base::FilePath& path, 104 const base::FilePath& path,
105 ui::ScaleFactor scale_factor, 105 ui::ScaleFactor scale_factor,
106 IconLoader::IconSize icon_size, 106 IconLoader::IconSize icon_size,
107 const content::URLDataSource::GotDataCallback& callback) { 107 const content::URLDataSource::GotDataCallback& callback) {
108 IconManager* im = g_browser_process->icon_manager(); 108 IconManager* im = g_browser_process->icon_manager();
109 gfx::Image* icon = im->LookupIcon(path, icon_size); 109 gfx::Image* icon = im->LookupIconFromFilepath(path, icon_size);
110 110
111 if (icon) { 111 if (icon) {
112 scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes); 112 scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes);
113 gfx::PNGCodec::EncodeBGRASkBitmap( 113 gfx::PNGCodec::EncodeBGRASkBitmap(
114 icon->ToImageSkia()->GetRepresentation(scale_factor).sk_bitmap(), 114 icon->ToImageSkia()->GetRepresentation(scale_factor).sk_bitmap(),
115 false, &icon_data->data()); 115 false, &icon_data->data());
116 116
117 callback.Run(icon_data); 117 callback.Run(icon_data);
118 } else { 118 } else {
119 // Attach the ChromeURLDataManager request ID to the history request. 119 // Attach the ChromeURLDataManager request ID to the history request.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 .sk_bitmap(), 161 .sk_bitmap(),
162 false, 162 false,
163 &icon_data->data()); 163 &icon_data->data());
164 164
165 details.callback.Run(icon_data); 165 details.callback.Run(icon_data);
166 } else { 166 } else {
167 // TODO(glen): send a dummy icon. 167 // TODO(glen): send a dummy icon.
168 details.callback.Run(NULL); 168 details.callback.Run(NULL);
169 } 169 }
170 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/downloads_dom_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698