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

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: remove unnecessary block of code 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..51f88fdeb08443a19f26d8fa4e2fac4ce0324726 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;
@@ -774,12 +770,6 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
&url_string, 0, "{google:baseSuggestURL}",
search_terms_data.GoogleBaseSuggestURLValue());
- search_term_key_.clear();
- search_term_position_in_path_ = std::string::npos;
- host_.clear();
- path_.clear();
- search_term_key_location_ = url::Parsed::QUERY;
-
GURL url(url_string);
if (!url.is_valid())
return;
@@ -794,6 +784,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