Fallback to MostVisited when pers 0-query is on but user not signed-in
This CL adds a fallback to display MostVisited URLs when personalized
zero-query is enabled with ChromeHomePersonalizedOmniboxSuggestions but
the user is not signed-in.
TBR=rohitrao
for mechanical changes to ios/c/b/a/*
Bug: 781994
Change-Id: Id4f46c74115d88003d34df9e6b93190cf4c97368
Reviewed-on: https://chromium-review.googlesource.com/796451
Commit-Queue: Gheorghe Comanici <[email protected]>
Reviewed-by: Rohit Rao <[email protected]>
Reviewed-by: Mark Pearson <[email protected]>
Cr-Commit-Position: refs/heads/master@{#520592}
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc
index 8068d2b..99f1ae1 100644
--- a/components/omnibox/browser/zero_suggest_provider.cc
+++ b/components/omnibox/browser/zero_suggest_provider.cc
@@ -91,22 +91,27 @@
// This is true in either of these two cases:
// 1. The user is in zero suggest most visited field trial.
// 2. The user is in zero suggest field trial that enables search-for
-// queries as suggestions and the user does not have Google set up as
-// their default search engine
+// queries as suggestions and the user is either not signed-in or they
+// do not have Google set up as their default search engine.
bool DisplayZeroSuggestMostVisitedURLs(
PrefService* prefs,
+ bool is_authenticated,
const TemplateURLService* template_url_service) {
if (OmniboxFieldTrial::InZeroSuggestMostVisitedFieldTrial(prefs))
return true;
- if (OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(prefs) &&
- template_url_service != nullptr) {
- const TemplateURL* default_provider =
- template_url_service->GetDefaultSearchProvider();
- return default_provider == nullptr ||
- default_provider->GetEngineType(
- template_url_service->search_terms_data()) !=
- SEARCH_ENGINE_GOOGLE;
+ if (OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(prefs)) {
+ if (!is_authenticated)
+ return true;
+
+ if (template_url_service != nullptr) {
+ const TemplateURL* default_provider =
+ template_url_service->GetDefaultSearchProvider();
+ return default_provider == nullptr ||
+ default_provider->GetEngineType(
+ template_url_service->search_terms_data()) !=
+ SEARCH_ENGINE_GOOGLE;
+ }
}
return false;
@@ -197,6 +202,7 @@
MaybeUseCachedSuggestions();
if (DisplayZeroSuggestMostVisitedURLs(client()->GetPrefs(),
+ client()->IsAuthenticated(),
template_url_service)) {
most_visited_urls_.clear();
scoped_refptr<history::TopSites> ts = client()->GetTopSites();
@@ -469,6 +475,7 @@
// Show Most Visited results after ZeroSuggest response is received.
if (DisplayZeroSuggestMostVisitedURLs(client()->GetPrefs(),
+ client()->IsAuthenticated(),
template_url_service)) {
if (!current_url_match_.destination_url.is_valid())
return;