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

Side by Side Diff: chrome/browser/search/local_ntp_source.cc

Issue 2533203002: New Tab Page: chrome-search://local-ntp/ files should not be cachable (Closed)
Patch Set: 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/search/local_ntp_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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/search/local_ntp_source.h" 5 #include "chrome/browser/search/local_ntp_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 std::string LocalNtpSource::GetMimeType( 243 std::string LocalNtpSource::GetMimeType(
244 const std::string& path) const { 244 const std::string& path) const {
245 const std::string stripped_path = StripParameters(path); 245 const std::string stripped_path = StripParameters(path);
246 for (size_t i = 0; i < arraysize(kResources); ++i) { 246 for (size_t i = 0; i < arraysize(kResources); ++i) {
247 if (stripped_path == kResources[i].filename) 247 if (stripped_path == kResources[i].filename)
248 return kResources[i].mime_type; 248 return kResources[i].mime_type;
249 } 249 }
250 return std::string(); 250 return std::string();
251 } 251 }
252 252
253 bool LocalNtpSource::AllowCaching() const {
254 return false;
Marc Treib 2016/11/29 14:52:22 Could you add a comment about why this is necessar
Takashi Toyoshima 2016/11/30 05:54:38 Done.
255 }
256
253 bool LocalNtpSource::ShouldServiceRequest( 257 bool LocalNtpSource::ShouldServiceRequest(
254 const net::URLRequest* request) const { 258 const net::URLRequest* request) const {
255 DCHECK(request->url().host_piece() == chrome::kChromeSearchLocalNtpHost); 259 DCHECK(request->url().host_piece() == chrome::kChromeSearchLocalNtpHost);
256 if (!InstantIOContext::ShouldServiceRequest(request)) 260 if (!InstantIOContext::ShouldServiceRequest(request))
257 return false; 261 return false;
258 262
259 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { 263 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) {
260 std::string filename; 264 std::string filename;
261 webui::ParsePathAndScale(request->url(), &filename, NULL); 265 webui::ParsePathAndScale(request->url(), &filename, NULL);
262 for (size_t i = 0; i < arraysize(kResources); ++i) { 266 for (size_t i = 0; i < arraysize(kResources); ++i) {
263 if (filename == kResources[i].filename) 267 if (filename == kResources[i].filename)
264 return true; 268 return true;
265 } 269 }
266 } 270 }
267 return false; 271 return false;
268 } 272 }
269 273
270 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { 274 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const {
271 // Allow embedding of most visited iframes. 275 // Allow embedding of most visited iframes.
272 return base::StringPrintf("child-src %s;", 276 return base::StringPrintf("child-src %s;",
273 chrome::kChromeSearchMostVisitedUrl); 277 chrome::kChromeSearchMostVisitedUrl);
274 } 278 }
OLDNEW
« no previous file with comments | « chrome/browser/search/local_ntp_source.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698