Chromium Code Reviews| 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; |