blob: 8876f17969445a303b7f3dd35eb33b47c5feeb88 [file] [log] [blame]
Tomasz Wiszkowskid938a1112019-03-06 18:01:571// Copyright 2019 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#include "components/omnibox/common/omnibox_features.h"
6
manukc32a8eff2019-07-02 15:48:307#include "build/build_config.h"
8
Tomasz Wiszkowskid938a1112019-03-06 18:01:579namespace omnibox {
10
manuk06717f92020-05-29 15:38:4711const auto enabled_by_default_desktop_only =
12#if defined(OS_ANDROID) || defined(OS_IOS)
13 base::FEATURE_DISABLED_BY_DEFAULT
14#else
15 base::FEATURE_ENABLED_BY_DEFAULT
16#endif
17 ;
18
Tomasz Wiszkowski8a0e0dc42020-02-19 00:06:3719// Allows Omnibox to dynamically adjust number of offered suggestions to fill in
20// the space between Omnibox an the soft keyboard. The number of suggestions
21// shown will be no less than minimum for the platform (eg. 5 for Android).
22const base::Feature kAdaptiveSuggestionsCount{
23 "OmniboxAdaptiveSuggestionsCount", base::FEATURE_DISABLED_BY_DEFAULT};
24
Tomasz Wiszkowskid938a1112019-03-06 18:01:5725// Feature used to hide the scheme from steady state URLs displayed in the
26// toolbar. It is restored during editing.
manuk06717f92020-05-29 15:38:4727const base::Feature kHideFileUrlScheme{
28 "OmniboxUIExperimentHideFileUrlScheme",
29 // Android and iOS don't have the File security chip, and therefore still
30 // need to show the file scheme.
31 enabled_by_default_desktop_only};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5732
33// Feature used to hide the scheme from steady state URLs displayed in the
34// toolbar. It is restored during editing.
Tommy C. Li7514ba82019-06-25 19:43:5335const base::Feature kHideSteadyStateUrlScheme{
36 "OmniboxUIExperimentHideSteadyStateUrlScheme",
37 base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5738
39// Feature used to hide trivial subdomains from steady state URLs displayed in
40// the toolbar. It is restored during editing.
Tommy C. Li7514ba82019-06-25 19:43:5341const base::Feature kHideSteadyStateUrlTrivialSubdomains{
42 "OmniboxUIExperimentHideSteadyStateUrlTrivialSubdomains",
43 base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5744
45// Feature used to hide the path, query and ref from steady state URLs
46// displayed in the toolbar. It is restored during editing.
47const base::Feature kHideSteadyStateUrlPathQueryAndRef {
48 "OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRef",
49#if defined(OS_IOS)
50 base::FEATURE_ENABLED_BY_DEFAULT
51#else
52 base::FEATURE_DISABLED_BY_DEFAULT
53#endif
54};
55
manukaddd3c42019-04-09 21:20:5956// Feature used to enable local entity suggestions. Similar to rich entities but
57// but location specific. E.g., typing 'starbucks near' could display the local
58// entity suggestion 'starbucks near disneyland \n starbucks * Anaheim, CA'.
59const base::Feature kOmniboxLocalEntitySuggestions{
60 "OmniboxLocalEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
61
Tomasz Wiszkowskid938a1112019-03-06 18:01:5762// Feature used to enable swapping the rows on answers.
63const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers",
64 base::FEATURE_DISABLED_BY_DEFAULT};
65
Kevin Bailey7d918b92019-05-02 16:00:1466// Feature used to enable matching short words to bookmarks for suggestions.
67const base::Feature kOmniboxShortBookmarkSuggestions{
68 "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
69
Tomasz Wiszkowskid938a1112019-03-06 18:01:5770// Feature used to force on the experiment of transmission of tail suggestions
71// from GWS to this client, currently testing for desktop.
72const base::Feature kOmniboxTailSuggestions{
73 "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
74
Kevin Bailey37bbf1d2019-08-21 19:23:5575// Feature that enables the tab-switch suggestions corresponding to an open
76// tab, for a button or dedicated suggestion. Enabled by default on Desktop
77// and iOS.
Tomasz Wiszkowskid938a1112019-03-06 18:01:5778const base::Feature kOmniboxTabSwitchSuggestions{
79 "OmniboxTabSwitchSuggestions",
Stepan Khapuginb09801662019-05-07 10:17:0480#if defined(OS_ANDROID)
Tomasz Wiszkowskid938a1112019-03-06 18:01:5781 base::FEATURE_DISABLED_BY_DEFAULT
82#else
83 base::FEATURE_ENABLED_BY_DEFAULT
84#endif
85};
86
Kevin Bailey37bbf1d2019-08-21 19:23:5587// Feature that enables tab-switch suggestions in their own row.
88const base::Feature kOmniboxTabSwitchSuggestionsDedicatedRow{
89 "OmniboxTabSwitchSuggestionsDedicatedRow",
90 base::FEATURE_DISABLED_BY_DEFAULT};
91
Tomasz Wiszkowskid938a1112019-03-06 18:01:5792// Feature used to enable various experiments on keyword mode, UI and
93// suggestions.
94const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode",
95 base::FEATURE_DISABLED_BY_DEFAULT};
96
97// Feature used to enable Pedal suggestions.
98const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions",
99 base::FEATURE_DISABLED_BY_DEFAULT};
100
Tomasz Wiszkowskid938a1112019-03-06 18:01:57101// Feature to enable clipboard provider to suggest searching for copied images.
102const base::Feature kEnableClipboardProviderImageSuggestions{
Robbie Gibson85cef3182019-07-21 15:10:29103 "OmniboxEnableClipboardProviderImageSuggestions",
104#if defined(OS_IOS)
105 base::FEATURE_ENABLED_BY_DEFAULT
106#else
107 base::FEATURE_DISABLED_BY_DEFAULT
108#endif
109};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57110
111// Feature to enable the search provider to send a request to the suggest
112// server on focus. This allows the suggest server to warm up, by, for
113// example, loading per-user models into memory. Having a per-user model
114// in memory allows the suggest server to respond more quickly with
115// personalized suggestions as the user types.
116const base::Feature kSearchProviderWarmUpOnFocus{
117 "OmniboxWarmUpSearchProviderOnFocus",
118#if defined(OS_IOS)
119 base::FEATURE_DISABLED_BY_DEFAULT
120#else
121 base::FEATURE_ENABLED_BY_DEFAULT
122#endif
123};
124
Tomasz Wiszkowskid938a1112019-03-06 18:01:57125// Feature used to display the title of the current URL match.
126const base::Feature kDisplayTitleForCurrentUrl{
127 "OmniboxDisplayTitleForCurrentUrl",
128#if !defined(OS_IOS)
129 base::FEATURE_ENABLED_BY_DEFAULT
130#else
131 base::FEATURE_DISABLED_BY_DEFAULT
132#endif
133};
134
Tomasz Wiszkowskid938a1112019-03-06 18:01:57135// Feature used to display the search terms instead of the URL in the Omnibox
136// when the user is on the search results page of the default search provider.
137const base::Feature kQueryInOmnibox{"QueryInOmnibox",
138 base::FEATURE_DISABLED_BY_DEFAULT};
139
Tomasz Wiszkowskid938a1112019-03-06 18:01:57140// Feature used to always swap the title and URL.
141const base::Feature kUIExperimentSwapTitleAndUrl{
142 "OmniboxUIExperimentSwapTitleAndUrl",
143#if defined(OS_IOS) || defined(OS_ANDROID)
144 base::FEATURE_DISABLED_BY_DEFAULT
145#else
146 base::FEATURE_ENABLED_BY_DEFAULT
147#endif
148};
149
Tomasz Wiszkowskid938a1112019-03-06 18:01:57150// Feature used to enable speculatively starting a service worker associated
151// with the destination of the default match when the user's input looks like a
152// query.
153const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{
154 "OmniboxSpeculativeServiceWorkerStartOnQueryInput",
155 base::FEATURE_ENABLED_BY_DEFAULT
156};
157
158// Feature used to fetch document suggestions.
159const base::Feature kDocumentProvider{"OmniboxDocumentProvider",
160 base::FEATURE_DISABLED_BY_DEFAULT};
161
manuk4542e232019-09-11 19:27:35162// Feature used to autocomplete bookmark, history, and document suggestions when
163// the user input is a prefix of their titles, as opposed to their URLs.
164const base::Feature kAutocompleteTitles{"OmniboxAutocompleteTitles",
165 base::FEATURE_DISABLED_BY_DEFAULT};
166
Patrick Noland2b4968b2019-06-27 14:50:26167// Returns whether IsInstantExtendedAPIEnabled should be ignored when deciding
168// the number of Google-provided search suggestions.
169const base::Feature kOmniboxDisableInstantExtendedLimit{
Ender0c8b5b42020-05-26 22:52:51170 "OmniboxDisableInstantExtendedLimit",
171#if defined(OS_ANDROID)
172 base::FEATURE_ENABLED_BY_DEFAULT
173#else
174 base::FEATURE_DISABLED_BY_DEFAULT
175#endif
176};
Patrick Noland2b4968b2019-06-27 14:50:26177
Brandon Wylief8dd4e82019-07-11 16:39:57178// Show the search engine logo in the omnibox on Android (desktop already does
179// this).
180const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo",
181 base::FEATURE_DISABLED_BY_DEFAULT};
182
manukbf3c8ab2019-10-24 16:52:08183// Feature used to allow users to remove suggestions from clipboard.
184const base::Feature kOmniboxRemoveSuggestionsFromClipboard{
Gang Wu8f978362020-05-05 17:53:03185 "OmniboxRemoveSuggestionsFromClipboard",
186#if defined(OS_ANDROID)
187 base::FEATURE_ENABLED_BY_DEFAULT
188#else
189 base::FEATURE_DISABLED_BY_DEFAULT
190#endif
191};
manukbf3c8ab2019-10-24 16:52:08192
manukbf3c8ab2019-10-24 16:52:08193// Feature to debounce drive requests from the document provider.
194const base::Feature kDebounceDocumentProvider{
195 "OmniboxDebounceDocumentProvider", base::FEATURE_DISABLED_BY_DEFAULT};
196
Tommy Li6390ecc2019-09-06 21:08:57197// Preserves the default match against change when providers return results
198// asynchronously. This prevents the default match from changing after the user
199// finishes typing. Without this feature, if the default match is updated right
200// when the user presses Enter, the user may go to a surprising destination.
201const base::Feature kOmniboxPreserveDefaultMatchAgainstAsyncUpdate{
202 "OmniboxPreserveDefaultMatchAgainstAsyncUpdate",
Tommy Li2b9db032020-03-02 22:12:14203 base::FEATURE_ENABLED_BY_DEFAULT};
Tommy Li6390ecc2019-09-06 21:08:57204
manuk7b89f6642019-11-08 19:25:24205// Demotes the relevance scores when comparing suggestions based on the
206// suggestion's |AutocompleteMatchType| and the user's |PageClassification|.
207// This feature's main job is to contain the DemoteByType parameter.
208const base::Feature kOmniboxDemoteByType{"OmniboxDemoteByType",
209 base::FEATURE_DISABLED_BY_DEFAULT};
210
Justin Donnelly477e35e2020-04-02 14:40:00211// A special flag, enabled by default, that can be used to disable all new
212// search features (e.g. zero suggest).
213const base::Feature kNewSearchFeatures{"OmniboxNewSearchFeatures",
214 base::FEATURE_ENABLED_BY_DEFAULT};
215
manuk89d73982020-05-12 01:17:34216// Feature used to cap max zero suggestions shown according to the param
217// OmniboxMaxZeroSuggestMatches. If omitted,
218// OmniboxUIExperimentMaxAutocompleteMatches will be used instead. If present,
219// OmniboxMaxZeroSuggestMatches will override
220// OmniboxUIExperimentMaxAutocompleteMatches when |from_omnibox_focus| is true.
221const base::Feature kMaxZeroSuggestMatches{"OmniboxMaxZeroSuggestMatches",
222 base::FEATURE_DISABLED_BY_DEFAULT};
223
manuk89d73982020-05-12 01:17:34224// Feature used to cap max suggestions shown according to the params
225// UIMaxAutocompleteMatches and UIMaxAutocompleteMatchesByProvider.
226const base::Feature kUIExperimentMaxAutocompleteMatches{
227 "OmniboxUIExperimentMaxAutocompleteMatches",
228 base::FEATURE_DISABLED_BY_DEFAULT};
229
Justin Donnelly444aa062020-05-14 23:27:20230// Feature used to cap the number of URL-type matches shown within the
231// Omnibox. If enabled, the number of URL-type matches is limited (unless
232// there are no more non-URL matches available.) If enabled, there is a
233// companion parameter - OmniboxMaxURLMatches - which specifies the maximum
234// desired number of URL-type matches.
235const bool kOmniboxMaxURLMatchesEnabledByDefault =
236#if defined(OS_IOS) || defined(OS_ANDROID)
237 false;
238#else
239 true;
240#endif
241const base::Feature kOmniboxMaxURLMatches{
242 "OmniboxMaxURLMatches", kOmniboxMaxURLMatchesEnabledByDefault
243 ? base::FEATURE_ENABLED_BY_DEFAULT
244 : base::FEATURE_DISABLED_BY_DEFAULT};
245
Tommy Lib4b3bb5b2020-05-01 02:34:56246// Feature that configures ZeroSuggestProvider using the "ZeroSuggestVariant"
247// per-page-classification parameter.
Tommy Li55784022020-04-28 20:58:18248//
Tommy Lib4b3bb5b2020-05-01 02:34:56249// Generally speaking - do NOT use this for future server-side experiments.
250// Instead, create your a new narrowly scoped base::Feature for each experiment.
251//
252// Because our Field Trial system can only configure this base::Feature in a
253// single study, and does not merge parameters, using this creates conflicts.
Tommy C. Li090105512019-05-16 22:00:56254const base::Feature kOnFocusSuggestions{"OmniboxOnFocusSuggestions",
255 base::FEATURE_ENABLED_BY_DEFAULT};
256
Tommy Li55784022020-04-28 20:58:18257// Enables on-focus suggestions on the Open Web, that are contextual to the
258// current URL. Will only work if user is signed-in and syncing, or is
259// otherwise eligible to send the current page URL to the suggest server.
260const base::Feature kOnFocusSuggestionsContextualWeb{
261 "OmniboxOnFocusSuggestionsContextualWeb",
262 base::FEATURE_DISABLED_BY_DEFAULT};
263
Tommy Lib4b3bb5b2020-05-01 02:34:56264// Enables Proactive ZeroSuggestions (PZPS) on the NTP, for the Omnibox and
265// Realbox respectively. Note: enabling this feature merely makes
266// ZeroSuggestProvider send the request. There are additional requirements,
267// like the user being signed-in, and the suggest server having PZPS enabled.
268const base::Feature kProactiveZeroSuggestionsOnNTPOmnibox{
269 "OmniboxProactiveZeroSuggestionsOnNTPOmnibox",
270 base::FEATURE_DISABLED_BY_DEFAULT};
271const base::Feature kProactiveZeroSuggestionsOnNTPRealbox{
272 "OmniboxProactiveZeroSuggestionsOnNTPRealbox",
273 base::FEATURE_DISABLED_BY_DEFAULT};
274
Tomasz Wiszkowski947f6d0d2019-03-15 22:27:25275// Allow suggestions to be shown to the user on the New Tab Page upon focusing
276// URL bar (the omnibox).
277const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP",
278 base::FEATURE_DISABLED_BY_DEFAULT};
279
Moe Ahmadi4005ec92019-09-09 16:55:53280// Allow suggestions to be shown to the user on the New Tab Page upon focusing
281// the real search box.
282const base::Feature kZeroSuggestionsOnNTPRealbox{
283 "OmniboxZeroSuggestionsOnNTPRealbox", base::FEATURE_DISABLED_BY_DEFAULT};
284
Tommy Li1d03b9bf2019-09-23 23:46:34285// Allow on-focus query refinements to be shown on the default SERP.
286const base::Feature kZeroSuggestionsOnSERP{"OmniboxZeroSuggestionsOnSERP",
287 base::FEATURE_ENABLED_BY_DEFAULT};
288
Ce Chenc8d803a2020-04-27 09:31:33289// Features to provide non personalized head search suggestion from a compact
290// on device model. More specifically, feature name with suffix Incognito /
291// NonIncognito will only controls behaviors under incognito / non-incognito
292// mode respectively.
293const base::Feature kOnDeviceHeadProviderIncognito{
294 "OmniboxOnDeviceHeadProviderIncognito", base::FEATURE_DISABLED_BY_DEFAULT};
295const base::Feature kOnDeviceHeadProviderNonIncognito{
296 "OmniboxOnDeviceHeadProviderNonIncognito",
297 base::FEATURE_DISABLED_BY_DEFAULT};
298
Justin Donnellyf2703482019-10-24 21:42:15299// If enabled, changes the way Google-provided search suggestions are scored by
300// the backend. Note that this Feature is only used for triggering a server-
301// side experiment config that will send experiment IDs to the backend. It is
302// not referred to in any of the Chromium code.
303const base::Feature kOmniboxExperimentalSuggestScoring{
304 "OmniboxExperimentalSuggestScoring", base::FEATURE_DISABLED_BY_DEFAULT};
305
manukh3bb80c92020-01-22 00:19:46306// If disabled, terms with no wordstart matches disqualify the suggestion unless
307// they occur in the URL host. If enabled, terms with no wordstart matches are
308// allowed but not scored. E.g., both inputs 'java script' and 'java cript' will
309// match a suggestion titled 'javascript' and score equivalently.
manukh5ff0f582020-01-14 03:54:13310const base::Feature kHistoryQuickProviderAllowButDoNotScoreMidwordTerms{
311 "OmniboxHistoryQuickProviderAllowButDoNotScoreMidwordTerms",
manuk06717f92020-05-29 15:38:47312 enabled_by_default_desktop_only};
manukh5ff0f582020-01-14 03:54:13313
manukh3bb80c92020-01-22 00:19:46314// If disabled, midword matches are ignored except in the URL host, and input
315// terms with no wordstart matches are scored 0, resulting in an overall score
316// of 0. If enabled, midword matches are allowed and scored when they begin
317// immediately after the previous match ends. E.g. 'java script' will match a
318// suggestion titled 'javascript' but the input 'java cript' won't.
manukh5ff0f582020-01-14 03:54:13319const base::Feature kHistoryQuickProviderAllowMidwordContinuations{
320 "OmniboxHistoryQuickProviderAllowMidwordContinuations",
manuk06717f92020-05-29 15:38:47321 enabled_by_default_desktop_only};
manukh5ff0f582020-01-14 03:54:13322
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19323// If enabled, shows slightly more compact suggestions, allowing the
324// kAdaptiveSuggestionsCount feature to fit more suggestions on screen.
325const base::Feature kCompactSuggestions{"OmniboxCompactSuggestions",
326 base::FEATURE_DISABLED_BY_DEFAULT};
327
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19328// If enabled, defers keyboard popup when user highlights the omnibox until
329// the user taps the Omnibox again.
330extern const base::Feature kDeferredKeyboardPopup{
331 "OmniboxDeferredKeyboardPopup", base::FEATURE_DISABLED_BY_DEFAULT};
332
manuk695f9d4532020-03-18 19:22:08333// If enabled, expands autocompletion to possibly (depending on params) include
334// suggestion titles and non-prefixes as opposed to be restricted to URL
335// prefixes. Will also adjust the location bar UI and omnibox text selection to
336// accommodate the autocompletions.
337const base::Feature kRichAutocompletion{"OmniboxRichAutocompletion",
338 base::FEATURE_DISABLED_BY_DEFAULT};
339
Kevin Bailey104e44492019-10-31 16:42:32340// Feature that enables not counting submatches towards the maximum
341// suggestion limit.
342const base::Feature kOmniboxLooseMaxLimitOnDedicatedRows{
343 "OmniboxLooseMaxLimitOnDedicatedRows", base::FEATURE_DISABLED_BY_DEFAULT};
344
Orin Jaworskifc174722020-01-29 00:32:22345// Feature that puts a single row of buttons on suggestions with actionable
346// elements like keywords, tab-switch buttons, and Pedals.
347const base::Feature kOmniboxSuggestionButtonRow{
348 "OmniboxSuggestionButtonRow", base::FEATURE_DISABLED_BY_DEFAULT};
349
Filip Gorski927709ea2020-04-30 15:58:37350// Enables using an Android RecyclerView to render the suggestions dropdown
351// instead of a ListView.
352const base::Feature kOmniboxSuggestionsRecyclerView{
353 "OmniboxSuggestionsRecyclerView", base::FEATURE_DISABLED_BY_DEFAULT};
354
Tomasz Wiszkowski5ec4f532020-05-19 21:28:10355// Allows long Omnibox suggestions to wrap around to next line.
356const base::Feature kOmniboxSuggestionsWrapAround{
357 "OmniboxSuggestionsWrapAround", base::FEATURE_DISABLED_BY_DEFAULT};
358
Tommy Li1f1fc4a2020-01-31 21:02:07359// If enabled, uses WebUI to render the omnibox suggestions popup, similar to
360// how the NTP "fakebox" is implemented.
361const base::Feature kWebUIOmniboxPopup{"WebUIOmniboxPopup",
362 base::FEATURE_DISABLED_BY_DEFAULT};
363
Brandon Wylie1299ff82020-01-23 02:13:37364// When enabled, use Assistant for omnibox voice query recognition instead of
365// Android's built-in voice recognition service. Only works on Android.
366const base::Feature kOmniboxAssistantVoiceSearch{
367 "OmniboxAssistantVoiceSearch", base::FEATURE_DISABLED_BY_DEFAULT};
368
Livvie Lin30a9f9d2020-03-17 19:45:19369// When enabled, provides an omnibox context menu option that prevents URL
370// elisions.
371const base::Feature kOmniboxContextMenuShowFullUrls{
372 "OmniboxContextMenuShowFullUrls", base::FEATURE_DISABLED_BY_DEFAULT};
373
Tomasz Wiszkowskid938a1112019-03-06 18:01:57374} // namespace omnibox