Commit 444aa063 authored by Justin Donnelly's avatar Justin Donnelly Committed by Commit Bot

[omnibox] Make max-match type parameters subject to kNewSearchFeatures.

kNewSearchFeatures is a kill switch intended for a long-term holdback of
all search-related launches. See https://crrev.com/c/2132641 and
https://crrev.com/c/2161357 for earlier uses of this Feature.

Bug: 1073606
Change-Id: Ic9ea4394892496c43c6096b22d8236a031f4db6b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2202119
Commit-Queue: Justin Donnelly <jdonnelly@chromium.org>
Reviewed-by: default avatarmanuk hovanesian <manukh@chromium.org>
Cr-Commit-Position: refs/heads/master@{#769040}
parent c8c0edb9
......@@ -86,6 +86,11 @@ size_t AutocompleteResult::GetMaxMatches(bool input_from_omnibox_focus) {
"kMaxAutocompletePositionValue must be larger than the largest "
"possible autocomplete result size.");
// If new search features are disabled, ignore the other parameters and use
// the default value.
if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures))
return kDefaultMaxAutocompleteMatches;
// If we're interested in the zero suggest match limit, and one has been
// specified, return it.
if (input_from_omnibox_focus) {
......
......@@ -363,6 +363,11 @@ size_t OmniboxFieldTrial::GetProviderMaxMatches(
AutocompleteProvider::Type provider) {
size_t default_max_matches_per_provider = 3;
// If new search features are disabled, ignore the parameter and use the
// default value.
if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures))
return default_max_matches_per_provider;
std::string param_value = base::GetFieldTrialParamValueByFeature(
omnibox::kUIExperimentMaxAutocompleteMatches,
OmniboxFieldTrial::kUIMaxAutocompleteMatchesByProviderParam);
......@@ -658,6 +663,12 @@ OmniboxFieldTrial::GetEmphasizeTitlesConditionForInput(
size_t OmniboxFieldTrial::GetMaxURLMatches() {
constexpr size_t kDefaultMaxURLMatches = 7;
// If new search features are disabled, ignore the parameter and use the
// default value.
if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures))
return kDefaultMaxURLMatches;
return base::GetFieldTrialParamByFeatureAsInt(
omnibox::kOmniboxMaxURLMatches,
OmniboxFieldTrial::kOmniboxMaxURLMatchesParam, kDefaultMaxURLMatches);
......@@ -710,6 +721,11 @@ bool OmniboxFieldTrial::IsExperimentalKeywordModeEnabled() {
}
bool OmniboxFieldTrial::IsMaxURLMatchesFeatureEnabled() {
// If new search features are disabled, return the default/launched value for
// the respective platforms, independent of the state of the Feature.
if (!base::FeatureList::IsEnabled(omnibox::kNewSearchFeatures))
return omnibox::kOmniboxMaxURLMatchesEnabledByDefault;
return base::FeatureList::IsEnabled(omnibox::kOmniboxMaxURLMatches);
}
......
......@@ -217,25 +217,27 @@ const base::Feature kNewSearchFeatures{"OmniboxNewSearchFeatures",
const base::Feature kMaxZeroSuggestMatches{"OmniboxMaxZeroSuggestMatches",
base::FEATURE_DISABLED_BY_DEFAULT};
// Feature used to cap max suggestions shown according to the params
// UIMaxAutocompleteMatches and UIMaxAutocompleteMatchesByProvider.
const base::Feature kUIExperimentMaxAutocompleteMatches{
"OmniboxUIExperimentMaxAutocompleteMatches",
base::FEATURE_DISABLED_BY_DEFAULT};
// Feature used to cap the number of URL-type matches shown within the
// Omnibox. If enabled, the number of URL-type matches is limited (unless
// there are no more non-URL matches available.) If enabled, there is a
// companion parameter - OmniboxMaxURLMatches - which specifies the maximum
// desired number of URL-type matches.
const base::Feature kOmniboxMaxURLMatches {
"OmniboxMaxURLMatches",
const bool kOmniboxMaxURLMatchesEnabledByDefault =
#if defined(OS_IOS) || defined(OS_ANDROID)
base::FEATURE_DISABLED_BY_DEFAULT
false;
#else
base::FEATURE_ENABLED_BY_DEFAULT
true;
#endif
};
// Feature used to cap max suggestions shown according to the params
// UIMaxAutocompleteMatches and UIMaxAutocompleteMatchesByProvider.
const base::Feature kUIExperimentMaxAutocompleteMatches{
"OmniboxUIExperimentMaxAutocompleteMatches",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kOmniboxMaxURLMatches{
"OmniboxMaxURLMatches", kOmniboxMaxURLMatchesEnabledByDefault
? base::FEATURE_ENABLED_BY_DEFAULT
: base::FEATURE_DISABLED_BY_DEFAULT};
// Feature that configures ZeroSuggestProvider using the "ZeroSuggestVariant"
// per-page-classification parameter.
......
......@@ -49,9 +49,14 @@ extern const base::Feature kNewSearchFeatures;
// Num suggestions - these affect how many suggestions are shown based on e.g.
// focus, page context, provider, or URL v non-URL.
// Note that all of these are overriden and default values used instead if
// kNewSearchFeatures is disabled.
extern const base::Feature kMaxZeroSuggestMatches;
extern const base::Feature kOmniboxMaxURLMatches;
extern const base::Feature kUIExperimentMaxAutocompleteMatches;
// The default value is established here as a bool so it can be referred to in
// OmniboxFieldTrial.
extern const bool kOmniboxMaxURLMatchesEnabledByDefault;
extern const base::Feature kOmniboxMaxURLMatches;
// On-Focus Suggestions a.k.a. ZeroSuggest.
extern const base::Feature kOnFocusSuggestions;
......
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