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

Unified Diff: chrome/browser/search/search.cc

Issue 2651763002: Cleanup in components/search and chrome/browser/search (Closed)
Patch Set: for each Created 3 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 | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/search/search.cc
diff --git a/chrome/browser/search/search.cc b/chrome/browser/search/search.cc
index 479d095524a926ed10138f895be3decaf15cdd40..79bc9b6ff9f7bb0226b5b69b1a23c62d7b2c380e 100644
--- a/chrome/browser/search/search.cc
+++ b/chrome/browser/search/search.cc
@@ -120,6 +120,15 @@ GURL TemplateURLRefToGURL(const TemplateURLRef& ref,
return GURL(ref.ReplaceSearchTerms(search_terms_args, search_terms_data));
}
+// |url| should either have a secure scheme or have a non-HTTPS base URL that
+// the user specified using --google-base-url. (This allows testers to use
+// --google-base-url to point at non-HTTPS servers, which eases testing.)
+bool IsSuitableURLForInstant(const GURL& url, const TemplateURL* template_url) {
+ return template_url->HasSearchTermsReplacementKey(url) &&
+ (url.SchemeIsCryptographic() ||
+ google_util::StartsWithCommandLineGoogleBaseURL(url));
+}
+
// Returns true if |url| can be used as an Instant URL for |profile|.
bool IsInstantURL(const GURL& url, Profile* profile) {
if (!IsInstantExtendedAPIEnabled())
@@ -261,11 +270,6 @@ base::string16 ExtractSearchTermsFromURL(Profile* profile, const GURL& url) {
return search_terms;
}
-bool IsQueryExtractionAllowedForURL(Profile* profile, const GURL& url) {
- TemplateURL* template_url = GetDefaultSearchProviderTemplateURL(profile);
- return template_url && IsSuitableURLForInstant(url, template_url);
-}
-
bool ShouldAssignURLToInstantRenderer(const GURL& url, Profile* profile) {
return url.is_valid() &&
profile &&
@@ -392,7 +396,7 @@ GURL GetNewTabPageURL(Profile* profile) {
}
GURL GetSearchResultPrefetchBaseURL(Profile* profile) {
- return ShouldPrefetchSearchResults() ? GetInstantURL(profile, true) : GURL();
+ return GetInstantURL(profile, true);
}
GURL GetEffectiveURLForInstant(const GURL& url, Profile* profile) {
« no previous file with comments | « chrome/browser/search/search.h ('k') | chrome/browser/search/search_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698