blob: 1fe975c3285b29cfb7235dce57d14ffa08814a75 [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
Kevin Baileyb3e08732019-05-29 03:55:2559// Feature used to cap the number of URL-type matches shown within the
60// Omnibox. If enabled, the number of URL-type matches is limited (unless
61// there are no more non-URL matches available.) If enabled, there is a
62// companion parameter - OmniboxMaxURLMatches - which specifies the maximum
63// desired number of URL-type matches.
Kevin Bailey26238862019-10-31 22:08:1264const base::Feature kOmniboxMaxURLMatches {
65 "OmniboxMaxURLMatches",
66#if defined(OS_IOS) || defined(OS_ANDROID)
67 base::FEATURE_DISABLED_BY_DEFAULT
68#else
69 base::FEATURE_ENABLED_BY_DEFAULT
70#endif
71};
Kevin Baileyb3e08732019-05-29 03:55:2572
Tomasz Wiszkowskid938a1112019-03-06 18:01:5773// Feature used to enable entity suggestion images and enhanced presentation
74// showing more context and descriptive text about the entity.
75const base::Feature kOmniboxRichEntitySuggestions{
Justin Donnelly481a69c2019-05-03 20:41:4276 "OmniboxRichEntitySuggestions",
77#if defined(OS_IOS) || defined(OS_ANDROID)
78 base::FEATURE_DISABLED_BY_DEFAULT
79#else
80 base::FEATURE_ENABLED_BY_DEFAULT
81#endif
82};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5783
Tomasz Wiszkowskid938a1112019-03-06 18:01:5784// Feature used to enable swapping the rows on answers.
85const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers",
86 base::FEATURE_DISABLED_BY_DEFAULT};
87
Kevin Bailey7d918b92019-05-02 16:00:1488// Feature used to enable matching short words to bookmarks for suggestions.
89const base::Feature kOmniboxShortBookmarkSuggestions{
90 "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
91
Tomasz Wiszkowskid938a1112019-03-06 18:01:5792// Feature used to force on the experiment of transmission of tail suggestions
93// from GWS to this client, currently testing for desktop.
94const base::Feature kOmniboxTailSuggestions{
95 "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
96
Kevin Bailey37bbf1d2019-08-21 19:23:5597// Feature that enables the tab-switch suggestions corresponding to an open
98// tab, for a button or dedicated suggestion. Enabled by default on Desktop
99// and iOS.
Tomasz Wiszkowskid938a1112019-03-06 18:01:57100const base::Feature kOmniboxTabSwitchSuggestions{
101 "OmniboxTabSwitchSuggestions",
Stepan Khapuginb09801662019-05-07 10:17:04102#if defined(OS_ANDROID)
Tomasz Wiszkowskid938a1112019-03-06 18:01:57103 base::FEATURE_DISABLED_BY_DEFAULT
104#else
105 base::FEATURE_ENABLED_BY_DEFAULT
106#endif
107};
108
Kevin Bailey37bbf1d2019-08-21 19:23:55109// Feature that enables tab-switch suggestions in their own row.
110const base::Feature kOmniboxTabSwitchSuggestionsDedicatedRow{
111 "OmniboxTabSwitchSuggestionsDedicatedRow",
112 base::FEATURE_DISABLED_BY_DEFAULT};
113
Tomasz Wiszkowskid938a1112019-03-06 18:01:57114// Feature used to enable various experiments on keyword mode, UI and
115// suggestions.
116const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode",
117 base::FEATURE_DISABLED_BY_DEFAULT};
118
119// Feature used to enable Pedal suggestions.
120const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions",
121 base::FEATURE_DISABLED_BY_DEFAULT};
122
Tommy C. Lib3b192f2020-03-27 22:50:26123// Feature that surfaces an X button next to deletable omnibox suggestions.
124// This is to make the suggestion removal feature more discoverable.
Tommy C. Lia2c75fb2019-04-08 20:22:34125const base::Feature kOmniboxSuggestionTransparencyOptions{
Tommy C. Lib3b192f2020-03-27 22:50:26126 "OmniboxSuggestionTransparencyOptions", base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57127
Tomasz Wiszkowskid938a1112019-03-06 18:01:57128// Feature to enable clipboard provider to suggest searching for copied images.
129const base::Feature kEnableClipboardProviderImageSuggestions{
Robbie Gibson85cef3182019-07-21 15:10:29130 "OmniboxEnableClipboardProviderImageSuggestions",
131#if defined(OS_IOS)
132 base::FEATURE_ENABLED_BY_DEFAULT
133#else
134 base::FEATURE_DISABLED_BY_DEFAULT
135#endif
136};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57137
138// Feature to enable the search provider to send a request to the suggest
139// server on focus. This allows the suggest server to warm up, by, for
140// example, loading per-user models into memory. Having a per-user model
141// in memory allows the suggest server to respond more quickly with
142// personalized suggestions as the user types.
143const base::Feature kSearchProviderWarmUpOnFocus{
144 "OmniboxWarmUpSearchProviderOnFocus",
145#if defined(OS_IOS)
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 display the title of the current URL match.
153const base::Feature kDisplayTitleForCurrentUrl{
154 "OmniboxDisplayTitleForCurrentUrl",
155#if !defined(OS_IOS)
156 base::FEATURE_ENABLED_BY_DEFAULT
157#else
158 base::FEATURE_DISABLED_BY_DEFAULT
159#endif
160};
161
162// Feature used for the max autocomplete matches UI experiment.
163const base::Feature kUIExperimentMaxAutocompleteMatches{
164 "OmniboxUIExperimentMaxAutocompleteMatches",
165 base::FEATURE_DISABLED_BY_DEFAULT};
166
167// Feature used to display the search terms instead of the URL in the Omnibox
168// when the user is on the search results page of the default search provider.
169const base::Feature kQueryInOmnibox{"QueryInOmnibox",
170 base::FEATURE_DISABLED_BY_DEFAULT};
171
Tomasz Wiszkowskid938a1112019-03-06 18:01:57172// Feature used to always swap the title and URL.
173const base::Feature kUIExperimentSwapTitleAndUrl{
174 "OmniboxUIExperimentSwapTitleAndUrl",
175#if defined(OS_IOS) || defined(OS_ANDROID)
176 base::FEATURE_DISABLED_BY_DEFAULT
177#else
178 base::FEATURE_ENABLED_BY_DEFAULT
179#endif
180};
181
Tomasz Wiszkowskid938a1112019-03-06 18:01:57182// Feature used to enable speculatively starting a service worker associated
183// with the destination of the default match when the user's input looks like a
184// query.
185const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{
186 "OmniboxSpeculativeServiceWorkerStartOnQueryInput",
187 base::FEATURE_ENABLED_BY_DEFAULT
188};
189
190// Feature used to fetch document suggestions.
191const base::Feature kDocumentProvider{"OmniboxDocumentProvider",
192 base::FEATURE_DISABLED_BY_DEFAULT};
193
manuk4542e232019-09-11 19:27:35194// Feature used to autocomplete bookmark, history, and document suggestions when
195// the user input is a prefix of their titles, as opposed to their URLs.
196const base::Feature kAutocompleteTitles{"OmniboxAutocompleteTitles",
197 base::FEATURE_DISABLED_BY_DEFAULT};
198
Patrick Noland2b4968b2019-06-27 14:50:26199// Returns whether IsInstantExtendedAPIEnabled should be ignored when deciding
200// the number of Google-provided search suggestions.
201const base::Feature kOmniboxDisableInstantExtendedLimit{
Tomasz Wiszkowski3b71610c2020-04-01 21:32:09202 "OmniboxDisableInstantExtendedLimit",
203#if defined(OS_ANDROID)
204 base::FEATURE_ENABLED_BY_DEFAULT
205#else
206 base::FEATURE_DISABLED_BY_DEFAULT
207#endif
208};
Patrick Noland2b4968b2019-06-27 14:50:26209
Brandon Wylief8dd4e82019-07-11 16:39:57210// Show the search engine logo in the omnibox on Android (desktop already does
211// this).
212const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo",
213 base::FEATURE_DISABLED_BY_DEFAULT};
214
manukbf3c8ab2019-10-24 16:52:08215// Feature used to allow users to remove suggestions from clipboard.
216const base::Feature kOmniboxRemoveSuggestionsFromClipboard{
217 "OmniboxRemoveSuggestionsFromClipboard", base::FEATURE_DISABLED_BY_DEFAULT};
218
219// Feature to provide non personalized head search suggestion from a compact
220// on device model.
221const base::Feature kOnDeviceHeadProvider{"OmniboxOnDeviceHeadProvider",
222 base::FEATURE_DISABLED_BY_DEFAULT};
223
224// Feature to debounce drive requests from the document provider.
225const base::Feature kDebounceDocumentProvider{
226 "OmniboxDebounceDocumentProvider", base::FEATURE_DISABLED_BY_DEFAULT};
227
Tommy Li6390ecc2019-09-06 21:08:57228// Preserves the default match against change when providers return results
229// asynchronously. This prevents the default match from changing after the user
230// finishes typing. Without this feature, if the default match is updated right
231// when the user presses Enter, the user may go to a surprising destination.
232const base::Feature kOmniboxPreserveDefaultMatchAgainstAsyncUpdate{
233 "OmniboxPreserveDefaultMatchAgainstAsyncUpdate",
Tommy Li2b9db032020-03-02 22:12:14234 base::FEATURE_ENABLED_BY_DEFAULT};
Tommy Li6390ecc2019-09-06 21:08:57235
manuk7b89f6642019-11-08 19:25:24236// Demotes the relevance scores when comparing suggestions based on the
237// suggestion's |AutocompleteMatchType| and the user's |PageClassification|.
238// This feature's main job is to contain the DemoteByType parameter.
239const base::Feature kOmniboxDemoteByType{"OmniboxDemoteByType",
240 base::FEATURE_DISABLED_BY_DEFAULT};
241
Justin Donnelly477e35e2020-04-02 14:40:00242// A special flag, enabled by default, that can be used to disable all new
243// search features (e.g. zero suggest).
244const base::Feature kNewSearchFeatures{"OmniboxNewSearchFeatures",
245 base::FEATURE_ENABLED_BY_DEFAULT};
246
Tommy C. Li090105512019-05-16 22:00:56247// Feature to configure on-focus suggestions provided by ZeroSuggestProvider.
Tommy C. Li414f22022019-06-07 23:46:22248// This feature's main job is to contain some field trial parameters such as:
249// - "ZeroSuggestVariant" configures the per-page-classification mode of
250// ZeroSuggestProvider.
Tommy C. Li090105512019-05-16 22:00:56251const base::Feature kOnFocusSuggestions{"OmniboxOnFocusSuggestions",
252 base::FEATURE_ENABLED_BY_DEFAULT};
253
Tomasz Wiszkowski947f6d0d2019-03-15 22:27:25254// Allow suggestions to be shown to the user on the New Tab Page upon focusing
255// URL bar (the omnibox).
256const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP",
257 base::FEATURE_DISABLED_BY_DEFAULT};
258
Moe Ahmadi4005ec92019-09-09 16:55:53259// Allow suggestions to be shown to the user on the New Tab Page upon focusing
260// the real search box.
261const base::Feature kZeroSuggestionsOnNTPRealbox{
262 "OmniboxZeroSuggestionsOnNTPRealbox", base::FEATURE_DISABLED_BY_DEFAULT};
263
Tommy Li1d03b9bf2019-09-23 23:46:34264// Allow on-focus query refinements to be shown on the default SERP.
265const base::Feature kZeroSuggestionsOnSERP{"OmniboxZeroSuggestionsOnSERP",
266 base::FEATURE_ENABLED_BY_DEFAULT};
267
Justin Donnellyf2703482019-10-24 21:42:15268// If enabled, changes the way Google-provided search suggestions are scored by
269// the backend. Note that this Feature is only used for triggering a server-
270// side experiment config that will send experiment IDs to the backend. It is
271// not referred to in any of the Chromium code.
272const base::Feature kOmniboxExperimentalSuggestScoring{
273 "OmniboxExperimentalSuggestScoring", base::FEATURE_DISABLED_BY_DEFAULT};
274
manukh3bb80c92020-01-22 00:19:46275// If disabled, terms with no wordstart matches disqualify the suggestion unless
276// they occur in the URL host. If enabled, terms with no wordstart matches are
277// allowed but not scored. E.g., both inputs 'java script' and 'java cript' will
278// match a suggestion titled 'javascript' and score equivalently.
manukh5ff0f582020-01-14 03:54:13279const base::Feature kHistoryQuickProviderAllowButDoNotScoreMidwordTerms{
280 "OmniboxHistoryQuickProviderAllowButDoNotScoreMidwordTerms",
281 base::FEATURE_DISABLED_BY_DEFAULT};
282
manukh3bb80c92020-01-22 00:19:46283// If disabled, midword matches are ignored except in the URL host, and input
284// terms with no wordstart matches are scored 0, resulting in an overall score
285// of 0. If enabled, midword matches are allowed and scored when they begin
286// immediately after the previous match ends. E.g. 'java script' will match a
287// suggestion titled 'javascript' but the input 'java cript' won't.
manukh5ff0f582020-01-14 03:54:13288const base::Feature kHistoryQuickProviderAllowMidwordContinuations{
289 "OmniboxHistoryQuickProviderAllowMidwordContinuations",
290 base::FEATURE_DISABLED_BY_DEFAULT};
291
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19292// If enabled, shows slightly more compact suggestions, allowing the
293// kAdaptiveSuggestionsCount feature to fit more suggestions on screen.
294const base::Feature kCompactSuggestions{"OmniboxCompactSuggestions",
295 base::FEATURE_DISABLED_BY_DEFAULT};
296
Tommy Li7c2bf492019-10-22 19:34:23297// If enabled, shows a confirm dialog before removing search suggestions from
298// the omnibox. See ConfirmNtpSuggestionRemovals for the NTP equivalent.
299const base::Feature kConfirmOmniboxSuggestionRemovals{
300 "ConfirmOmniboxSuggestionRemovals", base::FEATURE_DISABLED_BY_DEFAULT};
301
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19302// If enabled, defers keyboard popup when user highlights the omnibox until
303// the user taps the Omnibox again.
304extern const base::Feature kDeferredKeyboardPopup{
305 "OmniboxDeferredKeyboardPopup", base::FEATURE_DISABLED_BY_DEFAULT};
306
manuk695f9d4532020-03-18 19:22:08307// If enabled, expands autocompletion to possibly (depending on params) include
308// suggestion titles and non-prefixes as opposed to be restricted to URL
309// prefixes. Will also adjust the location bar UI and omnibox text selection to
310// accommodate the autocompletions.
311const base::Feature kRichAutocompletion{"OmniboxRichAutocompletion",
312 base::FEATURE_DISABLED_BY_DEFAULT};
313
Kevin Bailey104e44492019-10-31 16:42:32314// Feature that enables not counting submatches towards the maximum
315// suggestion limit.
316const base::Feature kOmniboxLooseMaxLimitOnDedicatedRows{
317 "OmniboxLooseMaxLimitOnDedicatedRows", base::FEATURE_DISABLED_BY_DEFAULT};
318
Orin Jaworskifc174722020-01-29 00:32:22319// Feature that puts a single row of buttons on suggestions with actionable
320// elements like keywords, tab-switch buttons, and Pedals.
321const base::Feature kOmniboxSuggestionButtonRow{
322 "OmniboxSuggestionButtonRow", base::FEATURE_DISABLED_BY_DEFAULT};
323
Tommy Li1f1fc4a2020-01-31 21:02:07324// If enabled, uses WebUI to render the omnibox suggestions popup, similar to
325// how the NTP "fakebox" is implemented.
326const base::Feature kWebUIOmniboxPopup{"WebUIOmniboxPopup",
327 base::FEATURE_DISABLED_BY_DEFAULT};
328
Brandon Wylie1299ff82020-01-23 02:13:37329// When enabled, use Assistant for omnibox voice query recognition instead of
330// Android's built-in voice recognition service. Only works on Android.
331const base::Feature kOmniboxAssistantVoiceSearch{
332 "OmniboxAssistantVoiceSearch", base::FEATURE_DISABLED_BY_DEFAULT};
333
Livvie Lin30a9f9d2020-03-17 19:45:19334// When enabled, provides an omnibox context menu option that prevents URL
335// elisions.
336const base::Feature kOmniboxContextMenuShowFullUrls{
337 "OmniboxContextMenuShowFullUrls", base::FEATURE_DISABLED_BY_DEFAULT};
338
Tomasz Wiszkowskid938a1112019-03-06 18:01:57339} // namespace omnibox