Commit 3def15c0 authored by Tomasz Wiszkowski's avatar Tomasz Wiszkowski Committed by Commit Bot

Remove MaxAutocompleteMatches restriction for Zero-Prefix suggestions.

This change enables the OmniboxUIExperimentMaxAutocompleteMatches flag to
control ZeroPrefixSuggestions as well as other search suggestion types.

Bug: 1066904
Change-Id: I8eb0f41c0c86ecff32ad35f3a808225138e0ccb0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2132632
Commit-Queue: Ender <ender@google.com>
Reviewed-by: default avatarTommy Li <tommycli@chromium.org>
Cr-Commit-Position: refs/heads/master@{#755438}
parent 45ba3bb9
......@@ -73,11 +73,9 @@ struct MatchGURLHash {
};
// static
size_t AutocompleteResult::GetMaxMatches(bool is_zero_suggest) {
size_t AutocompleteResult::GetMaxMatches() {
#if (defined(OS_ANDROID))
constexpr size_t kDefaultMaxAutocompleteMatches = 5;
if (is_zero_suggest)
return kDefaultMaxAutocompleteMatches;
#elif defined(OS_IOS) // !defined(OS_ANDROID)
constexpr size_t kDefaultMaxAutocompleteMatches = 6;
#else // !defined(OS_ANDROID) && !defined(OS_IOS)
......@@ -586,7 +584,7 @@ size_t AutocompleteResult::CalculateNumMatches(
const CompareWithDemoteByType<AutocompleteMatch>& comparing_object) {
// In the process of trimming, drop all matches with a demoted relevance
// score of 0.
size_t max_matches_by_policy = GetMaxMatches(input_from_omnibox_focus);
size_t max_matches_by_policy = GetMaxMatches();
size_t num_matches = 0;
while (num_matches < matches.size() &&
comparing_object.GetDemotedRelevance(matches[num_matches]) > 0) {
......
......@@ -32,7 +32,7 @@ class AutocompleteResult {
using MatchDedupComparator = std::pair<GURL, bool>;
// Max number of matches we'll show from the various providers.
static size_t GetMaxMatches(bool is_zero_suggest = false);
static size_t GetMaxMatches();
AutocompleteResult();
~AutocompleteResult();
......
......@@ -156,7 +156,7 @@ LocalHistoryZeroSuggestProvider::LocalHistoryZeroSuggestProvider(
AutocompleteProviderListener* listener)
: AutocompleteProvider(
AutocompleteProvider::TYPE_ZERO_SUGGEST_LOCAL_HISTORY),
max_matches_(AutocompleteResult::GetMaxMatches(/*is_zero_suggest=*/true)),
max_matches_(AutocompleteResult::GetMaxMatches()),
client_(client),
listener_(listener) {}
......
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