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

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

Issue 2634413002: Faster Reload: Specify AllowCaching = false for some URLDataSources that need it (Closed)
Patch Set: Created 3 years, 11 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/fileicon_source.h ('k') | chrome/browser/ui/webui/large_icon_source.h » ('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/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/memory/ref_counted_memory.h" 10 #include "base/memory/ref_counted_memory.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 GetFilePathAndQuery(url_path, &file_path, &query); 139 GetFilePathAndQuery(url_path, &file_path, &query);
140 ParseQueryParams(query, &scale_factor, &icon_size); 140 ParseQueryParams(query, &scale_factor, &icon_size);
141 FetchFileIcon(file_path, scale_factor, icon_size, callback); 141 FetchFileIcon(file_path, scale_factor, icon_size, callback);
142 } 142 }
143 143
144 std::string FileIconSource::GetMimeType(const std::string&) const { 144 std::string FileIconSource::GetMimeType(const std::string&) const {
145 // Rely on image decoder inferring the correct type. 145 // Rely on image decoder inferring the correct type.
146 return std::string(); 146 return std::string();
147 } 147 }
148 148
149 bool FileIconSource::AllowCaching() const {
150 return false;
151 }
152
149 void FileIconSource::OnFileIconDataAvailable(const IconRequestDetails& details, 153 void FileIconSource::OnFileIconDataAvailable(const IconRequestDetails& details,
150 gfx::Image* icon) { 154 gfx::Image* icon) {
151 if (icon) { 155 if (icon) {
152 scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes); 156 scoped_refptr<base::RefCountedBytes> icon_data(new base::RefCountedBytes);
153 gfx::PNGCodec::EncodeBGRASkBitmap( 157 gfx::PNGCodec::EncodeBGRASkBitmap(
154 icon->ToImageSkia()->GetRepresentation( 158 icon->ToImageSkia()->GetRepresentation(
155 details.scale_factor).sk_bitmap(), 159 details.scale_factor).sk_bitmap(),
156 false, 160 false,
157 &icon_data->data()); 161 &icon_data->data());
158 162
159 details.callback.Run(icon_data.get()); 163 details.callback.Run(icon_data.get());
160 } else { 164 } else {
161 // TODO(glen): send a dummy icon. 165 // TODO(glen): send a dummy icon.
162 details.callback.Run(NULL); 166 details.callback.Run(NULL);
163 } 167 }
164 } 168 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/fileicon_source.h ('k') | chrome/browser/ui/webui/large_icon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698