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

Side by Side Diff: chrome/browser/ui/webui/favicon_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/favicon_source.h ('k') | chrome/browser/ui/webui/fileicon_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/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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 &cancelable_task_tracker_); 125 &cancelable_task_tracker_);
126 } 126 }
127 } 127 }
128 128
129 std::string FaviconSource::GetMimeType(const std::string&) const { 129 std::string FaviconSource::GetMimeType(const std::string&) const {
130 // We need to explicitly return a mime type, otherwise if the user tries to 130 // We need to explicitly return a mime type, otherwise if the user tries to
131 // drag the image they get no extension. 131 // drag the image they get no extension.
132 return "image/png"; 132 return "image/png";
133 } 133 }
134 134
135 bool FaviconSource::AllowCaching() const {
136 return false;
137 }
138
135 bool FaviconSource::ShouldReplaceExistingSource() const { 139 bool FaviconSource::ShouldReplaceExistingSource() const {
136 // Leave the existing DataSource in place, otherwise we'll drop any pending 140 // Leave the existing DataSource in place, otherwise we'll drop any pending
137 // requests on the floor. 141 // requests on the floor.
138 return false; 142 return false;
139 } 143 }
140 144
141 bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const { 145 bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const {
142 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) 146 if (request->url().SchemeIs(chrome::kChromeSearchScheme))
143 return InstantIOContext::ShouldServiceRequest(request); 147 return InstantIOContext::ShouldServiceRequest(request);
144 return URLDataSource::ShouldServiceRequest(request); 148 return URLDataSource::ShouldServiceRequest(request);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 break; 195 break;
192 } 196 }
193 197
194 base::RefCountedMemory* default_favicon = 198 base::RefCountedMemory* default_favicon =
195 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale( 199 ResourceBundle::GetSharedInstance().LoadDataResourceBytesForScale(
196 resource_id, 200 resource_id,
197 ui::GetSupportedScaleFactor(icon_request.device_scale_factor)); 201 ui::GetSupportedScaleFactor(icon_request.device_scale_factor));
198 202
199 icon_request.callback.Run(default_favicon); 203 icon_request.callback.Run(default_favicon);
200 } 204 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/favicon_source.h ('k') | chrome/browser/ui/webui/fileicon_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698