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 | |
| 7 | namespace omnibox { |
| 8 | |
| 9 | // Feature used to hide the scheme from steady state URLs displayed in the |
| 10 | // toolbar. It is restored during editing. |
| 11 | const base::Feature kHideFileUrlScheme { |
| 12 | "OmniboxUIExperimentHideFileUrlScheme", |
| 13 | // Android and iOS don't have the File security chip, and therefore still |
| 14 | // need to show the file scheme. |
| 15 | #if defined(OS_ANDROID) || defined(OS_IOS) |
| 16 | base::FEATURE_DISABLED_BY_DEFAULT |
| 17 | #else |
| 18 | base::FEATURE_ENABLED_BY_DEFAULT |
| 19 | #endif |
| 20 | }; |
| 21 | |
| 22 | // Feature used to hide the scheme from steady state URLs displayed in the |
| 23 | // toolbar. It is restored during editing. |
Tommy Li | fc8ae9f | 2019-05-06 16:55:14 | [diff] [blame] | 24 | const base::Feature kHideSteadyStateUrlScheme { |
| 25 | "OmniboxUIExperimentHideSteadyStateUrlScheme", |
| 26 | #if defined(OS_IOS) |
| 27 | base::FEATURE_ENABLED_BY_DEFAULT |
| 28 | #else |
| 29 | base::FEATURE_DISABLED_BY_DEFAULT |
| 30 | #endif |
| 31 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 32 | |
| 33 | // Feature used to hide trivial subdomains from steady state URLs displayed in |
| 34 | // the toolbar. It is restored during editing. |
Tommy Li | fc8ae9f | 2019-05-06 16:55:14 | [diff] [blame] | 35 | const base::Feature kHideSteadyStateUrlTrivialSubdomains { |
| 36 | "OmniboxUIExperimentHideSteadyStateUrlTrivialSubdomains", |
| 37 | #if defined(OS_IOS) |
| 38 | base::FEATURE_ENABLED_BY_DEFAULT |
| 39 | #else |
| 40 | base::FEATURE_DISABLED_BY_DEFAULT |
| 41 | #endif |
| 42 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 43 | |
| 44 | // Feature used to hide the path, query and ref from steady state URLs |
| 45 | // displayed in the toolbar. It is restored during editing. |
| 46 | const base::Feature kHideSteadyStateUrlPathQueryAndRef { |
| 47 | "OmniboxUIExperimentHideSteadyStateUrlPathQueryAndRef", |
| 48 | #if defined(OS_IOS) |
| 49 | base::FEATURE_ENABLED_BY_DEFAULT |
| 50 | #else |
| 51 | base::FEATURE_DISABLED_BY_DEFAULT |
| 52 | #endif |
| 53 | }; |
| 54 | |
| 55 | // Feature used to undo all omnibox elisions on a single click or focus action. |
| 56 | const base::Feature kOneClickUnelide{"OmniboxOneClickUnelide", |
| 57 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 58 | |
| 59 | // This feature simplifies the security indiciator UI for https:// pages. The |
| 60 | // exact UI treatment is dependent on the parameter 'treatment' which can have |
| 61 | // the following value: |
| 62 | // - 'ev-to-secure': Show the "Secure" chip for pages with an EV certificate. |
| 63 | // - 'secure-to-lock': Show only the lock icon for non-EV https:// pages. |
| 64 | // - 'both-to-lock': Show only the lock icon for all https:// pages. |
| 65 | // - 'keep-secure-chip': Show the old "Secure" chip for non-EV https:// pages. |
| 66 | // The default behavior is the same as 'secure-to-lock'. |
| 67 | // This feature is used for EV UI removal experiment (https://crbug.com/803501). |
| 68 | const base::Feature kSimplifyHttpsIndicator{"SimplifyHttpsIndicator", |
| 69 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 70 | |
manuk | addd3c4 | 2019-04-09 21:20:59 | [diff] [blame] | 71 | // Feature used to enable local entity suggestions. Similar to rich entities but |
| 72 | // but location specific. E.g., typing 'starbucks near' could display the local |
| 73 | // entity suggestion 'starbucks near disneyland \n starbucks * Anaheim, CA'. |
| 74 | const base::Feature kOmniboxLocalEntitySuggestions{ |
| 75 | "OmniboxLocalEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 76 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 77 | // Feature used to enable entity suggestion images and enhanced presentation |
| 78 | // showing more context and descriptive text about the entity. |
| 79 | const base::Feature kOmniboxRichEntitySuggestions{ |
Justin Donnelly | 481a69c | 2019-05-03 20:41:42 | [diff] [blame] | 80 | "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 Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 87 | |
| 88 | // Feature used to enable enhanced presentation showing larger images. |
| 89 | // This is currently only used on Android. |
| 90 | const base::Feature kOmniboxNewAnswerLayout{"OmniboxNewAnswerLayout", |
| 91 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 92 | |
| 93 | // Feature used to enable swapping the rows on answers. |
| 94 | const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers", |
| 95 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 96 | |
Kevin Bailey | 7d918b9 | 2019-05-02 16:00:14 | [diff] [blame] | 97 | // Feature used to enable matching short words to bookmarks for suggestions. |
| 98 | const base::Feature kOmniboxShortBookmarkSuggestions{ |
| 99 | "OmniboxShortBookmarkSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 100 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 101 | // Feature used to force on the experiment of transmission of tail suggestions |
| 102 | // from GWS to this client, currently testing for desktop. |
| 103 | const base::Feature kOmniboxTailSuggestions{ |
| 104 | "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 105 | |
Stepan Khapugin | b0980166 | 2019-05-07 10:17:04 | [diff] [blame^] | 106 | // Feature that enables the tab-switch button on suggestions corresponding to an |
| 107 | // open tab. Enabled by default on Desktop and iOS. |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 108 | const base::Feature kOmniboxTabSwitchSuggestions{ |
| 109 | "OmniboxTabSwitchSuggestions", |
Stepan Khapugin | b0980166 | 2019-05-07 10:17:04 | [diff] [blame^] | 110 | #if defined(OS_ANDROID) |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 111 | base::FEATURE_DISABLED_BY_DEFAULT |
| 112 | #else |
| 113 | base::FEATURE_ENABLED_BY_DEFAULT |
| 114 | #endif |
| 115 | }; |
| 116 | |
| 117 | // Feature used to reverse the sense of the tab switch button. Selecting the |
| 118 | // suggestion will switch to the tab, while the button will navigate |
| 119 | // locally. |
| 120 | const base::Feature kOmniboxReverseTabSwitchLogic{ |
| 121 | "OmniboxReverseTabSwitchLogic", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 122 | |
| 123 | // Feature used to enable various experiments on keyword mode, UI and |
| 124 | // suggestions. |
| 125 | const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode", |
| 126 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 127 | |
| 128 | // Feature used to enable Pedal suggestions. |
| 129 | const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions", |
| 130 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 131 | |
Tommy C. Li | a2c75fb | 2019-04-08 20:22:34 | [diff] [blame] | 132 | // Feature used for UI that improves transparency of and control over omnibox |
| 133 | // suggestions. This includes UI cues (like a clock icon for Search History |
| 134 | // suggestions), as well as user controls to delete personalized suggestions. |
| 135 | // This will be eventually enabled by default. |
| 136 | const base::Feature kOmniboxSuggestionTransparencyOptions{ |
| 137 | "OmniboxSuggestionTransparencyOptions", base::FEATURE_DISABLED_BY_DEFAULT}; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 138 | |
Tommy C. Li | e57096e9 | 2019-04-23 21:18:55 | [diff] [blame] | 139 | // Feature that shows UI cues to differentiate Search History matches from |
| 140 | // other search suggestions provided by the default search provider. This |
| 141 | // feature is a narrow subset of kOmniboxSuggestionTransparencyOptions. |
| 142 | const base::Feature kOmniboxUICuesForSearchHistoryMatches{ |
| 143 | "OmniboxUICuesForSearchHistoryMatches", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 144 | |
Tommy C. Li | 7af8664b | 2019-04-24 18:10:29 | [diff] [blame] | 145 | // Feature that shows an alternate separator before the description of |
| 146 | // omnibox matches. In English, this changes the separator from '-' to '|'. |
| 147 | const base::Feature kOmniboxAlternateMatchDescriptionSeparator{ |
| 148 | "OmniboxAlternateMatchDescriptionSeparator", |
| 149 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 150 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 151 | // Feature to enable clipboard provider to suggest copied text. |
| 152 | const base::Feature kEnableClipboardProviderTextSuggestions{ |
| 153 | "OmniboxEnableClipboardProviderTextSuggestions", |
| 154 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 155 | |
| 156 | // Feature to enable clipboard provider to suggest searching for copied images. |
| 157 | const base::Feature kEnableClipboardProviderImageSuggestions{ |
| 158 | "OmniboxEnableClipboardProviderImageSuggestions", |
| 159 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 160 | |
| 161 | // Feature to enable the search provider to send a request to the suggest |
| 162 | // server on focus. This allows the suggest server to warm up, by, for |
| 163 | // example, loading per-user models into memory. Having a per-user model |
| 164 | // in memory allows the suggest server to respond more quickly with |
| 165 | // personalized suggestions as the user types. |
| 166 | const base::Feature kSearchProviderWarmUpOnFocus{ |
| 167 | "OmniboxWarmUpSearchProviderOnFocus", |
| 168 | #if defined(OS_IOS) |
| 169 | base::FEATURE_DISABLED_BY_DEFAULT |
| 170 | #else |
| 171 | base::FEATURE_ENABLED_BY_DEFAULT |
| 172 | #endif |
| 173 | }; |
| 174 | |
| 175 | // Feature used for the Zero Suggest Redirect to Chrome Field Trial. |
| 176 | const base::Feature kZeroSuggestRedirectToChrome{ |
| 177 | "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 178 | |
| 179 | // Feature used to display the title of the current URL match. |
| 180 | const base::Feature kDisplayTitleForCurrentUrl{ |
| 181 | "OmniboxDisplayTitleForCurrentUrl", |
| 182 | #if !defined(OS_IOS) |
| 183 | base::FEATURE_ENABLED_BY_DEFAULT |
| 184 | #else |
| 185 | base::FEATURE_DISABLED_BY_DEFAULT |
| 186 | #endif |
| 187 | }; |
| 188 | |
| 189 | // Feature used for the max autocomplete matches UI experiment. |
| 190 | const base::Feature kUIExperimentMaxAutocompleteMatches{ |
| 191 | "OmniboxUIExperimentMaxAutocompleteMatches", |
| 192 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 193 | |
| 194 | // Feature used to display the search terms instead of the URL in the Omnibox |
| 195 | // when the user is on the search results page of the default search provider. |
| 196 | const base::Feature kQueryInOmnibox{"QueryInOmnibox", |
| 197 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 198 | |
| 199 | // Feature used for showing the URL suggestion favicons as a UI experiment, |
| 200 | // currently only used on desktop platforms. |
| 201 | const base::Feature kUIExperimentShowSuggestionFavicons{ |
Tomasz Wiszkowski | 4af1f735 | 2019-04-08 16:46:15 | [diff] [blame] | 202 | "OmniboxUIExperimentShowSuggestionFavicons", |
| 203 | #if defined(OS_ANDROID) |
| 204 | base::FEATURE_DISABLED_BY_DEFAULT |
| 205 | #else |
| 206 | base::FEATURE_ENABLED_BY_DEFAULT |
| 207 | #endif |
| 208 | }; |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 209 | |
| 210 | // Feature used to always swap the title and URL. |
| 211 | const base::Feature kUIExperimentSwapTitleAndUrl{ |
| 212 | "OmniboxUIExperimentSwapTitleAndUrl", |
| 213 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 214 | base::FEATURE_DISABLED_BY_DEFAULT |
| 215 | #else |
| 216 | base::FEATURE_ENABLED_BY_DEFAULT |
| 217 | #endif |
| 218 | }; |
| 219 | |
| 220 | // Feature used for the vertical margin UI experiment, currently only used on |
| 221 | // desktop platforms. |
| 222 | const base::Feature kUIExperimentVerticalMargin{ |
| 223 | "OmniboxUIExperimentVerticalMargin", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 224 | |
Tommy C. Li | e35fb6b | 2019-04-30 16:29:54 | [diff] [blame] | 225 | // Feature used to limit the vertical margin UI experiment to non-touch |
| 226 | // devices only. Has no effect if kUIExperimentVerticalMargin is not enabled. |
| 227 | const base::Feature kUIExperimentVerticalMarginLimitToNonTouchOnly{ |
| 228 | "OmniboxUIExperimentVerticalMarginLimitToNonTouchOnly", |
| 229 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 230 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 231 | // Feature used to color "blue" the generic search icon and search terms. |
| 232 | // Technically, this makes the search icon and search terms match the color of |
| 233 | // Omnibox link text, which is blue by convention. |
| 234 | const base::Feature kUIExperimentBlueSearchLoopAndSearchQuery{ |
| 235 | "OmniboxUIExperimentBlueSearchLoopAndSearchQuery", |
| 236 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 237 | |
| 238 | // Feature used to change the color of text in navigation suggestions. It |
| 239 | // changes title text from black to blue, and URL text from blue to gray. |
| 240 | const base::Feature kUIExperimentBlueTitlesAndGrayUrlsOnPageSuggestions{ |
| 241 | "OmniboxUIExperimentBlueTitlesAndGrayUrlsOnPageSuggestions", |
| 242 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 243 | |
| 244 | // Feature used to change the color of text in navigation suggestions. It |
| 245 | // changes title text from black to blue. |
| 246 | const base::Feature kUIExperimentBlueTitlesOnPageSuggestions{ |
| 247 | "OmniboxUIExperimentBlueTitlesOnPageSuggestions", |
| 248 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 249 | |
| 250 | // Feature used to show a " - Google Search", " - Bing Search", etc. suffix on |
| 251 | // all search suggestions instead of just the first one in each cluster. |
| 252 | const base::Feature kUIExperimentShowSuffixOnAllSearchSuggestions{ |
| 253 | "OmniboxUIExperimentShowSuffixOnAllSearchSuggestions", |
| 254 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 255 | |
| 256 | // Feature used to show a white background in the omnibox while it's unfocused. |
| 257 | // More technically, with this flag on, it uses the same background color as |
| 258 | // the results popup (conventionally white). |
| 259 | const base::Feature kUIExperimentWhiteBackgroundOnBlur{ |
| 260 | "OmniboxUIExperimentWhiteBackgroundOnBlur", |
| 261 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 262 | |
| 263 | // Feature used to show a generic vector icon for omnibox search instead of the |
| 264 | // search engine favicon. |
| 265 | // |
| 266 | // This feature flag's string has a typo: "Omnibox" => "Ominbox". |
| 267 | // Do not correct this typo, because this misspelled string is being used |
| 268 | // as-is in field trials. |
| 269 | const base::Feature kUIExperimentUseGenericSearchEngineIcon{ |
| 270 | "OminboxUIExperimentUseGenericSearchEngineIcon", |
| 271 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 272 | |
| 273 | // Feature used to bold the "user text" part of search suggestions instead |
| 274 | // of the "autocomplete" part. For example, if the user typed "point reyes", |
| 275 | // and the search suggestion was "point reyes weather", this feature makes |
| 276 | // the "point reyes" part of the suggestion bold, instead of "weather". |
| 277 | const base::Feature kUIExperimentBoldUserTextOnSearchSuggestions{ |
| 278 | "OmniboxUIExperimentBoldUserTextOnSearchSuggestions", |
| 279 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 280 | |
| 281 | // Feature used to unbold suggestion text. |
| 282 | const base::Feature kUIExperimentUnboldSuggestionText{ |
| 283 | "OmniboxUIExperimentUnboldSuggestionText", |
| 284 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 285 | |
Dan Beam | c6f0d22 | 2019-04-26 00:38:31 | [diff] [blame] | 286 | // Shows the "Search Google or type a URL" omnibox placeholder even when the |
| 287 | // caret (text edit cursor) is showing / when focused. views::Textfield works |
| 288 | // this way, as does <input placeholder="">. Omnibox and the NTP's "fakebox" |
| 289 | // are exceptions in this regard and this experiment makes this more consistent. |
| 290 | const base::Feature kUIExperimentShowPlaceholderWhenCaretShowing{ |
| 291 | "OmniboxUIExperimentShowPlaceholderWhenCaretShowing", |
| 292 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 293 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 294 | // Feature used to enable speculatively starting a service worker associated |
| 295 | // with the destination of the default match when the user's input looks like a |
| 296 | // query. |
| 297 | const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{ |
| 298 | "OmniboxSpeculativeServiceWorkerStartOnQueryInput", |
| 299 | base::FEATURE_ENABLED_BY_DEFAULT |
| 300 | }; |
| 301 | |
| 302 | // Feature used to fetch document suggestions. |
| 303 | const base::Feature kDocumentProvider{"OmniboxDocumentProvider", |
| 304 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 305 | |
| 306 | // Feature used to dedupe Google Drive URLs between different formats. |
| 307 | // OmniboxDocumentProvider arms may wish to enable this, though it may also be |
| 308 | // run on its own. |
| 309 | const base::Feature kDedupeGoogleDriveURLs{"OmniboxDedupeGoogleDriveURLs", |
| 310 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 311 | |
| 312 | // Feature to replace the standard ZeroSuggest with icons for most visited sites |
| 313 | // and collections (bookmarks, history, recent tabs, reading list). Only |
| 314 | // available on iOS. |
| 315 | const base::Feature kOmniboxPopupShortcutIconsInZeroState{ |
| 316 | "OmniboxPopupShortcutIconsInZeroState", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 317 | |
| 318 | // Feature to use material design weather icons in the omnibox when displaying |
| 319 | // weather answers. |
| 320 | const base::Feature kOmniboxMaterialDesignWeatherIcons{ |
| 321 | "OmniboxMaterialDesignWeatherIcons", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 322 | |
Tomasz Wiszkowski | 947f6d0d | 2019-03-15 22:27:25 | [diff] [blame] | 323 | // Allow suggestions to be shown to the user on the New Tab Page upon focusing |
| 324 | // URL bar (the omnibox). |
| 325 | const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP", |
| 326 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 327 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 328 | } // namespace omnibox |