Commit eb944ce4 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

Disables Vasco suggestions when zero-prefix suggestions in NTP are enabled

This is a follow up to crrev.com/c/1809966. Disables Vasco chips in the NTP
when zero-prefix suggestions are enabled using omnibox::kOnFocusSuggestions

Bug: 996516
Change-Id: I8ee718d710fd150eabf4f2943cdc9b489a76b33a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856861Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705222}
parent e8270472
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include "chrome/browser/search/search.h" #include "chrome/browser/search/search.h"
#include "chrome/browser/search/search_suggest/search_suggest_loader.h" #include "chrome/browser/search/search_suggest/search_suggest_loader.h"
#include "chrome/common/pref_names.h" #include "chrome/common/pref_names.h"
#include "components/omnibox/browser/omnibox_field_trial.h"
#include "components/omnibox/common/omnibox_features.h" #include "components/omnibox/common/omnibox_features.h"
#include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/scoped_user_pref_update.h"
#include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h" #include "components/signin/public/identity_manager/accounts_in_cookie_jar_info.h"
...@@ -97,10 +98,16 @@ class SearchSuggestService::SigninObserver ...@@ -97,10 +98,16 @@ class SearchSuggestService::SigninObserver
// static // static
bool SearchSuggestService::IsEnabled() { bool SearchSuggestService::IsEnabled() {
// Search suggestions should be disabled when on-focus zero-prefix suggestions
// are displaying in the NTP.
return !base::FeatureList::IsEnabled(omnibox::kZeroSuggestionsOnNTP) && return !base::FeatureList::IsEnabled(omnibox::kZeroSuggestionsOnNTP) &&
!base::FeatureList::IsEnabled(omnibox::kZeroSuggestionsOnNTPRealbox); !base::FeatureList::IsEnabled(omnibox::kZeroSuggestionsOnNTPRealbox) &&
!(base::FeatureList::IsEnabled(omnibox::kOnFocusSuggestions) &&
(!OmniboxFieldTrial::GetZeroSuggestVariants(
metrics::OmniboxEventProto::NTP_REALBOX)
.empty() ||
!OmniboxFieldTrial::GetZeroSuggestVariants(
metrics::OmniboxEventProto::
INSTANT_NTP_WITH_OMNIBOX_AS_STARTING_FOCUS)
.empty()));
} }
SearchSuggestService::SearchSuggestService( SearchSuggestService::SearchSuggestService(
......
...@@ -28,6 +28,11 @@ class IdentityManager; ...@@ -28,6 +28,11 @@ class IdentityManager;
// user signs in or out, the cached value is cleared. // user signs in or out, the cached value is cleared.
class SearchSuggestService : public KeyedService { class SearchSuggestService : public KeyedService {
public: public:
// Search suggestions should be disabled when on-focus zero-prefix suggestions
// are displaying in the NTP. Returns false if omnibox::kZeroSuggestionsOnNTP
// or omnibox::kZeroSuggestionsOnNTPRealboxkNtpRealbox are enabled; or
// omnibox::kOnFocusSuggestions is enabled and configured to show suggestions
// of some type in the NTP Omnibox or Realbox.
static bool IsEnabled(); static bool IsEnabled();
SearchSuggestService(Profile* profile, SearchSuggestService(Profile* profile,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment