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

Side by Side Diff: chrome/browser/search/iframe_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
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/iframe_source.h" 5 #include "chrome/browser/search/iframe_source.h"
6 6
7 #include "base/memory/ref_counted_memory.h" 7 #include "base/memory/ref_counted_memory.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/search/instant_io_context.h" 10 #include "chrome/browser/search/instant_io_context.h"
(...skipping 22 matching lines...) Expand all
33 return "text/css"; 33 return "text/css";
34 if (base::EndsWith(path, ".html", base::CompareCase::INSENSITIVE_ASCII)) 34 if (base::EndsWith(path, ".html", base::CompareCase::INSENSITIVE_ASCII))
35 return "text/html"; 35 return "text/html";
36 return std::string(); 36 return std::string();
37 } 37 }
38 38
39 bool IframeSource::ShouldServiceRequest( 39 bool IframeSource::ShouldServiceRequest(
40 const net::URLRequest* request) const { 40 const net::URLRequest* request) const {
41 const std::string& path = request->url().path(); 41 const std::string& path = request->url().path();
42 return InstantIOContext::ShouldServiceRequest(request) && 42 return InstantIOContext::ShouldServiceRequest(request) &&
43 request->url().SchemeIs(chrome::kChromeSearchScheme) && 43 request->url().SchemeIs(chrome::kChromeSearchScheme) &&
44 request->url().host() == GetSource() && 44 request->url().host_piece() == GetSource() && ServesPath(path);
45 ServesPath(path);
46 } 45 }
47 46
48 bool IframeSource::ShouldDenyXFrameOptions() const { 47 bool IframeSource::ShouldDenyXFrameOptions() const {
49 return false; 48 return false;
50 } 49 }
51 50
52 bool IframeSource::GetOrigin( 51 bool IframeSource::GetOrigin(
53 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, 52 const content::ResourceRequestInfo::WebContentsGetter& wc_getter,
54 std::string* origin) const { 53 std::string* origin) const {
55 if (wc_getter.is_null()) 54 if (wc_getter.is_null())
(...skipping 29 matching lines...) Expand all
85 callback.Run(NULL); 84 callback.Run(NULL);
86 return; 85 return;
87 } 86 }
88 87
89 base::StringPiece template_js = 88 base::StringPiece template_js =
90 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); 89 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
91 std::string response(template_js.as_string()); 90 std::string response(template_js.as_string());
92 base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin); 91 base::ReplaceFirstSubstringAfterOffset(&response, 0, "{{ORIGIN}}", origin);
93 callback.Run(base::RefCountedString::TakeString(&response)); 92 callback.Run(base::RefCountedString::TakeString(&response));
94 } 93 }
OLDNEW
« no previous file with comments | « chrome/browser/safe_browsing/browser_feature_extractor.cc ('k') | chrome/browser/search/local_ntp_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698