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

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

Issue 2478573004: Convert GURL::{host,path} to GURL::{host_piece,path_piece} for ==. (Closed)
Patch Set: rebase to #431874 Created 4 years, 1 month 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/iframe_source.cc ('k') | chrome/browser/search/search.cc » ('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 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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::ShouldServiceRequest( 253 bool LocalNtpSource::ShouldServiceRequest(
254 const net::URLRequest* request) const { 254 const net::URLRequest* request) const {
255 DCHECK(request->url().host() == chrome::kChromeSearchLocalNtpHost); 255 DCHECK(request->url().host_piece() == chrome::kChromeSearchLocalNtpHost);
256 if (!InstantIOContext::ShouldServiceRequest(request)) 256 if (!InstantIOContext::ShouldServiceRequest(request))
257 return false; 257 return false;
258 258
259 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { 259 if (request->url().SchemeIs(chrome::kChromeSearchScheme)) {
260 std::string filename; 260 std::string filename;
261 webui::ParsePathAndScale(request->url(), &filename, NULL); 261 webui::ParsePathAndScale(request->url(), &filename, NULL);
262 for (size_t i = 0; i < arraysize(kResources); ++i) { 262 for (size_t i = 0; i < arraysize(kResources); ++i) {
263 if (filename == kResources[i].filename) 263 if (filename == kResources[i].filename)
264 return true; 264 return true;
265 } 265 }
266 } 266 }
267 return false; 267 return false;
268 } 268 }
269 269
270 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const { 270 std::string LocalNtpSource::GetContentSecurityPolicyChildSrc() const {
271 // Allow embedding of most visited iframes. 271 // Allow embedding of most visited iframes.
272 return base::StringPrintf("child-src %s;", 272 return base::StringPrintf("child-src %s;",
273 chrome::kChromeSearchMostVisitedUrl); 273 chrome::kChromeSearchMostVisitedUrl);
274 } 274 }
OLDNEW
« no previous file with comments | « chrome/browser/search/iframe_source.cc ('k') | chrome/browser/search/search.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698