Do not show on-focus suggestions if Suggestions & Autocomplete are off.
This change ensures that personalized suggestions do not show up if user
disables them in settings.
Bug: 934922, 971336
Change-Id: I77b2f8c0c729ff1480a7662177092ce2f6668451
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1640610
Commit-Queue: Ender <[email protected]>
Reviewed-by: Tommy Li <[email protected]>
Reviewed-by: Justin Donnelly <[email protected]>
Cr-Commit-Position: refs/heads/master@{#666907}
diff --git a/components/omnibox/browser/zero_suggest_provider.cc b/components/omnibox/browser/zero_suggest_provider.cc
index 75f05af..0a339cf 100644
--- a/components/omnibox/browser/zero_suggest_provider.cc
+++ b/components/omnibox/browser/zero_suggest_provider.cc
@@ -97,10 +97,12 @@
// default search engine, the personalized service is replaced with the most
// visited service.
bool PersonalizedServiceShouldFallBackToMostVisited(
- PrefService* prefs,
- bool is_authenticated,
+ AutocompleteProviderClient* client,
const TemplateURLService* template_url_service) {
- if (!is_authenticated)
+ if (!client->SearchSuggestEnabled())
+ return true;
+
+ if (!client->IsAuthenticated())
return true;
if (template_url_service == nullptr)
@@ -617,9 +619,8 @@
if (OmniboxFieldTrial::InZeroSuggestPersonalizedFieldTrial(
current_page_classification_)) {
- return PersonalizedServiceShouldFallBackToMostVisited(
- client()->GetPrefs(), client()->IsAuthenticated(),
- template_url_service)
+ return PersonalizedServiceShouldFallBackToMostVisited(client(),
+ template_url_service)
? MOST_VISITED
: REMOTE_NO_URL;
}