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

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

Issue 2535463002: [Favicon] Stop caching the default favicon (Closed)
Patch Set: Remove the unused favicon_index Created 4 years 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/favicon_source.h ('k') | no next file » | 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/favicon_source.h" 5 #include "chrome/browser/ui/webui/favicon_source.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 SendDefaultResponse(request); 171 SendDefaultResponse(request);
172 } 172 }
173 } 173 }
174 174
175 void FaviconSource::SendDefaultResponse( 175 void FaviconSource::SendDefaultResponse(
176 const content::URLDataSource::GotDataCallback& callback) { 176 const content::URLDataSource::GotDataCallback& callback) {
177 SendDefaultResponse(IconRequest(callback, GURL(), 16, 1.0f)); 177 SendDefaultResponse(IconRequest(callback, GURL(), 16, 1.0f));
178 } 178 }
179 179
180 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) { 180 void FaviconSource::SendDefaultResponse(const IconRequest& icon_request) {
181 int favicon_index;
182 int resource_id; 181 int resource_id;
183 switch (icon_request.size_in_dip) { 182 switch (icon_request.size_in_dip) {
184 case 64: 183 case 64:
185 favicon_index = SIZE_64;
186 resource_id = IDR_DEFAULT_FAVICON_64; 184 resource_id = IDR_DEFAULT_FAVICON_64;
187 break; 185 break;
188 case 32: 186 case 32:
189 favicon_index = SIZE_32;
190 resource_id = IDR_DEFAULT_FAVICON_32; 187 resource_id = IDR_DEFAULT_FAVICON_32;
191 break; 188 break;
192 default: 189 default:
193 favicon_index = SIZE_16;
194 resource_id = IDR_DEFAULT_FAVICON; 190 resource_id = IDR_DEFAULT_FAVICON;
195 break; 191 break;
196 } 192 }
193
197 base::RefCountedMemory* default_favicon = 194 base::RefCountedMemory* default_favicon =
198 default_favicons_[favicon_index].get(); 195 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
199 196 resource_id,
200 if (!default_favicon) { 197 ui::GetSupportedScaleFactor(icon_request.device_scale_factor));
201 ui::ScaleFactor resource_scale_factor =
202 ui::GetSupportedScaleFactor(icon_request.device_scale_factor);
203 default_favicon =
204 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
205 resource_id, resource_scale_factor);
206 default_favicons_[favicon_index] = default_favicon;
207 }
208 198
209 icon_request.callback.Run(default_favicon); 199 icon_request.callback.Run(default_favicon);
210 } 200 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/favicon_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698