Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 1 | // 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 | |
manuk | c32a8eff | 2019-07-02 15:48:30 | [diff] [blame] | 7 | #include "build/build_config.h" |
| 8 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 9 | namespace omnibox { |
| 10 | |
| 11 | // Feature used to hide the scheme from steady state URLs displayed in the |
| 12 | // toolbar. It is restored during editing. |
| 13 | const base::Feature kHideFileUrlScheme { |
| 14 | "OmniboxUIExperimentHideFileUrlScheme", |
| 15 | // Android and iOS don't have the File security chip, and therefore still |
| 16 | // need to show the file scheme. |
| 17 | #if defined(OS_ANDROID) || defined(OS_IOS) |
| 18 | base::FEATURE_DISABLED_BY_DEFAULT |
| 19 | #else |
| 20 | base::FEATURE_ENABLED_BY_DEFAULT |
| 21 | #endif |
| 22 | }; |
| 23 | |
| 24 | // Feature used to hide the scheme from steady state URLs displayed in the |
| 25 | // toolbar. It is restored during editing. |
Tommy C. Li | 7514ba8 | 2019-06-25 19:43:53 | [diff] [blame] | 26 | const base::Feature kHideSteadyStateUrlScheme{ |
| 27 | "OmniboxUIExperimentHideSteadyStateUrlScheme", |
| 28 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 29 | |
| 30 | // Feature used to hide trivial subdomains from steady state URLs displayed in |
| 31 | // the toolbar. It is restored during editing. |
Tommy C. Li | 7514ba8 | 2019-06-25 19:43:53 | [diff] [blame] | 32 | const base::Feature kHideSteadyStateUrlTrivialSubdomains{ |
| 33 | "OmniboxUIExperimentHideSteadyStateUrlTrivialSubdomains", |
| 34 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 35 | |
| 36 | // Feature used to hide the path, query and ref from steady state URLs |
| 37 | // displayed in the toolbar. It is restored during editing. |
| 38 | const base::Feature kHideSteadyStateUrlPathQueryAndRef { |
| 39 | "OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRef", |
| 40 | #if defined(OS_IOS) |
| 41 | base::FEATURE_ENABLED_BY_DEFAULT |
| 42 | #else |
| 43 | base::FEATURE_DISABLED_BY_DEFAULT |
| 44 | #endif |
| 45 | }; |
| 46 | |
| 47 | // Feature used to undo all omnibox elisions on a single click or focus action. |
| 48 | const base::Feature kOneClickUnelide{"OmniboxOneClickUnelide", |
| 49 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 50 | |
Christopher Thompson | c26ef30 | 2019-06-07 01:55:45 | [diff] [blame] | 51 | // This feature simplifies the security indiciator UI for https:// pages. |
| 52 | // The default behavior is to show no verbose text for EV pages. When disabled, |
| 53 | // the verbose EV indicator text will be displayed. |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 54 | // This feature is used for EV UI removal experiment (https://crbug.com/803501). |
| 55 | const base::Feature kSimplifyHttpsIndicator{"SimplifyHttpsIndicator", |
Christopher Thompson | c26ef30 | 2019-06-07 01:55:45 | [diff] [blame] | 56 | base::FEATURE_ENABLED_BY_DEFAULT}; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 57 | |
Kevin Bailey | 0f7d159 | 2019-05-23 19:07:35 | [diff] [blame] | 58 | // This feature is used to have final suggestions within the Omnibox grouped |
Kevin Bailey | 3830559 | 2019-05-24 16:55:36 | [diff] [blame] | 59 | // by major type. i.e. search types are first, followed by all others, |
| 60 | // except for the default match which is unchanged in position. |
| 61 | const base::Feature kOmniboxGroupSuggestionsBySearchVsUrl{ |
| 62 | "OmniboxGroupSuggestionsBySearchVsUrl", base::FEATURE_DISABLED_BY_DEFAULT}; |
Kevin Bailey | 0f7d159 | 2019-05-23 19:07:35 | [diff] [blame] | 63 | |
manuk | addd3c4 | 2019-04-09 21:20:59 | [diff] [blame] | 64 | // Feature used to enable local entity suggestions. Similar to rich entities but |
| 65 | // but location specific. E.g., typing 'starbucks near' could display the local |
| 66 | // entity suggestion 'starbucks near disneyland \n starbucks * Anaheim, CA'. |
| 67 | const base::Feature kOmniboxLocalEntitySuggestions{ |
| 68 | "OmniboxLocalEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 69 | |
Kevin Bailey | b3e0873 | 2019-05-29 03:55:25 | [diff] [blame] | 70 | // Feature used to cap the number of URL-type matches shown within the |
| 71 | // Omnibox. If enabled, the number of URL-type matches is limited (unless |
| 72 | // there are no more non-URL matches available.) If enabled, there is a |
| 73 | // companion parameter - OmniboxMaxURLMatches - which specifies the maximum |
| 74 | // desired number of URL-type matches. |
Kevin Bailey | cd688992 | 2019-05-30 17:22:55 | [diff] [blame] | 75 | const base::Feature kOmniboxMaxURLMatches{"OmniboxMaxURLMatches", |
Kevin Bailey | b3e0873 | 2019-05-29 03:55:25 | [diff] [blame] | 76 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 77 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 78 | // Feature used to enable entity suggestion images and enhanced presentation |
| 79 | // showing more context and descriptive text about the entity. |
| 80 | const base::Feature kOmniboxRichEntitySuggestions{ |
Justin Donnelly | 481a69c | 2019-05-03 20:41:42 | [diff] [blame] | 81 | "OmniboxRichEntitySuggestions", |
| 82 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 83 | base::FEATURE_DISABLED_BY_DEFAULT |
| 84 | #else |
| 85 | base::FEATURE_ENABLED_BY_DEFAULT |
| 86 | #endif |
| 87 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 88 | |
| 89 | // Feature used to enable enhanced presentation showing larger images. |
| 90 | // This is currently only used on Android. |
| 91 | const base::Feature kOmniboxNewAnswerLayout{"OmniboxNewAnswerLayout", |
| 92 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 93 | |
Kevin Bailey | abf05d6 | 2019-05-15 17:29:56 | [diff] [blame] | 94 | const base::Feature kOmniboxPreserveDefaultMatchScore{ |
| 95 | "OmniboxPreserveDefaultMatchScore", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 96 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 97 | // Feature used to enable swapping the rows on answers. |
| 98 | const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers", |
| 99 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 100 | |
Kevin Bailey | 7d918b9 | 2019-05-02 16:00:14 | [diff] [blame] | 101 | // Feature used to enable matching short words to bookmarks for suggestions. |
| 102 | const base::Feature kOmniboxShortBookmarkSuggestions{ |
| 103 | "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 104 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 105 | // Feature used to force on the experiment of transmission of tail suggestions |
| 106 | // from GWS to this client, currently testing for desktop. |
| 107 | const base::Feature kOmniboxTailSuggestions{ |
| 108 | "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 109 | |
Stepan Khapugin | b0980166 | 2019-05-07 10:17:04 | [diff] [blame] | 110 | // Feature that enables the tab-switch button on suggestions corresponding to an |
| 111 | // open tab. Enabled by default on Desktop and iOS. |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 112 | const base::Feature kOmniboxTabSwitchSuggestions{ |
| 113 | "OmniboxTabSwitchSuggestions", |
Stepan Khapugin | b0980166 | 2019-05-07 10:17:04 | [diff] [blame] | 114 | #if defined(OS_ANDROID) |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 115 | base::FEATURE_DISABLED_BY_DEFAULT |
| 116 | #else |
| 117 | base::FEATURE_ENABLED_BY_DEFAULT |
| 118 | #endif |
| 119 | }; |
| 120 | |
Kevin Bailey | c9cd6cd | 2019-06-27 02:47:53 | [diff] [blame] | 121 | // Feature that enables wrapping the Omnibox position between top and |
| 122 | // bottom. |
| 123 | const base::Feature kOmniboxWrapPopupPosition{ |
| 124 | "OmniboxWrapPopupPosition", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 125 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 126 | // Feature used to reverse the sense of the tab switch button. Selecting the |
| 127 | // suggestion will switch to the tab, while the button will navigate |
| 128 | // locally. |
| 129 | const base::Feature kOmniboxReverseTabSwitchLogic{ |
| 130 | "OmniboxReverseTabSwitchLogic", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 131 | |
| 132 | // Feature used to enable various experiments on keyword mode, UI and |
| 133 | // suggestions. |
| 134 | const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode", |
| 135 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 136 | |
| 137 | // Feature used to enable Pedal suggestions. |
| 138 | const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions", |
| 139 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 140 | |
Tommy C. Li | a2c75fb | 2019-04-08 20:22:34 | [diff] [blame] | 141 | // Feature used for UI that improves transparency of and control over omnibox |
| 142 | // suggestions. This includes UI cues (like a clock icon for Search History |
| 143 | // suggestions), as well as user controls to delete personalized suggestions. |
| 144 | // This will be eventually enabled by default. |
| 145 | const base::Feature kOmniboxSuggestionTransparencyOptions{ |
| 146 | "OmniboxSuggestionTransparencyOptions", base::FEATURE_DISABLED_BY_DEFAULT}; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 147 | |
Tommy C. Li | e57096e9 | 2019-04-23 21:18:55 | [diff] [blame] | 148 | // Feature that shows UI cues to differentiate Search History matches from |
| 149 | // other search suggestions provided by the default search provider. This |
| 150 | // feature is a narrow subset of kOmniboxSuggestionTransparencyOptions. |
| 151 | const base::Feature kOmniboxUICuesForSearchHistoryMatches{ |
| 152 | "OmniboxUICuesForSearchHistoryMatches", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 153 | |
Tommy C. Li | 7af8664b | 2019-04-24 18:10:29 | [diff] [blame] | 154 | // Feature that shows an alternate separator before the description of |
| 155 | // omnibox matches. In English, this changes the separator from '-' to '|'. |
| 156 | const base::Feature kOmniboxAlternateMatchDescriptionSeparator{ |
| 157 | "OmniboxAlternateMatchDescriptionSeparator", |
| 158 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 159 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 160 | // Feature to enable clipboard provider to suggest copied text. |
| 161 | const base::Feature kEnableClipboardProviderTextSuggestions{ |
| 162 | "OmniboxEnableClipboardProviderTextSuggestions", |
| 163 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 164 | |
| 165 | // Feature to enable clipboard provider to suggest searching for copied images. |
| 166 | const base::Feature kEnableClipboardProviderImageSuggestions{ |
| 167 | "OmniboxEnableClipboardProviderImageSuggestions", |
| 168 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 169 | |
| 170 | // Feature to enable the search provider to send a request to the suggest |
| 171 | // server on focus. This allows the suggest server to warm up, by, for |
| 172 | // example, loading per-user models into memory. Having a per-user model |
| 173 | // in memory allows the suggest server to respond more quickly with |
| 174 | // personalized suggestions as the user types. |
| 175 | const base::Feature kSearchProviderWarmUpOnFocus{ |
| 176 | "OmniboxWarmUpSearchProviderOnFocus", |
| 177 | #if defined(OS_IOS) |
| 178 | base::FEATURE_DISABLED_BY_DEFAULT |
| 179 | #else |
| 180 | base::FEATURE_ENABLED_BY_DEFAULT |
| 181 | #endif |
| 182 | }; |
| 183 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 184 | // Feature used to display the title of the current URL match. |
| 185 | const base::Feature kDisplayTitleForCurrentUrl{ |
| 186 | "OmniboxDisplayTitleForCurrentUrl", |
| 187 | #if !defined(OS_IOS) |
| 188 | base::FEATURE_ENABLED_BY_DEFAULT |
| 189 | #else |
| 190 | base::FEATURE_DISABLED_BY_DEFAULT |
| 191 | #endif |
| 192 | }; |
| 193 | |
| 194 | // Feature used for the max autocomplete matches UI experiment. |
| 195 | const base::Feature kUIExperimentMaxAutocompleteMatches{ |
| 196 | "OmniboxUIExperimentMaxAutocompleteMatches", |
| 197 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 198 | |
| 199 | // Feature used to display the search terms instead of the URL in the Omnibox |
| 200 | // when the user is on the search results page of the default search provider. |
| 201 | const base::Feature kQueryInOmnibox{"QueryInOmnibox", |
| 202 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 203 | |
Tommy C. Li | 0001b82 | 2019-05-10 00:10:03 | [diff] [blame] | 204 | // Feature used for showing the URL suggestion favicons as a UI experiment. |
| 205 | // Already launched on Desktop, and currently under development on Android. |
| 206 | // This flag is not used on iOS. |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 207 | const base::Feature kUIExperimentShowSuggestionFavicons{ |
Tomasz Wiszkowski | 4af1f735 | 2019-04-08 16:46:15 | [diff] [blame] | 208 | "OmniboxUIExperimentShowSuggestionFavicons", |
| 209 | #if defined(OS_ANDROID) |
| 210 | base::FEATURE_DISABLED_BY_DEFAULT |
| 211 | #else |
| 212 | base::FEATURE_ENABLED_BY_DEFAULT |
| 213 | #endif |
| 214 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 215 | |
| 216 | // Feature used to always swap the title and URL. |
| 217 | const base::Feature kUIExperimentSwapTitleAndUrl{ |
| 218 | "OmniboxUIExperimentSwapTitleAndUrl", |
| 219 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 220 | base::FEATURE_DISABLED_BY_DEFAULT |
| 221 | #else |
| 222 | base::FEATURE_ENABLED_BY_DEFAULT |
| 223 | #endif |
| 224 | }; |
| 225 | |
| 226 | // Feature used for the vertical margin UI experiment, currently only used on |
| 227 | // desktop platforms. |
| 228 | const base::Feature kUIExperimentVerticalMargin{ |
| 229 | "OmniboxUIExperimentVerticalMargin", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 230 | |
Tommy C. Li | e35fb6b | 2019-04-30 16:29:54 | [diff] [blame] | 231 | // Feature used to limit the vertical margin UI experiment to non-touch |
| 232 | // devices only. Has no effect if kUIExperimentVerticalMargin is not enabled. |
| 233 | const base::Feature kUIExperimentVerticalMarginLimitToNonTouchOnly{ |
| 234 | "OmniboxUIExperimentVerticalMarginLimitToNonTouchOnly", |
| 235 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 236 | |
Dan Beam | c6f0d22 | 2019-04-26 00:38:31 | [diff] [blame] | 237 | // Shows the "Search Google or type a URL" omnibox placeholder even when the |
| 238 | // caret (text edit cursor) is showing / when focused. views::Textfield works |
| 239 | // this way, as does <input placeholder="">. Omnibox and the NTP's "fakebox" |
| 240 | // are exceptions in this regard and this experiment makes this more consistent. |
| 241 | const base::Feature kUIExperimentShowPlaceholderWhenCaretShowing{ |
| 242 | "OmniboxUIExperimentShowPlaceholderWhenCaretShowing", |
| 243 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 244 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 245 | // Feature used to enable speculatively starting a service worker associated |
| 246 | // with the destination of the default match when the user's input looks like a |
| 247 | // query. |
| 248 | const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{ |
| 249 | "OmniboxSpeculativeServiceWorkerStartOnQueryInput", |
| 250 | base::FEATURE_ENABLED_BY_DEFAULT |
| 251 | }; |
| 252 | |
| 253 | // Feature used to fetch document suggestions. |
| 254 | const base::Feature kDocumentProvider{"OmniboxDocumentProvider", |
| 255 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 256 | |
| 257 | // Feature used to dedupe Google Drive URLs between different formats. |
| 258 | // OmniboxDocumentProvider arms may wish to enable this, though it may also be |
| 259 | // run on its own. |
manuk | c32a8eff | 2019-07-02 15:48:30 | [diff] [blame] | 260 | const base::Feature kDedupeGoogleDriveURLs { |
| 261 | "OmniboxDedupeGoogleDriveURLs", |
| 262 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 263 | base::FEATURE_DISABLED_BY_DEFAULT |
| 264 | #else |
| 265 | base::FEATURE_ENABLED_BY_DEFAULT |
| 266 | #endif |
| 267 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 268 | |
| 269 | // Feature to replace the standard ZeroSuggest with icons for most visited sites |
| 270 | // and collections (bookmarks, history, recent tabs, reading list). Only |
| 271 | // available on iOS. |
| 272 | const base::Feature kOmniboxPopupShortcutIconsInZeroState{ |
| 273 | "OmniboxPopupShortcutIconsInZeroState", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 274 | |
| 275 | // Feature to use material design weather icons in the omnibox when displaying |
| 276 | // weather answers. |
| 277 | const base::Feature kOmniboxMaterialDesignWeatherIcons{ |
| 278 | "OmniboxMaterialDesignWeatherIcons", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 279 | |
Patrick Noland | 2b4968b | 2019-06-27 14:50:26 | [diff] [blame] | 280 | // Returns whether IsInstantExtendedAPIEnabled should be ignored when deciding |
| 281 | // the number of Google-provided search suggestions. |
| 282 | const base::Feature kOmniboxDisableInstantExtendedLimit{ |
| 283 | "OmniboxDisableInstantExtendedLimit", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 284 | |
Brandon Wylie | f8dd4e8 | 2019-07-11 16:39:57 | [diff] [blame^] | 285 | // Show the search engine logo in the omnibox on Android (desktop already does |
| 286 | // this). |
| 287 | const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo", |
| 288 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 289 | |
Tommy C. Li | 09010551 | 2019-05-16 22:00:56 | [diff] [blame] | 290 | // Feature to configure on-focus suggestions provided by ZeroSuggestProvider. |
Tommy C. Li | 414f2202 | 2019-06-07 23:46:22 | [diff] [blame] | 291 | // This feature's main job is to contain some field trial parameters such as: |
| 292 | // - "ZeroSuggestVariant" configures the per-page-classification mode of |
| 293 | // ZeroSuggestProvider. |
| 294 | // - "CustomEndpointURL" configures a custom endpoint for remote suggestions. |
| 295 | // - "CustomEndpointExperimentID" sends an id number to the custom endpoint. |
Tommy C. Li | 09010551 | 2019-05-16 22:00:56 | [diff] [blame] | 296 | const base::Feature kOnFocusSuggestions{"OmniboxOnFocusSuggestions", |
| 297 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 298 | |
Tomasz Wiszkowski | 947f6d0d | 2019-03-15 22:27:25 | [diff] [blame] | 299 | // Allow suggestions to be shown to the user on the New Tab Page upon focusing |
| 300 | // URL bar (the omnibox). |
| 301 | const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP", |
| 302 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 303 | |
Ce Chen | 20af01c | 2019-07-02 19:16:36 | [diff] [blame] | 304 | // Feature to provide non personalized head search suggestion from a compact |
| 305 | // on device model. |
| 306 | const base::Feature kOnDeviceHeadProvider{"OmniboxOnDeviceHeadProvider", |
| 307 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 308 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 309 | } // namespace omnibox |