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

Unified Diff: chrome/browser/search_engines/template_url.cc

Issue 12250033: Consolidate search terms extraction and Instant process determination. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Style nit Created 7 years, 10 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
Index: chrome/browser/search_engines/template_url.cc
diff --git a/chrome/browser/search_engines/template_url.cc b/chrome/browser/search_engines/template_url.cc
index 24abf881cb2f6e12bc69511594d80dd0089d80ed..a14bbc4562539ae34b57e83d08dff779aba1ad6d 100644
--- a/chrome/browser/search_engines/template_url.cc
+++ b/chrome/browser/search_engines/template_url.cc
@@ -416,11 +416,6 @@ std::string TemplateURLRef::DisplayURLToURLRef(
return UTF16ToUTF8(result);
}
-const std::string& TemplateURLRef::GetScheme() const {
- ParseIfNecessary();
- return scheme_;
-}
-
const std::string& TemplateURLRef::GetHost() const {
ParseIfNecessary();
return host_;
@@ -524,7 +519,6 @@ bool TemplateURLRef::ExtractSearchTermsFromURL(const GURL& url,
void TemplateURLRef::InvalidateCachedValues() const {
supports_replacements_ = valid_ = parsed_ = false;
- scheme_.clear();
host_.clear();
path_.clear();
search_term_key_.clear();
@@ -691,7 +685,6 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
search_terms_data.GoogleBaseSuggestURLValue());
search_term_key_.clear();
- scheme_.clear();
host_.clear();
path_.clear();
search_term_key_location_ = url_parse::Parsed::REF;
@@ -707,7 +700,6 @@ void TemplateURLRef::ParseHostAndSearchTermKey(
search_term_key_ = query_key.empty() ? ref_key : query_key;
search_term_key_location_ = query_key.empty() ?
url_parse::Parsed::REF : url_parse::Parsed::QUERY;
- scheme_ = url.scheme();
host_ = url.host();
path_ = url.path();
}
@@ -878,34 +870,6 @@ bool TemplateURL::HasSearchTermsReplacementKey(const GURL& url) const {
return false;
}
-bool TemplateURL::IsInstantURL(const GURL& url) {
- // If the url matches the Instant ref, there's no need to
- // check the replacement-key parameter, since we know this
- // is instant.
- // TODO(dhollowa): http://crbug.com/170390. Consolidate Instant URL checks.
- TemplateURLRef ref(this, TemplateURLRef::INSTANT);
- GURL instant_url(ref.ReplaceSearchTerms(
- TemplateURLRef::SearchTermsArgs(string16())));
- if (instant_url.scheme() == url.scheme() &&
- instant_url.host() == url.host() &&
- instant_url.path() == url.path())
- return true;
-
- // Anything else requires the existence of the replacement-key.
- if (!HasSearchTermsReplacementKey(url))
- return false;
-
- for (size_t i = 0; i < URLCount(); ++i) {
- TemplateURLRef ref(this, i);
- if (ref.GetScheme() == url.scheme() &&
- ref.GetHost() == url.host() &&
- ref.GetPath() == url.path())
- return true;
- }
-
- return false;
-}
-
void TemplateURL::CopyFrom(const TemplateURL& other) {
if (this == &other)
return;
« no previous file with comments | « chrome/browser/search_engines/template_url.h ('k') | chrome/browser/search_engines/template_url_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698