[omnibox] [max-suggest] Add dynamic suggestions limit per # of URLs.

Adds a OmniboxDynamicMaxAutocomplete feature with 2 params,
OmniboxDynamicMaxAutocompleteUrlCutoff &
OmniboxDynamicMaxAutocompleteIncreasedLimit.
- When disabled, the omnibox allows UIMaxAutocompleteMatches
suggestions.
- When dynamic max autocompletion is enabled, the omnibox allows
suggestions up to the increased limit if doing so has URL cutoff or less
URL suggestions. It could also allow a partial increase if doing so
avoids showing more than the cutoff.

E.g. a UIMaxAutocompleteMatches of 8, URL cutoff of 2, and increased
limit of 10 translates to "show 10 or 9 suggestions if doing so includes
at most 2 URLs; otherwise show 8 suggestions.


Change-Id: I2f5e589f9e5307a62158223e6f6965476e55c257
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274466
Commit-Queue: manuk hovanesian <[email protected]>
Reviewed-by: Justin Donnelly <[email protected]>
Cr-Commit-Position: refs/heads/master@{#786541}
diff --git a/components/omnibox/common/omnibox_features.cc b/components/omnibox/common/omnibox_features.cc
index c4c7b56..f12af1d3 100644
--- a/components/omnibox/common/omnibox_features.cc
+++ b/components/omnibox/common/omnibox_features.cc
@@ -215,6 +215,12 @@
                                 ? base::FEATURE_ENABLED_BY_DEFAULT
                                 : base::FEATURE_DISABLED_BY_DEFAULT};
 
+// Feature used to cap max suggestions to a dynamic limit based on how many URLs
+// would be shown. E.g., show up to 10 suggestions if doing so would display no
+// URLs; else show up to 8 suggestions if doing so would include 1 or more URLs.
+const base::Feature kDynamicMaxAutocomplete{"OmniboxDynamicMaxAutocomplete",
+                                            base::FEATURE_DISABLED_BY_DEFAULT};
+
 // Feature that configures ZeroSuggestProvider using the "ZeroSuggestVariant"
 // per-page-classification parameter.
 //