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

Unified Diff: components/search_engines/template_url.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan 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 side-by-side diff with in-line comments
Download patch
Index: components/search_engines/template_url.cc
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
index 8902965292274238a3d256244bb78ee6ad0e2e21..7f095037f4b7f2abd1803e2819efe7baf517e21d 100644
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -143,7 +143,7 @@ SearchTermsKeyResult FindSearchTermsKey(const std::string& params) {
}
// Extract the position of the search terms' parameter in the URL path.
-bool FindSearchTermsInPath(const std::string& path,
+bool FindSearchTermsInPath(const base::StringPiece& path,
url::Component* parameter_position) {
DCHECK(parameter_position);
parameter_position->reset();
@@ -500,7 +500,7 @@ bool TemplateURLRef::ExtractSearchTermsFromURL(
url::Component position;
if (search_term_key_location_ == url::Parsed::PATH) {
- source = url.path();
+ source = url.path().as_string();
// Characters in the path before and after search terms must match.
if (source.length() < path_.length())
@@ -824,7 +824,7 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
host_ = url.host();
port_ = url.port();
- path_ = url.path();
+ path_ = url.path().as_string();
if (in_query) {
search_term_key_ = query_result.key;
search_term_key_location_ = url::Parsed::QUERY;
@@ -1386,7 +1386,7 @@ bool TemplateURL::ReplaceSearchTermsInURL(
old_params = url.ref();
} else {
DCHECK_EQ(search_term_component, url::Parsed::PATH);
- old_params = url.path();
+ old_params = url.path().as_string();
}
std::string new_params(old_params, 0, search_terms_position.begin);

Powered by Google App Engine
This is Rietveld 408576698