blob: dacfbf7f4abcd98664356a4c36b6dfd6e0f195c0 [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
Tomasz Wiszkowski8a0e0dc42020-02-19 00:06:3711// Allows Omnibox to dynamically adjust number of offered suggestions to fill in
12// the space between Omnibox an the soft keyboard. The number of suggestions
13// shown will be no less than minimum for the platform (eg. 5 for Android).
14const base::Feature kAdaptiveSuggestionsCount{
15 "OmniboxAdaptiveSuggestionsCount", base::FEATURE_DISABLED_BY_DEFAULT};
16
Tomasz Wiszkowskid938a1112019-03-06 18:01:5717// Feature used to hide the scheme from steady state URLs displayed in the
18// toolbar. It is restored during editing.
19const base::Feature kHideFileUrlScheme {
20 "OmniboxUIExperimentHideFileUrlScheme",
21// Android and iOS don't have the File security chip, and therefore still
22// need to show the file scheme.
23#if defined(OS_ANDROID) || defined(OS_IOS)
24 base::FEATURE_DISABLED_BY_DEFAULT
25#else
26 base::FEATURE_ENABLED_BY_DEFAULT
27#endif
28};
29
30// Feature used to hide the scheme from steady state URLs displayed in the
31// toolbar. It is restored during editing.
Tommy C. Li7514ba82019-06-25 19:43:5332const base::Feature kHideSteadyStateUrlScheme{
33 "OmniboxUIExperimentHideSteadyStateUrlScheme",
34 base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5735
36// Feature used to hide trivial subdomains from steady state URLs displayed in
37// the toolbar. It is restored during editing.
Tommy C. Li7514ba82019-06-25 19:43:5338const base::Feature kHideSteadyStateUrlTrivialSubdomains{
39 "OmniboxUIExperimentHideSteadyStateUrlTrivialSubdomains",
40 base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5741
42// Feature used to hide the path, query and ref from steady state URLs
43// displayed in the toolbar. It is restored during editing.
44const base::Feature kHideSteadyStateUrlPathQueryAndRef {
45 "OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRef",
46#if defined(OS_IOS)
47 base::FEATURE_ENABLED_BY_DEFAULT
48#else
49 base::FEATURE_DISABLED_BY_DEFAULT
50#endif
51};
52
manukaddd3c42019-04-09 21:20:5953// Feature used to enable local entity suggestions. Similar to rich entities but
54// but location specific. E.g., typing 'starbucks near' could display the local
55// entity suggestion 'starbucks near disneyland \n starbucks * Anaheim, CA'.
56const base::Feature kOmniboxLocalEntitySuggestions{
57 "OmniboxLocalEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
58
Tomasz Wiszkowskid938a1112019-03-06 18:01:5759// Feature used to enable swapping the rows on answers.
60const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers",
61 base::FEATURE_DISABLED_BY_DEFAULT};
62
Kevin Bailey7d918b92019-05-02 16:00:1463// Feature used to enable matching short words to bookmarks for suggestions.
64const base::Feature kOmniboxShortBookmarkSuggestions{
65 "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
66
Tomasz Wiszkowskid938a1112019-03-06 18:01:5767// Feature used to force on the experiment of transmission of tail suggestions
68// from GWS to this client, currently testing for desktop.
69const base::Feature kOmniboxTailSuggestions{
70 "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
71
Kevin Bailey37bbf1d2019-08-21 19:23:5572// Feature that enables the tab-switch suggestions corresponding to an open
73// tab, for a button or dedicated suggestion. Enabled by default on Desktop
74// and iOS.
Tomasz Wiszkowskid938a1112019-03-06 18:01:5775const base::Feature kOmniboxTabSwitchSuggestions{
76 "OmniboxTabSwitchSuggestions",
Stepan Khapuginb09801662019-05-07 10:17:0477#if defined(OS_ANDROID)
Tomasz Wiszkowskid938a1112019-03-06 18:01:5778 base::FEATURE_DISABLED_BY_DEFAULT
79#else
80 base::FEATURE_ENABLED_BY_DEFAULT
81#endif
82};
83
Kevin Bailey37bbf1d2019-08-21 19:23:5584// Feature that enables tab-switch suggestions in their own row.
85const base::Feature kOmniboxTabSwitchSuggestionsDedicatedRow{
86 "OmniboxTabSwitchSuggestionsDedicatedRow",
87 base::FEATURE_DISABLED_BY_DEFAULT};
88
Tomasz Wiszkowskid938a1112019-03-06 18:01:5789// Feature used to enable various experiments on keyword mode, UI and
90// suggestions.
91const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode",
92 base::FEATURE_DISABLED_BY_DEFAULT};
93
94// Feature used to enable Pedal suggestions.
95const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions",
96 base::FEATURE_DISABLED_BY_DEFAULT};
97
Tommy C. Lib3b192f2020-03-27 22:50:2698// Feature that surfaces an X button next to deletable omnibox suggestions.
99// This is to make the suggestion removal feature more discoverable.
Tommy C. Lia2c75fb2019-04-08 20:22:34100const base::Feature kOmniboxSuggestionTransparencyOptions{
Tommy C. Lib3b192f2020-03-27 22:50:26101 "OmniboxSuggestionTransparencyOptions", base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57102
Tomasz Wiszkowskid938a1112019-03-06 18:01:57103// Feature to enable clipboard provider to suggest searching for copied images.
104const base::Feature kEnableClipboardProviderImageSuggestions{
Robbie Gibson85cef3182019-07-21 15:10:29105 "OmniboxEnableClipboardProviderImageSuggestions",
106#if defined(OS_IOS)
107 base::FEATURE_ENABLED_BY_DEFAULT
108#else
109 base::FEATURE_DISABLED_BY_DEFAULT
110#endif
111};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57112
113// Feature to enable the search provider to send a request to the suggest
114// server on focus. This allows the suggest server to warm up, by, for
115// example, loading per-user models into memory. Having a per-user model
116// in memory allows the suggest server to respond more quickly with
117// personalized suggestions as the user types.
118const base::Feature kSearchProviderWarmUpOnFocus{
119 "OmniboxWarmUpSearchProviderOnFocus",
120#if defined(OS_IOS)
121 base::FEATURE_DISABLED_BY_DEFAULT
122#else
123 base::FEATURE_ENABLED_BY_DEFAULT
124#endif
125};
126
Tomasz Wiszkowskid938a1112019-03-06 18:01:57127// Feature used to display the title of the current URL match.
128const base::Feature kDisplayTitleForCurrentUrl{
129 "OmniboxDisplayTitleForCurrentUrl",
130#if !defined(OS_IOS)
131 base::FEATURE_ENABLED_BY_DEFAULT
132#else
133 base::FEATURE_DISABLED_BY_DEFAULT
134#endif
135};
136
Tomasz Wiszkowskid938a1112019-03-06 18:01:57137// Feature used to display the search terms instead of the URL in the Omnibox
138// when the user is on the search results page of the default search provider.
139const base::Feature kQueryInOmnibox{"QueryInOmnibox",
140 base::FEATURE_DISABLED_BY_DEFAULT};
141
Tomasz Wiszkowskid938a1112019-03-06 18:01:57142// Feature used to always swap the title and URL.
143const base::Feature kUIExperimentSwapTitleAndUrl{
144 "OmniboxUIExperimentSwapTitleAndUrl",
145#if defined(OS_IOS) || defined(OS_ANDROID)
146 base::FEATURE_DISABLED_BY_DEFAULT
147#else
148 base::FEATURE_ENABLED_BY_DEFAULT
149#endif
150};
151
Tomasz Wiszkowskid938a1112019-03-06 18:01:57152// Feature used to enable speculatively starting a service worker associated
153// with the destination of the default match when the user's input looks like a
154// query.
155const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{
156 "OmniboxSpeculativeServiceWorkerStartOnQueryInput",
157 base::FEATURE_ENABLED_BY_DEFAULT
158};
159
160// Feature used to fetch document suggestions.
161const base::Feature kDocumentProvider{"OmniboxDocumentProvider",
162 base::FEATURE_DISABLED_BY_DEFAULT};
163
manuk4542e232019-09-11 19:27:35164// Feature used to autocomplete bookmark, history, and document suggestions when
165// the user input is a prefix of their titles, as opposed to their URLs.
166const base::Feature kAutocompleteTitles{"OmniboxAutocompleteTitles",
167 base::FEATURE_DISABLED_BY_DEFAULT};
168
Patrick Noland2b4968b2019-06-27 14:50:26169// Returns whether IsInstantExtendedAPIEnabled should be ignored when deciding
170// the number of Google-provided search suggestions.
171const base::Feature kOmniboxDisableInstantExtendedLimit{
Ender74affe262020-05-01 23:52:49172 "OmniboxDisableInstantExtendedLimit", base::FEATURE_DISABLED_BY_DEFAULT};
Patrick Noland2b4968b2019-06-27 14:50:26173
Brandon Wylief8dd4e82019-07-11 16:39:57174// Show the search engine logo in the omnibox on Android (desktop already does
175// this).
176const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo",
177 base::FEATURE_DISABLED_BY_DEFAULT};
178
manukbf3c8ab2019-10-24 16:52:08179// Feature used to allow users to remove suggestions from clipboard.
180const base::Feature kOmniboxRemoveSuggestionsFromClipboard{
Gang Wu8f978362020-05-05 17:53:03181 "OmniboxRemoveSuggestionsFromClipboard",
182#if defined(OS_ANDROID)
183 base::FEATURE_ENABLED_BY_DEFAULT
184#else
185 base::FEATURE_DISABLED_BY_DEFAULT
186#endif
187};
manukbf3c8ab2019-10-24 16:52:08188
manukbf3c8ab2019-10-24 16:52:08189// Feature to debounce drive requests from the document provider.
190const base::Feature kDebounceDocumentProvider{
191 "OmniboxDebounceDocumentProvider", base::FEATURE_DISABLED_BY_DEFAULT};
192
Tommy Li6390ecc2019-09-06 21:08:57193// Preserves the default match against change when providers return results
194// asynchronously. This prevents the default match from changing after the user
195// finishes typing. Without this feature, if the default match is updated right
196// when the user presses Enter, the user may go to a surprising destination.
197const base::Feature kOmniboxPreserveDefaultMatchAgainstAsyncUpdate{
198 "OmniboxPreserveDefaultMatchAgainstAsyncUpdate",
Tommy Li2b9db032020-03-02 22:12:14199 base::FEATURE_ENABLED_BY_DEFAULT};
Tommy Li6390ecc2019-09-06 21:08:57200
manuk7b89f6642019-11-08 19:25:24201// Demotes the relevance scores when comparing suggestions based on the
202// suggestion's |AutocompleteMatchType| and the user's |PageClassification|.
203// This feature's main job is to contain the DemoteByType parameter.
204const base::Feature kOmniboxDemoteByType{"OmniboxDemoteByType",
205 base::FEATURE_DISABLED_BY_DEFAULT};
206
Justin Donnelly477e35e2020-04-02 14:40:00207// A special flag, enabled by default, that can be used to disable all new
208// search features (e.g. zero suggest).
209const base::Feature kNewSearchFeatures{"OmniboxNewSearchFeatures",
210 base::FEATURE_ENABLED_BY_DEFAULT};
211
manuk89d73982020-05-12 01:17:34212// Feature used to cap max zero suggestions shown according to the param
213// OmniboxMaxZeroSuggestMatches. If omitted,
214// OmniboxUIExperimentMaxAutocompleteMatches will be used instead. If present,
215// OmniboxMaxZeroSuggestMatches will override
216// OmniboxUIExperimentMaxAutocompleteMatches when |from_omnibox_focus| is true.
217const base::Feature kMaxZeroSuggestMatches{"OmniboxMaxZeroSuggestMatches",
218 base::FEATURE_DISABLED_BY_DEFAULT};
219
manuk89d73982020-05-12 01:17:34220// Feature used to cap max suggestions shown according to the params
221// UIMaxAutocompleteMatches and UIMaxAutocompleteMatchesByProvider.
222const base::Feature kUIExperimentMaxAutocompleteMatches{
223 "OmniboxUIExperimentMaxAutocompleteMatches",
224 base::FEATURE_DISABLED_BY_DEFAULT};
225
Justin Donnelly444aa062020-05-14 23:27:20226// Feature used to cap the number of URL-type matches shown within the
227// Omnibox. If enabled, the number of URL-type matches is limited (unless
228// there are no more non-URL matches available.) If enabled, there is a
229// companion parameter - OmniboxMaxURLMatches - which specifies the maximum
230// desired number of URL-type matches.
231const bool kOmniboxMaxURLMatchesEnabledByDefault =
232#if defined(OS_IOS) || defined(OS_ANDROID)
233 false;
234#else
235 true;
236#endif
237const base::Feature kOmniboxMaxURLMatches{
238 "OmniboxMaxURLMatches", kOmniboxMaxURLMatchesEnabledByDefault
239 ? base::FEATURE_ENABLED_BY_DEFAULT
240 : base::FEATURE_DISABLED_BY_DEFAULT};
241
Tommy Lib4b3bb5b2020-05-01 02:34:56242// Feature that configures ZeroSuggestProvider using the "ZeroSuggestVariant"
243// per-page-classification parameter.
Tommy Li55784022020-04-28 20:58:18244//
Tommy Lib4b3bb5b2020-05-01 02:34:56245// Generally speaking - do NOT use this for future server-side experiments.
246// Instead, create your a new narrowly scoped base::Feature for each experiment.
247//
248// Because our Field Trial system can only configure this base::Feature in a
249// single study, and does not merge parameters, using this creates conflicts.
Tommy C. Li090105512019-05-16 22:00:56250const base::Feature kOnFocusSuggestions{"OmniboxOnFocusSuggestions",
251 base::FEATURE_ENABLED_BY_DEFAULT};
252
Tommy Li55784022020-04-28 20:58:18253// Enables on-focus suggestions on the Open Web, that are contextual to the
254// current URL. Will only work if user is signed-in and syncing, or is
255// otherwise eligible to send the current page URL to the suggest server.
256const base::Feature kOnFocusSuggestionsContextualWeb{
257 "OmniboxOnFocusSuggestionsContextualWeb",
258 base::FEATURE_DISABLED_BY_DEFAULT};
259
Tommy Lib4b3bb5b2020-05-01 02:34:56260// Enables Proactive ZeroSuggestions (PZPS) on the NTP, for the Omnibox and
261// Realbox respectively. Note: enabling this feature merely makes
262// ZeroSuggestProvider send the request. There are additional requirements,
263// like the user being signed-in, and the suggest server having PZPS enabled.
264const base::Feature kProactiveZeroSuggestionsOnNTPOmnibox{
265 "OmniboxProactiveZeroSuggestionsOnNTPOmnibox",
266 base::FEATURE_DISABLED_BY_DEFAULT};
267const base::Feature kProactiveZeroSuggestionsOnNTPRealbox{
268 "OmniboxProactiveZeroSuggestionsOnNTPRealbox",
269 base::FEATURE_DISABLED_BY_DEFAULT};
270
Tomasz Wiszkowski947f6d0d2019-03-15 22:27:25271// Allow suggestions to be shown to the user on the New Tab Page upon focusing
272// URL bar (the omnibox).
273const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP",
274 base::FEATURE_DISABLED_BY_DEFAULT};
275
Moe Ahmadi4005ec92019-09-09 16:55:53276// Allow suggestions to be shown to the user on the New Tab Page upon focusing
277// the real search box.
278const base::Feature kZeroSuggestionsOnNTPRealbox{
279 "OmniboxZeroSuggestionsOnNTPRealbox", base::FEATURE_DISABLED_BY_DEFAULT};
280
Tommy Li1d03b9bf2019-09-23 23:46:34281// Allow on-focus query refinements to be shown on the default SERP.
282const base::Feature kZeroSuggestionsOnSERP{"OmniboxZeroSuggestionsOnSERP",
283 base::FEATURE_ENABLED_BY_DEFAULT};
284
Ce Chenc8d803a2020-04-27 09:31:33285// Features to provide non personalized head search suggestion from a compact
286// on device model. More specifically, feature name with suffix Incognito /
287// NonIncognito will only controls behaviors under incognito / non-incognito
288// mode respectively.
289const base::Feature kOnDeviceHeadProviderIncognito{
290 "OmniboxOnDeviceHeadProviderIncognito", base::FEATURE_DISABLED_BY_DEFAULT};
291const base::Feature kOnDeviceHeadProviderNonIncognito{
292 "OmniboxOnDeviceHeadProviderNonIncognito",
293 base::FEATURE_DISABLED_BY_DEFAULT};
294
Justin Donnellyf2703482019-10-24 21:42:15295// If enabled, changes the way Google-provided search suggestions are scored by
296// the backend. Note that this Feature is only used for triggering a server-
297// side experiment config that will send experiment IDs to the backend. It is
298// not referred to in any of the Chromium code.
299const base::Feature kOmniboxExperimentalSuggestScoring{
300 "OmniboxExperimentalSuggestScoring", base::FEATURE_DISABLED_BY_DEFAULT};
301
manukh3bb80c92020-01-22 00:19:46302// If disabled, terms with no wordstart matches disqualify the suggestion unless
303// they occur in the URL host. If enabled, terms with no wordstart matches are
304// allowed but not scored. E.g., both inputs 'java script' and 'java cript' will
305// match a suggestion titled 'javascript' and score equivalently.
manukh5ff0f582020-01-14 03:54:13306const base::Feature kHistoryQuickProviderAllowButDoNotScoreMidwordTerms{
307 "OmniboxHistoryQuickProviderAllowButDoNotScoreMidwordTerms",
308 base::FEATURE_DISABLED_BY_DEFAULT};
309
manukh3bb80c92020-01-22 00:19:46310// If disabled, midword matches are ignored except in the URL host, and input
311// terms with no wordstart matches are scored 0, resulting in an overall score
312// of 0. If enabled, midword matches are allowed and scored when they begin
313// immediately after the previous match ends. E.g. 'java script' will match a
314// suggestion titled 'javascript' but the input 'java cript' won't.
manukh5ff0f582020-01-14 03:54:13315const base::Feature kHistoryQuickProviderAllowMidwordContinuations{
316 "OmniboxHistoryQuickProviderAllowMidwordContinuations",
317 base::FEATURE_DISABLED_BY_DEFAULT};
318
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19319// If enabled, shows slightly more compact suggestions, allowing the
320// kAdaptiveSuggestionsCount feature to fit more suggestions on screen.
321const base::Feature kCompactSuggestions{"OmniboxCompactSuggestions",
322 base::FEATURE_DISABLED_BY_DEFAULT};
323
Tommy Li7c2bf492019-10-22 19:34:23324// If enabled, shows a confirm dialog before removing search suggestions from
325// the omnibox. See ConfirmNtpSuggestionRemovals for the NTP equivalent.
326const base::Feature kConfirmOmniboxSuggestionRemovals{
327 "ConfirmOmniboxSuggestionRemovals", base::FEATURE_DISABLED_BY_DEFAULT};
328
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19329// If enabled, defers keyboard popup when user highlights the omnibox until
330// the user taps the Omnibox again.
331extern const base::Feature kDeferredKeyboardPopup{
332 "OmniboxDeferredKeyboardPopup", base::FEATURE_DISABLED_BY_DEFAULT};
333
manuk695f9d4532020-03-18 19:22:08334// If enabled, expands autocompletion to possibly (depending on params) include
335// suggestion titles and non-prefixes as opposed to be restricted to URL
336// prefixes. Will also adjust the location bar UI and omnibox text selection to
337// accommodate the autocompletions.
338const base::Feature kRichAutocompletion{"OmniboxRichAutocompletion",
339 base::FEATURE_DISABLED_BY_DEFAULT};
340
Kevin Bailey104e44492019-10-31 16:42:32341// Feature that enables not counting submatches towards the maximum
342// suggestion limit.
343const base::Feature kOmniboxLooseMaxLimitOnDedicatedRows{
344 "OmniboxLooseMaxLimitOnDedicatedRows", base::FEATURE_DISABLED_BY_DEFAULT};
345
Orin Jaworskifc174722020-01-29 00:32:22346// Feature that puts a single row of buttons on suggestions with actionable
347// elements like keywords, tab-switch buttons, and Pedals.
348const base::Feature kOmniboxSuggestionButtonRow{
349 "OmniboxSuggestionButtonRow", base::FEATURE_DISABLED_BY_DEFAULT};
350
Filip Gorski927709ea2020-04-30 15:58:37351// Enables using an Android RecyclerView to render the suggestions dropdown
352// instead of a ListView.
353const base::Feature kOmniboxSuggestionsRecyclerView{
354 "OmniboxSuggestionsRecyclerView", base::FEATURE_DISABLED_BY_DEFAULT};
355
Tommy Li1f1fc4a2020-01-31 21:02:07356// If enabled, uses WebUI to render the omnibox suggestions popup, similar to
357// how the NTP "fakebox" is implemented.
358const base::Feature kWebUIOmniboxPopup{"WebUIOmniboxPopup",
359 base::FEATURE_DISABLED_BY_DEFAULT};
360
Brandon Wylie1299ff82020-01-23 02:13:37361// When enabled, use Assistant for omnibox voice query recognition instead of
362// Android's built-in voice recognition service. Only works on Android.
363const base::Feature kOmniboxAssistantVoiceSearch{
364 "OmniboxAssistantVoiceSearch", base::FEATURE_DISABLED_BY_DEFAULT};
365
Livvie Lin30a9f9d2020-03-17 19:45:19366// When enabled, provides an omnibox context menu option that prevents URL
367// elisions.
368const base::Feature kOmniboxContextMenuShowFullUrls{
369 "OmniboxContextMenuShowFullUrls", base::FEATURE_DISABLED_BY_DEFAULT};
370
Tomasz Wiszkowskid938a1112019-03-06 18:01:57371} // namespace omnibox