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

Unified Diff: chrome/browser/autocomplete/zero_suggest_provider.cc

Issue 23621037: Send URLs on non-zero prefix suggest requests also. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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/autocomplete/zero_suggest_provider.cc
diff --git a/chrome/browser/autocomplete/zero_suggest_provider.cc b/chrome/browser/autocomplete/zero_suggest_provider.cc
index 24b029187ee493dd5ccaaa9ef074dbe4e538c7d6..3afdffe65aa9f9265953d21dc8e7529bd858586d 100644
--- a/chrome/browser/autocomplete/zero_suggest_provider.cc
+++ b/chrome/browser/autocomplete/zero_suggest_provider.cc
@@ -156,7 +156,8 @@ void ZeroSuggestProvider::StartZeroSuggest(
Stop(true);
field_trial_triggered_ = false;
field_trial_triggered_in_session_ = false;
- if (!ShouldRunZeroSuggest(url))
+ if (!SearchProvider::CanSendURL(url, profile_) ||
+ !OmniboxFieldTrial::InZeroSuggestFieldTrial())
return;
verbatim_relevance_ = kDefaultVerbatimZeroSuggestRelevance;
done_ = false;
@@ -186,45 +187,6 @@ ZeroSuggestProvider::ZeroSuggestProvider(
ZeroSuggestProvider::~ZeroSuggestProvider() {
}
-bool ZeroSuggestProvider::ShouldRunZeroSuggest(const GURL& url) const {
- if (!ShouldSendURL(url))
- return false;
-
- // Don't run if there's no profile or in incognito mode.
- if (profile_ == NULL || profile_->IsOffTheRecord())
- return false;
-
- // Don't run if we can't get preferences or search suggest is not enabled.
- PrefService* prefs = profile_->GetPrefs();
- if (prefs == NULL || !prefs->GetBoolean(prefs::kSearchSuggestEnabled))
- return false;
-
- ProfileSyncService* service =
- ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_);
- browser_sync::SyncPrefs sync_prefs(prefs);
- // The user has needs to have Chrome Sync enabled (for permissions to
- // transmit their current URL) and be in the field trial.
- if (!OmniboxFieldTrial::InZeroSuggestFieldTrial() ||
- service == NULL ||
- !service->IsSyncEnabledAndLoggedIn() ||
- !sync_prefs.HasKeepEverythingSynced()) {
- return false;
- }
- return true;
-}
-
-bool ZeroSuggestProvider::ShouldSendURL(const GURL& url) const {
- if (!url.is_valid())
- return false;
-
- // Only allow HTTP URLs or Google HTTPS URLs (including Google search
- // result pages). For the latter case, Google was already sent the HTTPS
- // URLs when requesting the page, so the information is just re-sent.
- return (url.scheme() == content::kHttpScheme) ||
- google_util::IsGoogleDomainUrl(url, google_util::ALLOW_SUBDOMAIN,
- google_util::ALLOW_NON_STANDARD_PORTS);
-}
-
void ZeroSuggestProvider::FillResults(
const Value& root_val,
int* verbatim_relevance,
@@ -385,7 +347,7 @@ void ZeroSuggestProvider::Run() {
}
string16 prefix;
TemplateURLRef::SearchTermsArgs search_term_args(prefix);
- search_term_args.zero_prefix_url = current_query_;
+ search_term_args.current_page_url = current_query_;
std::string req_url = default_provider->suggestions_url_ref().
ReplaceSearchTerms(search_term_args);
GURL suggest_url(req_url);

Powered by Google App Engine
This is Rietveld 408576698