blob: ca687dfe806e7544f811bf77af7f2fb61abd35e7 [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
53// Feature used to undo all omnibox elisions on a single click or focus action.
54const base::Feature kOneClickUnelide{"OmniboxOneClickUnelide",
55 base::FEATURE_DISABLED_BY_DEFAULT};
56
manukaddd3c42019-04-09 21:20:5957// Feature used to enable local entity suggestions. Similar to rich entities but
58// but location specific. E.g., typing 'starbucks near' could display the local
59// entity suggestion 'starbucks near disneyland \n starbucks * Anaheim, CA'.
60const base::Feature kOmniboxLocalEntitySuggestions{
61 "OmniboxLocalEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
62
Kevin Baileyb3e08732019-05-29 03:55:2563// Feature used to cap the number of URL-type matches shown within the
64// Omnibox. If enabled, the number of URL-type matches is limited (unless
65// there are no more non-URL matches available.) If enabled, there is a
66// companion parameter - OmniboxMaxURLMatches - which specifies the maximum
67// desired number of URL-type matches.
Kevin Bailey26238862019-10-31 22:08:1268const base::Feature kOmniboxMaxURLMatches {
69 "OmniboxMaxURLMatches",
70#if defined(OS_IOS) || defined(OS_ANDROID)
71 base::FEATURE_DISABLED_BY_DEFAULT
72#else
73 base::FEATURE_ENABLED_BY_DEFAULT
74#endif
75};
Kevin Baileyb3e08732019-05-29 03:55:2576
Tomasz Wiszkowskid938a1112019-03-06 18:01:5777// Feature used to enable entity suggestion images and enhanced presentation
78// showing more context and descriptive text about the entity.
79const base::Feature kOmniboxRichEntitySuggestions{
Justin Donnelly481a69c2019-05-03 20:41:4280 "OmniboxRichEntitySuggestions",
81#if defined(OS_IOS) || defined(OS_ANDROID)
82 base::FEATURE_DISABLED_BY_DEFAULT
83#else
84 base::FEATURE_ENABLED_BY_DEFAULT
85#endif
86};
Tomasz Wiszkowskid938a1112019-03-06 18:01:5787
Tomasz Wiszkowskid938a1112019-03-06 18:01:5788// Feature used to enable swapping the rows on answers.
89const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers",
90 base::FEATURE_DISABLED_BY_DEFAULT};
91
Kevin Bailey7d918b92019-05-02 16:00:1492// Feature used to enable matching short words to bookmarks for suggestions.
93const base::Feature kOmniboxShortBookmarkSuggestions{
94 "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
95
Tomasz Wiszkowskid938a1112019-03-06 18:01:5796// Feature used to force on the experiment of transmission of tail suggestions
97// from GWS to this client, currently testing for desktop.
98const base::Feature kOmniboxTailSuggestions{
99 "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
100
Kevin Bailey37bbf1d2019-08-21 19:23:55101// Feature that enables the tab-switch suggestions corresponding to an open
102// tab, for a button or dedicated suggestion. Enabled by default on Desktop
103// and iOS.
Tomasz Wiszkowskid938a1112019-03-06 18:01:57104const base::Feature kOmniboxTabSwitchSuggestions{
105 "OmniboxTabSwitchSuggestions",
Stepan Khapuginb09801662019-05-07 10:17:04106#if defined(OS_ANDROID)
Tomasz Wiszkowskid938a1112019-03-06 18:01:57107 base::FEATURE_DISABLED_BY_DEFAULT
108#else
109 base::FEATURE_ENABLED_BY_DEFAULT
110#endif
111};
112
Kevin Bailey37bbf1d2019-08-21 19:23:55113// Feature that enables tab-switch suggestions in their own row.
114const base::Feature kOmniboxTabSwitchSuggestionsDedicatedRow{
115 "OmniboxTabSwitchSuggestionsDedicatedRow",
116 base::FEATURE_DISABLED_BY_DEFAULT};
117
Tomasz Wiszkowskid938a1112019-03-06 18:01:57118// Feature used to enable various experiments on keyword mode, UI and
119// suggestions.
120const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode",
121 base::FEATURE_DISABLED_BY_DEFAULT};
122
123// Feature used to enable Pedal suggestions.
124const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions",
125 base::FEATURE_DISABLED_BY_DEFAULT};
126
Tommy C. Lia2c75fb2019-04-08 20:22:34127// Feature used for UI that improves transparency of and control over omnibox
Tommy Li9d12b4be2019-09-12 19:21:41128// suggestions. This includes "Why this Suggestion?" and user controls to delete
129// personalized suggestions. This will be eventually enabled by default.
Tommy C. Lia2c75fb2019-04-08 20:22:34130const base::Feature kOmniboxSuggestionTransparencyOptions{
131 "OmniboxSuggestionTransparencyOptions", base::FEATURE_DISABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57132
Tomasz Wiszkowskid938a1112019-03-06 18:01:57133// Feature to enable clipboard provider to suggest copied text.
Gang Wu5418f562020-03-03 16:39:23134// TODO(gangwu): Remove this feature flag after full launched in Android.
Tomasz Wiszkowskid938a1112019-03-06 18:01:57135const base::Feature kEnableClipboardProviderTextSuggestions{
Robbie Gibson85cef3182019-07-21 15:10:29136 "OmniboxEnableClipboardProviderTextSuggestions",
Gang Wu5418f562020-03-03 16:39:23137#if defined(OS_IOS) || defined(OS_ANDROID)
Robbie Gibson85cef3182019-07-21 15:10:29138 base::FEATURE_ENABLED_BY_DEFAULT
139#else
140 base::FEATURE_DISABLED_BY_DEFAULT
141#endif
142};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57143
144// Feature to enable clipboard provider to suggest searching for copied images.
145const base::Feature kEnableClipboardProviderImageSuggestions{
Robbie Gibson85cef3182019-07-21 15:10:29146 "OmniboxEnableClipboardProviderImageSuggestions",
147#if defined(OS_IOS)
148 base::FEATURE_ENABLED_BY_DEFAULT
149#else
150 base::FEATURE_DISABLED_BY_DEFAULT
151#endif
152};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57153
154// Feature to enable the search provider to send a request to the suggest
155// server on focus. This allows the suggest server to warm up, by, for
156// example, loading per-user models into memory. Having a per-user model
157// in memory allows the suggest server to respond more quickly with
158// personalized suggestions as the user types.
159const base::Feature kSearchProviderWarmUpOnFocus{
160 "OmniboxWarmUpSearchProviderOnFocus",
161#if defined(OS_IOS)
162 base::FEATURE_DISABLED_BY_DEFAULT
163#else
164 base::FEATURE_ENABLED_BY_DEFAULT
165#endif
166};
167
Tomasz Wiszkowskid938a1112019-03-06 18:01:57168// Feature used to display the title of the current URL match.
169const base::Feature kDisplayTitleForCurrentUrl{
170 "OmniboxDisplayTitleForCurrentUrl",
171#if !defined(OS_IOS)
172 base::FEATURE_ENABLED_BY_DEFAULT
173#else
174 base::FEATURE_DISABLED_BY_DEFAULT
175#endif
176};
177
178// Feature used for the max autocomplete matches UI experiment.
179const base::Feature kUIExperimentMaxAutocompleteMatches{
180 "OmniboxUIExperimentMaxAutocompleteMatches",
181 base::FEATURE_DISABLED_BY_DEFAULT};
182
183// Feature used to display the search terms instead of the URL in the Omnibox
184// when the user is on the search results page of the default search provider.
185const base::Feature kQueryInOmnibox{"QueryInOmnibox",
186 base::FEATURE_DISABLED_BY_DEFAULT};
187
Tomasz Wiszkowskid938a1112019-03-06 18:01:57188// Feature used to always swap the title and URL.
189const base::Feature kUIExperimentSwapTitleAndUrl{
190 "OmniboxUIExperimentSwapTitleAndUrl",
191#if defined(OS_IOS) || defined(OS_ANDROID)
192 base::FEATURE_DISABLED_BY_DEFAULT
193#else
194 base::FEATURE_ENABLED_BY_DEFAULT
195#endif
196};
197
Tomasz Wiszkowskid938a1112019-03-06 18:01:57198// Feature used to enable speculatively starting a service worker associated
199// with the destination of the default match when the user's input looks like a
200// query.
201const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{
202 "OmniboxSpeculativeServiceWorkerStartOnQueryInput",
203 base::FEATURE_ENABLED_BY_DEFAULT
204};
205
206// Feature used to fetch document suggestions.
207const base::Feature kDocumentProvider{"OmniboxDocumentProvider",
208 base::FEATURE_DISABLED_BY_DEFAULT};
209
manuk4542e232019-09-11 19:27:35210// Feature used to autocomplete bookmark, history, and document suggestions when
211// the user input is a prefix of their titles, as opposed to their URLs.
212const base::Feature kAutocompleteTitles{"OmniboxAutocompleteTitles",
213 base::FEATURE_DISABLED_BY_DEFAULT};
214
Tomasz Wiszkowskid938a1112019-03-06 18:01:57215// Feature to use material design weather icons in the omnibox when displaying
216// weather answers.
217const base::Feature kOmniboxMaterialDesignWeatherIcons{
manuk9a2ed552019-09-09 23:45:44218 "OmniboxMaterialDesignWeatherIcons", base::FEATURE_ENABLED_BY_DEFAULT};
Tomasz Wiszkowskid938a1112019-03-06 18:01:57219
Patrick Noland2b4968b2019-06-27 14:50:26220// Returns whether IsInstantExtendedAPIEnabled should be ignored when deciding
221// the number of Google-provided search suggestions.
222const base::Feature kOmniboxDisableInstantExtendedLimit{
223 "OmniboxDisableInstantExtendedLimit", base::FEATURE_DISABLED_BY_DEFAULT};
224
Brandon Wylief8dd4e82019-07-11 16:39:57225// Show the search engine logo in the omnibox on Android (desktop already does
226// this).
227const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo",
228 base::FEATURE_DISABLED_BY_DEFAULT};
229
manukbf3c8ab2019-10-24 16:52:08230// Feature used to allow users to remove suggestions from clipboard.
231const base::Feature kOmniboxRemoveSuggestionsFromClipboard{
232 "OmniboxRemoveSuggestionsFromClipboard", base::FEATURE_DISABLED_BY_DEFAULT};
233
234// Feature to provide non personalized head search suggestion from a compact
235// on device model.
236const base::Feature kOnDeviceHeadProvider{"OmniboxOnDeviceHeadProvider",
237 base::FEATURE_DISABLED_BY_DEFAULT};
238
239// Feature to debounce drive requests from the document provider.
240const base::Feature kDebounceDocumentProvider{
241 "OmniboxDebounceDocumentProvider", base::FEATURE_DISABLED_BY_DEFAULT};
242
Tommy Li6390ecc2019-09-06 21:08:57243// Preserves the default match against change when providers return results
244// asynchronously. This prevents the default match from changing after the user
245// finishes typing. Without this feature, if the default match is updated right
246// when the user presses Enter, the user may go to a surprising destination.
247const base::Feature kOmniboxPreserveDefaultMatchAgainstAsyncUpdate{
248 "OmniboxPreserveDefaultMatchAgainstAsyncUpdate",
Tommy Li2b9db032020-03-02 22:12:14249 base::FEATURE_ENABLED_BY_DEFAULT};
Tommy Li6390ecc2019-09-06 21:08:57250
manuk7b89f6642019-11-08 19:25:24251// Demotes the relevance scores when comparing suggestions based on the
252// suggestion's |AutocompleteMatchType| and the user's |PageClassification|.
253// This feature's main job is to contain the DemoteByType parameter.
254const base::Feature kOmniboxDemoteByType{"OmniboxDemoteByType",
255 base::FEATURE_DISABLED_BY_DEFAULT};
256
Tommy C. Li090105512019-05-16 22:00:56257// Feature to configure on-focus suggestions provided by ZeroSuggestProvider.
Tommy C. Li414f22022019-06-07 23:46:22258// This feature's main job is to contain some field trial parameters such as:
259// - "ZeroSuggestVariant" configures the per-page-classification mode of
260// ZeroSuggestProvider.
Tommy C. Li090105512019-05-16 22:00:56261const base::Feature kOnFocusSuggestions{"OmniboxOnFocusSuggestions",
262 base::FEATURE_ENABLED_BY_DEFAULT};
263
Tomasz Wiszkowski947f6d0d2019-03-15 22:27:25264// Allow suggestions to be shown to the user on the New Tab Page upon focusing
265// URL bar (the omnibox).
266const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP",
267 base::FEATURE_DISABLED_BY_DEFAULT};
268
Moe Ahmadi4005ec92019-09-09 16:55:53269// Allow suggestions to be shown to the user on the New Tab Page upon focusing
270// the real search box.
271const base::Feature kZeroSuggestionsOnNTPRealbox{
272 "OmniboxZeroSuggestionsOnNTPRealbox", base::FEATURE_DISABLED_BY_DEFAULT};
273
Tommy Li1d03b9bf2019-09-23 23:46:34274// Allow on-focus query refinements to be shown on the default SERP.
275const base::Feature kZeroSuggestionsOnSERP{"OmniboxZeroSuggestionsOnSERP",
276 base::FEATURE_ENABLED_BY_DEFAULT};
277
Justin Donnellyf2703482019-10-24 21:42:15278// If enabled, changes the way Google-provided search suggestions are scored by
279// the backend. Note that this Feature is only used for triggering a server-
280// side experiment config that will send experiment IDs to the backend. It is
281// not referred to in any of the Chromium code.
282const base::Feature kOmniboxExperimentalSuggestScoring{
283 "OmniboxExperimentalSuggestScoring", base::FEATURE_DISABLED_BY_DEFAULT};
284
manukh3bb80c92020-01-22 00:19:46285// If disabled, terms with no wordstart matches disqualify the suggestion unless
286// they occur in the URL host. If enabled, terms with no wordstart matches are
287// allowed but not scored. E.g., both inputs 'java script' and 'java cript' will
288// match a suggestion titled 'javascript' and score equivalently.
manukh5ff0f582020-01-14 03:54:13289const base::Feature kHistoryQuickProviderAllowButDoNotScoreMidwordTerms{
290 "OmniboxHistoryQuickProviderAllowButDoNotScoreMidwordTerms",
291 base::FEATURE_DISABLED_BY_DEFAULT};
292
manukh3bb80c92020-01-22 00:19:46293// If disabled, midword matches are ignored except in the URL host, and input
294// terms with no wordstart matches are scored 0, resulting in an overall score
295// of 0. If enabled, midword matches are allowed and scored when they begin
296// immediately after the previous match ends. E.g. 'java script' will match a
297// suggestion titled 'javascript' but the input 'java cript' won't.
manukh5ff0f582020-01-14 03:54:13298const base::Feature kHistoryQuickProviderAllowMidwordContinuations{
299 "OmniboxHistoryQuickProviderAllowMidwordContinuations",
300 base::FEATURE_DISABLED_BY_DEFAULT};
301
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19302// If enabled, shows slightly more compact suggestions, allowing the
303// kAdaptiveSuggestionsCount feature to fit more suggestions on screen.
304const base::Feature kCompactSuggestions{"OmniboxCompactSuggestions",
305 base::FEATURE_DISABLED_BY_DEFAULT};
306
Tommy Li7c2bf492019-10-22 19:34:23307// If enabled, shows a confirm dialog before removing search suggestions from
308// the omnibox. See ConfirmNtpSuggestionRemovals for the NTP equivalent.
309const base::Feature kConfirmOmniboxSuggestionRemovals{
310 "ConfirmOmniboxSuggestionRemovals", base::FEATURE_DISABLED_BY_DEFAULT};
311
Tomasz Wiszkowski70fb35f2020-02-27 00:39:19312// If enabled, defers keyboard popup when user highlights the omnibox until
313// the user taps the Omnibox again.
314extern const base::Feature kDeferredKeyboardPopup{
315 "OmniboxDeferredKeyboardPopup", base::FEATURE_DISABLED_BY_DEFAULT};
316
Kevin Bailey104e44492019-10-31 16:42:32317// Feature that enables not counting submatches towards the maximum
318// suggestion limit.
319const base::Feature kOmniboxLooseMaxLimitOnDedicatedRows{
320 "OmniboxLooseMaxLimitOnDedicatedRows", base::FEATURE_DISABLED_BY_DEFAULT};
321
Orin Jaworskifc174722020-01-29 00:32:22322// Feature that puts a single row of buttons on suggestions with actionable
323// elements like keywords, tab-switch buttons, and Pedals.
324const base::Feature kOmniboxSuggestionButtonRow{
325 "OmniboxSuggestionButtonRow", base::FEATURE_DISABLED_BY_DEFAULT};
326
327// If enabled, allows Tab and Shift+Tab to escape the focus out of the omnibox
328// popup. Otherwise, Tab infinitely loops between suggestions in the popup.
329const base::Feature kTabKeyCanEscapeOmniboxPopup{
330 "TabKeyCanEscapeOmniboxPopup", base::FEATURE_DISABLED_BY_DEFAULT};
331
Tommy Li1f1fc4a2020-01-31 21:02:07332// If enabled, uses WebUI to render the omnibox suggestions popup, similar to
333// how the NTP "fakebox" is implemented.
334const base::Feature kWebUIOmniboxPopup{"WebUIOmniboxPopup",
335 base::FEATURE_DISABLED_BY_DEFAULT};
336
Brandon Wylie1299ff82020-01-23 02:13:37337// When enabled, use Assistant for omnibox voice query recognition instead of
338// Android's built-in voice recognition service. Only works on Android.
339const base::Feature kOmniboxAssistantVoiceSearch{
340 "OmniboxAssistantVoiceSearch", base::FEATURE_DISABLED_BY_DEFAULT};
341
Livvie Lin30a9f9d2020-03-17 19:45:19342// When enabled, provides an omnibox context menu option that prevents URL
343// elisions.
344const base::Feature kOmniboxContextMenuShowFullUrls{
345 "OmniboxContextMenuShowFullUrls", base::FEATURE_DISABLED_BY_DEFAULT};
346
Tomasz Wiszkowskid938a1112019-03-06 18:01:57347} // namespace omnibox