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 7 #include "build/build_config.h" 8 9 namespace omnibox { 10 11 const 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 const auto enabled_by_default_android_only = 19 #if defined(OS_ANDROID) 20 base::FEATURE_ENABLED_BY_DEFAULT; 21 #else 22 base::FEATURE_DISABLED_BY_DEFAULT; 23 #endif 24 25 const auto enabled_by_default_desktop_android = 26 #if defined(OS_IOS) 27 base::FEATURE_DISABLED_BY_DEFAULT; 28 #else 29 base::FEATURE_ENABLED_BY_DEFAULT; 30 #endif 31 32 const auto enabled_by_default_desktop_ios = 33 #if defined(OS_ANDROID) 34 base::FEATURE_DISABLED_BY_DEFAULT; 35 #else 36 base::FEATURE_ENABLED_BY_DEFAULT; 37 #endif 38 39 const auto enabled_by_default_android_ios = 40 #if defined(OS_ANDROID) || defined(OS_IOS) 41 base::FEATURE_ENABLED_BY_DEFAULT; 42 #else 43 base::FEATURE_DISABLED_BY_DEFAULT; 44 #endif 45 46 // Allows Omnibox to dynamically adjust number of offered suggestions to fill in 47 // the space between Omnibox an the soft keyboard. The number of suggestions 48 // shown will be no less than minimum for the platform (eg. 5 for Android). 49 const base::Feature kAdaptiveSuggestionsCount{ 50 "OmniboxAdaptiveSuggestionsCount", base::FEATURE_DISABLED_BY_DEFAULT}; 51 52 // Feature used to hide the scheme from steady state URLs displayed in the 53 // toolbar. It is restored during editing. 54 const base::Feature kHideFileUrlScheme{ 55 "OmniboxUIExperimentHideFileUrlScheme", 56 // Android and iOS don't have the File security chip, and therefore still 57 // need to show the file scheme. 58 enabled_by_default_desktop_only}; 59 60 // Feature used to enable matching short words to bookmarks for suggestions. 61 const base::Feature kOmniboxShortBookmarkSuggestions{ 62 "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; 63 64 // Feature used to force on the experiment of transmission of tail suggestions 65 // from GWS to this client, currently testing for desktop. 66 const base::Feature kOmniboxTailSuggestions{"OmniboxTailSuggestions", 67 base::FEATURE_DISABLED_BY_DEFAULT}; 68 69 // Feature that enables the tab-switch suggestions corresponding to an open 70 // tab, for a button or dedicated suggestion. Enabled by default on Desktop 71 // and iOS. 72 const base::Feature kOmniboxTabSwitchSuggestions{ 73 "OmniboxTabSwitchSuggestions", enabled_by_default_desktop_ios}; 74 75 // Feature used to enable various experiments on keyword mode, UI and 76 // suggestions. 77 const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode", 78 base::FEATURE_DISABLED_BY_DEFAULT}; 79 80 // Feature to enable showing thumbnail in front of the Omnibox clipboard image 81 // search suggestion. 82 const base::Feature kImageSearchSuggestionThumbnail{ 83 "ImageSearchSuggestionThumbnail", enabled_by_default_android_only}; 84 85 // Feature to enable the search provider to send a request to the suggest 86 // server on focus. This allows the suggest server to warm up, by, for 87 // example, loading per-user models into memory. Having a per-user model 88 // in memory allows the suggest server to respond more quickly with 89 // personalized suggestions as the user types. 90 const base::Feature kSearchProviderWarmUpOnFocus{ 91 "OmniboxWarmUpSearchProviderOnFocus", enabled_by_default_desktop_android}; 92 93 // Feature used to display the title of the current URL match. 94 const base::Feature kDisplayTitleForCurrentUrl{ 95 "OmniboxDisplayTitleForCurrentUrl", enabled_by_default_desktop_android}; 96 97 // Feature used to always swap the title and URL. 98 const base::Feature kUIExperimentSwapTitleAndUrl{ 99 "OmniboxUIExperimentSwapTitleAndUrl", enabled_by_default_desktop_only}; 100 101 // Feature used to enable speculatively starting a service worker associated 102 // with the destination of the default match when the user's input looks like a 103 // query. 104 const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{ 105 "OmniboxSpeculativeServiceWorkerStartOnQueryInput", 106 base::FEATURE_ENABLED_BY_DEFAULT}; 107 108 // Feature used to fetch document suggestions. 109 const base::Feature kDocumentProvider{"OmniboxDocumentProvider", 110 base::FEATURE_DISABLED_BY_DEFAULT}; 111 112 // Show the search engine logo in the omnibox on Android (desktop already does 113 // this). 114 const base::Feature kOmniboxSearchEngineLogo{"OmniboxSearchEngineLogo", 115 base::FEATURE_ENABLED_BY_DEFAULT}; 116 117 // Feature used to allow users to remove suggestions from clipboard. 118 const base::Feature kOmniboxRemoveSuggestionsFromClipboard{ 119 "OmniboxRemoveSuggestionsFromClipboard", enabled_by_default_android_only}; 120 121 // Feature to debounce drive requests from the document provider. 122 const base::Feature kDebounceDocumentProvider{ 123 "OmniboxDebounceDocumentProvider", base::FEATURE_DISABLED_BY_DEFAULT}; 124 125 // Demotes the relevance scores when comparing suggestions based on the 126 // suggestion's |AutocompleteMatchType| and the user's |PageClassification|. 127 // This feature's main job is to contain the DemoteByType parameter. 128 const base::Feature kOmniboxDemoteByType{"OmniboxDemoteByType", 129 base::FEATURE_DISABLED_BY_DEFAULT}; 130 131 // A special flag, enabled by default, that can be used to disable all new 132 // search features (e.g. zero suggest). 133 const base::Feature kNewSearchFeatures{"OmniboxNewSearchFeatures", 134 base::FEATURE_ENABLED_BY_DEFAULT}; 135 136 // Feature used to reduce entity latency by sharing a decoder. Param values will 137 // configure other optimizations as well. 138 const base::Feature kEntitySuggestionsReduceLatency{ 139 "OmniboxEntitySuggestionsReduceLatency", base::FEATURE_DISABLED_BY_DEFAULT}; 140 141 // Feature used to cap max zero suggestions shown according to the param 142 // OmniboxMaxZeroSuggestMatches. If omitted, 143 // OmniboxUIExperimentMaxAutocompleteMatches will be used instead. If present, 144 // OmniboxMaxZeroSuggestMatches will override 145 // OmniboxUIExperimentMaxAutocompleteMatches when |from_omnibox_focus| is true. 146 const base::Feature kMaxZeroSuggestMatches{"OmniboxMaxZeroSuggestMatches", 147 base::FEATURE_DISABLED_BY_DEFAULT}; 148 149 // Feature used to cap max suggestions shown according to the params 150 // UIMaxAutocompleteMatches and UIMaxAutocompleteMatchesByProvider. 151 const base::Feature kUIExperimentMaxAutocompleteMatches{ 152 "OmniboxUIExperimentMaxAutocompleteMatches", 153 base::FEATURE_DISABLED_BY_DEFAULT}; 154 155 // Feature used to cap the number of URL-type matches shown within the 156 // Omnibox. If enabled, the number of URL-type matches is limited (unless 157 // there are no more non-URL matches available.) If enabled, there is a 158 // companion parameter - OmniboxMaxURLMatches - which specifies the maximum 159 // desired number of URL-type matches. 160 const bool kOmniboxMaxURLMatchesEnabledByDefault = 161 #if defined(OS_IOS) || defined(OS_ANDROID) 162 false; 163 #else 164 true; 165 #endif 166 const base::Feature kOmniboxMaxURLMatches{ 167 "OmniboxMaxURLMatches", kOmniboxMaxURLMatchesEnabledByDefault 168 ? base::FEATURE_ENABLED_BY_DEFAULT 169 : base::FEATURE_DISABLED_BY_DEFAULT}; 170 171 // Feature used to cap max suggestions to a dynamic limit based on how many URLs 172 // would be shown. E.g., show up to 10 suggestions if doing so would display no 173 // URLs; else show up to 8 suggestions if doing so would include 1 or more URLs. 174 const base::Feature kDynamicMaxAutocomplete{"OmniboxDynamicMaxAutocomplete", 175 base::FEATURE_DISABLED_BY_DEFAULT}; 176 177 // Feature used to enable bubbling URL suggestions above search suggestions 178 // after grouping if 2 conditions are met: 179 // 1) There must be a sufficient score gap between the adjacent searches. 180 // 2) There must be a sufficient buffer between the URL and search scores. 181 const base::Feature kBubbleUrlSuggestions{"OmniboxBubbleUrlSuggestions", 182 base::FEATURE_DISABLED_BY_DEFAULT}; 183 184 // If enabled, when the user clears the whole omnibox text (i.e. via Backspace), 185 // Chrome will request remote ZeroSuggest suggestions for the OTHER page 186 // classification (contextual web). 187 const base::Feature kClobberTriggersContextualWebZeroSuggest{ 188 "OmniboxClobberTriggersContextualWebZeroSuggest", 189 base::FEATURE_DISABLED_BY_DEFAULT}; 190 191 // Used to adjust the age threshold since the last visit in order to consider a 192 // normalized keyword search term as a zero-prefix suggestion. If disabled, the 193 // default value of history::kLowQualityMatchAgeLimitInDays is used. If enabled, 194 // the age threshold is determined by this feature's companion parameter, 195 // OmniboxFieldTrial::kOmniboxLocalZeroSuggestAgeThresholdParam. 196 const base::Feature kOmniboxLocalZeroSuggestAgeThreshold{ 197 "OmniboxLocalZeroSuggestAgeThreshold", base::FEATURE_DISABLED_BY_DEFAULT}; 198 199 // If enabled, enables local zero-prefix suggestions for signed in users. 200 // Local zero-prefix suggestions are enabled for signed in users by default. We 201 // will be experimenting with DISABLING this behavior. 202 const base::Feature kOmniboxLocalZeroSuggestForAuthenticatedUsers{ 203 "OmniboxLocalZeroSuggestForAuthenticatedUsers", 204 base::FEATURE_ENABLED_BY_DEFAULT}; 205 206 // If enabled, ranks the local zero-prefix suggestions based on frecency 207 // (combined frequency and recency). 208 const base::Feature kOmniboxLocalZeroSuggestFrecencyRanking{ 209 "OmniboxLocalZeroSuggestFrecencyRanking", 210 base::FEATURE_DISABLED_BY_DEFAULT}; 211 212 // Used to force enable/disable trending zero-prefix suggestions on the NTP 213 // (Omnibox and NTP realbox). This feature triggers a server-side behavior only 214 // and has no direct impact on the client behavior. 215 const base::Feature kOmniboxTrendingZeroPrefixSuggestionsOnNTP{ 216 "OmniboxTrendingZeroPrefixSuggestionsOnNTP", 217 base::FEATURE_DISABLED_BY_DEFAULT}; 218 219 // Used to enable/disable caching for remote zero-prefix suggestions. Caching is 220 // enabled by default. We will be experimenting with DISABLING this behavior. 221 const base::Feature kOmniboxZeroSuggestCaching{ 222 "OmniboxZeroSuggestCaching", base::FEATURE_ENABLED_BY_DEFAULT}; 223 224 // Enables on-focus suggestions on the Open Web, that are contextual to the 225 // current URL. Will only work if user is signed-in and syncing, or is 226 // otherwise eligible to send the current page URL to the suggest server. 227 // 228 // There's multiple flags here for multiple backend configurations: 229 // - Default (search queries) 230 // - On-Content Suggestions 231 const base::Feature kOnFocusSuggestionsContextualWeb{ 232 "OmniboxOnFocusSuggestionsContextualWeb", 233 base::FEATURE_DISABLED_BY_DEFAULT}; 234 const base::Feature kOnFocusSuggestionsContextualWebOnContent{ 235 "OmniboxOnFocusSuggestionsContextualWebOnContent", 236 base::FEATURE_DISABLED_BY_DEFAULT}; 237 238 // Enables Reactive Zero-Prefix Suggestions (rZPS) on the NTP, for the Omnibox 239 // and Realbox respectively. Note: enabling this feature merely makes 240 // ZeroSuggestProvider send the request. There are additional requirements, 241 // like the user being signed-in, and the suggest server having rZPS enabled. 242 const base::Feature kReactiveZeroSuggestionsOnNTPOmnibox{ 243 "OmniboxReactiveZeroSuggestionsOnNTPOmnibox", 244 base::FEATURE_DISABLED_BY_DEFAULT}; 245 const base::Feature kReactiveZeroSuggestionsOnNTPRealbox{ 246 "OmniboxReactiveZeroSuggestionsOnNTPRealbox", 247 base::FEATURE_DISABLED_BY_DEFAULT}; 248 249 // Allows the LocalHistoryZeroSuggestProvider to use local search history. 250 const base::Feature kLocalHistoryZeroSuggest{ 251 "LocalHistoryZeroSuggest", enabled_by_default_desktop_android}; 252 253 // Features to provide non personalized head search suggestion from a compact 254 // on device model. More specifically, feature name with suffix Incognito / 255 // NonIncognito will only controls behaviors under incognito / non-incognito 256 // mode respectively. 257 const base::Feature kOnDeviceHeadProviderIncognito{ 258 "OmniboxOnDeviceHeadProviderIncognito", base::FEATURE_ENABLED_BY_DEFAULT}; 259 const base::Feature kOnDeviceHeadProviderNonIncognito{ 260 "OmniboxOnDeviceHeadProviderNonIncognito", enabled_by_default_android_ios}; 261 262 // If enabled, changes the way Google-provided search suggestions are scored by 263 // the backend. Note that this Feature is only used for triggering a server- 264 // side experiment config that will send experiment IDs to the backend. It is 265 // not referred to in any of the Chromium code. 266 const base::Feature kOmniboxExperimentalSuggestScoring{ 267 "OmniboxExperimentalSuggestScoring", base::FEATURE_DISABLED_BY_DEFAULT}; 268 269 // If enabled, the HistoryQuickProvider's InMemoryURLIndex service never 270 // persists its index to a cache file on shutdown, and instead always rebuilds 271 // it from the HistoryService on startup. Persisting the index to disk causes 272 // over 10% of all shutdown hangs. 273 const base::Feature kHistoryQuickProviderAblateInMemoryURLIndexCacheFile{ 274 "OmniboxHistoryQuickProviderAblateInMemoryURLIndexCacheFile", 275 base::FEATURE_DISABLED_BY_DEFAULT}; 276 277 // If enabled, inputs may match bookmark paths. These path matches won't 278 // contribute to scoring. E.g. 'planets jupiter' can suggest a bookmark titled 279 // 'Jupiter' with URL 'en.wikipedia.org/wiki/Jupiter' located in a path 280 // containing 'planet.' 281 const base::Feature kBookmarkPaths{"OmniboxBookmarkPaths", 282 base::FEATURE_DISABLED_BY_DEFAULT}; 283 284 // If enabled, shows slightly more compact suggestions, allowing the 285 // kAdaptiveSuggestionsCount feature to fit more suggestions on screen. 286 const base::Feature kCompactSuggestions{"OmniboxCompactSuggestions", 287 base::FEATURE_DISABLED_BY_DEFAULT}; 288 289 // If enbaled, frequently visited sites are presented in form of a single row 290 // with a carousel of tiles, instead of one URL per row. 291 extern const base::Feature kMostVisitedTiles{"OmniboxMostVisitedTiles", 292 base::FEATURE_DISABLED_BY_DEFAULT}; 293 294 // If enabled, expands autocompletion to possibly (depending on params) include 295 // suggestion titles and non-prefixes as opposed to be restricted to URL 296 // prefixes. Will also adjust the location bar UI and omnibox text selection to 297 // accommodate the autocompletions. 298 const base::Feature kRichAutocompletion{"OmniboxRichAutocompletion", 299 base::FEATURE_DISABLED_BY_DEFAULT}; 300 301 // Feature that enables Search Ready Omnibox in incognito. 302 const base::Feature kOmniboxSearchReadyIncognito{ 303 "OmniboxSearchReadyIncognito", base::FEATURE_ENABLED_BY_DEFAULT}; 304 305 // Feature that puts a single row of buttons on suggestions with actionable 306 // elements like keywords, tab-switch buttons, and Pedals. 307 const base::Feature kOmniboxSuggestionButtonRow{ 308 "OmniboxSuggestionButtonRow", base::FEATURE_DISABLED_BY_DEFAULT}; 309 310 // Feature used to enable Pedal suggestions. 311 const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions", 312 base::FEATURE_DISABLED_BY_DEFAULT}; 313 314 // Feature used to enable the keyword search button. 315 const base::Feature kOmniboxKeywordSearchButton{ 316 "OmniboxKeywordSearchButton", base::FEATURE_DISABLED_BY_DEFAULT}; 317 318 // Enables new UI changes indicating focus and hover states. 319 const base::Feature kOmniboxRefinedFocusState{ 320 "OmniboxRefinedFocusState", base::FEATURE_DISABLED_BY_DEFAULT}; 321 322 // If enabled, uses WebUI to render the omnibox suggestions popup, similar to 323 // how the NTP "realbox" is implemented. 324 const base::Feature kWebUIOmniboxPopup{"WebUIOmniboxPopup", 325 base::FEATURE_DISABLED_BY_DEFAULT}; 326 327 // Enables rollout of changing the default behavior for DNS interception checks 328 // and did-you-mean infobar. 329 // Users who are in the enabled group for this feature will have interception 330 // checks and did-you-mean turned off. Enterprise Policy takes precedence over 331 // this setting, and policy is checked before the feature group is checked and 332 // marked. 333 const base::Feature kIntranetRedirectBehaviorPolicyRollout{ 334 "OmniboxDNSInterceptionChecksPolicyRollout", 335 base::FEATURE_DISABLED_BY_DEFAULT}; 336 337 // When enabled, use Assistant for omnibox voice query recognition instead of 338 // Android's built-in voice recognition service. Only works on Android. 339 const base::Feature kOmniboxAssistantVoiceSearch{ 340 "OmniboxAssistantVoiceSearch", base::FEATURE_DISABLED_BY_DEFAULT}; 341 342 // Feature used to reveal the path, query and ref from steady state URLs 343 // on hover. 344 const base::Feature kRevealSteadyStateUrlPathQueryAndRefOnHover{ 345 "OmniboxUIExperimentRevealSteadyStateUrlPathQueryAndRefOnHover", 346 base::FEATURE_DISABLED_BY_DEFAULT}; 347 348 // Feature used to hide the path, query and ref from steady state URLs 349 // on interaction with the page. 350 const base::Feature kHideSteadyStateUrlPathQueryAndRefOnInteraction{ 351 "OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRefOnInteraction", 352 base::FEATURE_DISABLED_BY_DEFAULT}; 353 354 // Feature used to possibly elide not just the path, query, and ref from steady 355 // state URLs, but also subdomains beyond the registrable domain, depending on 356 // whether the hostname fails lookalike checks. Has no effect unless 357 // kRevealSteadyStateUrlPathQueryAndRefOnHover and/or 358 // kHideSteadyStateUrlPathQueryAndRefOnInteraction are enabled. 359 const base::Feature kMaybeElideToRegistrableDomain{ 360 "OmniboxUIExperimentElideToRegistrableDomain", 361 base::FEATURE_DISABLED_BY_DEFAULT}; 362 363 // Feature used to default typed navigations to use HTTPS instead of HTTP. 364 // This only applies to navigations that don't have a scheme such as 365 // "example.com". Presently, typing "example.com" in a clean browsing profile 366 // loads http://example.com. When this feature is enabled, it should load 367 // https://example.com instead, with fallback to http://example.com if 368 // necessary. 369 const base::Feature kDefaultTypedNavigationsToHttps{ 370 "OmniboxDefaultTypedNavigationsToHttps", base::FEATURE_DISABLED_BY_DEFAULT}; 371 372 // NOTE: while this is enabled by default, CCT visits are only tagged with the 373 // necessary transition type if the intent launching CCT supplies the 374 // appropriate parameter. 375 const base::Feature kHideVisitsFromCct{"OmniboxHideVisitsFromCct", 376 base::FEATURE_ENABLED_BY_DEFAULT}; 377 378 } // namespace omnibox 379