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

Unified Diff: components/search_engines/template_url.cc

Issue 1595103007: TemplateURL Performance - don't call replace search terms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/search_engines/template_url.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/search_engines/template_url.cc
diff --git a/components/search_engines/template_url.cc b/components/search_engines/template_url.cc
index a75779bfb0d1cfe09f393076650d7671f5e13ca3..5282fb822b15b3ee2bb5f4373504c3f79cdce576 100644
--- a/components/search_engines/template_url.cc
+++ b/components/search_engines/template_url.cc
@@ -462,14 +462,9 @@ bool TemplateURLRef::ExtractSearchTermsFromURL(
(search_term_key_location_ != url::Parsed::PATH))
return false;
- // Fill-in the replacements. We don't care about search terms in the pattern,
- // so we use the empty string.
- // Currently we assume the search term only shows in URL, not in post params.
- GURL pattern(ReplaceSearchTerms(SearchTermsArgs(base::string16()),
- search_terms_data, NULL));
- // Host, path and port must match.
- if ((url.port() != pattern.port()) ||
- (url.host() != host_) ||
+ // Host, port, and path must match.
+ if ((url.host() != host_) ||
+ (url.port() != port_) ||
((url.path() != path_) &&
(search_term_key_location_ != url::Parsed::PATH))) {
return false;
@@ -526,6 +521,7 @@ bool TemplateURLRef::ExtractSearchTermsFromURL(
void TemplateURLRef::InvalidateCachedValues() const {
supports_replacements_ = valid_ = parsed_ = false;
host_.clear();
+ port_.clear();
path_.clear();
search_term_key_.clear();
search_term_position_in_path_ = std::string::npos;
@@ -777,6 +773,7 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
search_term_key_.clear();
search_term_position_in_path_ = std::string::npos;
host_.clear();
+ port_.clear();
path_.clear();
search_term_key_location_ = url::Parsed::QUERY;
Peter Kasting 2016/01/20 01:42:56 While you're touching this stuff, I don't think an
Mark P 2016/01/20 05:18:06 I looked closer. ParseURL() cannot be static beca
@@ -794,6 +791,7 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
return; // No key or multiple keys found. We only handle having one key.
host_ = url.host();
+ port_ = url.port();
path_ = url.path();
if (in_query) {
search_term_key_ = query_key;
« no previous file with comments | « components/search_engines/template_url.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698