Commit 41a09e81 authored by Moe Ahmadi's avatar Moe Ahmadi Committed by Commit Bot

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

Bug: 996516
Change-Id: Ib536df9fc6c9f645f6932cdc399259fc2be01de2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1809966
Auto-Submit: Moe Ahmadi <mahmadi@chromium.org>
Reviewed-by: default avatarRamya Nagarajan <ramyan@chromium.org>
Commit-Queue: Moe Ahmadi <mahmadi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#697829}
parent d1971940
......@@ -8,12 +8,14 @@
#include "base/bind.h"
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/search.h"
#include "chrome/browser/search/search_suggest/search_suggest_loader.h"
#include "chrome/common/pref_names.h"
#include "components/omnibox/common/omnibox_features.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/identity_manager.h"
......@@ -93,6 +95,14 @@ class SearchSuggestService::SigninObserver
SigninStatusChangedCallback callback_;
};
// static
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) &&
!base::FeatureList::IsEnabled(omnibox::kZeroSuggestionsOnNTPRealbox);
}
SearchSuggestService::SearchSuggestService(
Profile* profile,
signin::IdentityManager* identity_manager,
......
......@@ -28,6 +28,8 @@ class IdentityManager;
// user signs in or out, the cached value is cleared.
class SearchSuggestService : public KeyedService {
public:
static bool IsEnabled();
SearchSuggestService(Profile* profile,
signin::IdentityManager* identity_manager,
std::unique_ptr<SearchSuggestLoader> loader);
......
......@@ -46,6 +46,9 @@ SearchSuggestServiceFactory::~SearchSuggestServiceFactory() = default;
KeyedService* SearchSuggestServiceFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const {
if (!SearchSuggestService::IsEnabled())
return nullptr;
Profile* profile = Profile::FromBrowserContext(context);
signin::IdentityManager* identity_manager =
IdentityManagerFactory::GetForProfile(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