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. |
| 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 | }; |
| 32 | |
| 33 | // Feature used to hide trivial subdomains from steady state URLs displayed in |
| 34 | // the toolbar. It is restored during editing. |
| 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 | }; |
| 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 | |
| 71 | // Feature used to enable entity suggestion images and enhanced presentation |
| 72 | // showing more context and descriptive text about the entity. |
| 73 | const base::Feature kOmniboxRichEntitySuggestions{ |
| 74 | "OmniboxRichEntitySuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 75 | |
| 76 | // Feature used to enable enhanced presentation showing larger images. |
| 77 | // This is currently only used on Android. |
| 78 | const base::Feature kOmniboxNewAnswerLayout{"OmniboxNewAnswerLayout", |
| 79 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 80 | |
| 81 | // Feature used to enable swapping the rows on answers. |
| 82 | const base::Feature kOmniboxReverseAnswers{"OmniboxReverseAnswers", |
| 83 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 84 | |
| 85 | // Feature used to force on the experiment of transmission of tail suggestions |
| 86 | // from GWS to this client, currently testing for desktop. |
| 87 | const base::Feature kOmniboxTailSuggestions{ |
| 88 | "OmniboxTailSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 89 | |
| 90 | // Feature used to force on the experiment of showing a button for suggestions |
| 91 | // whose URL is open in another tab, with the ability to switch to that tab, |
| 92 | // currently only used on desktop and iOS platforms. |
| 93 | const base::Feature kOmniboxTabSwitchSuggestions{ |
| 94 | "OmniboxTabSwitchSuggestions", |
| 95 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 96 | base::FEATURE_DISABLED_BY_DEFAULT |
| 97 | #else |
| 98 | base::FEATURE_ENABLED_BY_DEFAULT |
| 99 | #endif |
| 100 | }; |
| 101 | |
| 102 | // Feature used to reverse the sense of the tab switch button. Selecting the |
| 103 | // suggestion will switch to the tab, while the button will navigate |
| 104 | // locally. |
| 105 | const base::Feature kOmniboxReverseTabSwitchLogic{ |
| 106 | "OmniboxReverseTabSwitchLogic", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 107 | |
| 108 | // Feature used to enable various experiments on keyword mode, UI and |
| 109 | // suggestions. |
| 110 | const base::Feature kExperimentalKeywordMode{"OmniboxExperimentalKeywordMode", |
| 111 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 112 | |
| 113 | // Feature used to enable Pedal suggestions. |
| 114 | const base::Feature kOmniboxPedalSuggestions{"OmniboxPedalSuggestions", |
| 115 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 116 | |
| 117 | // Feature used to show a context menu for suggestions when the user |
| 118 | // right-clicks a suggestion in the omnibox dropdown. It's currently disabled |
| 119 | // by default during development, but will eventually be enabled by default. |
| 120 | const base::Feature kOmniboxContextMenuForSuggestions{ |
| 121 | "OmniboxContextMenuForSuggestions", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 122 | |
| 123 | // Feature to enable clipboard provider to suggest copied text. |
| 124 | const base::Feature kEnableClipboardProviderTextSuggestions{ |
| 125 | "OmniboxEnableClipboardProviderTextSuggestions", |
| 126 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 127 | |
| 128 | // Feature to enable clipboard provider to suggest searching for copied images. |
| 129 | const base::Feature kEnableClipboardProviderImageSuggestions{ |
| 130 | "OmniboxEnableClipboardProviderImageSuggestions", |
| 131 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 132 | |
| 133 | // Feature to enable the search provider to send a request to the suggest |
| 134 | // server on focus. This allows the suggest server to warm up, by, for |
| 135 | // example, loading per-user models into memory. Having a per-user model |
| 136 | // in memory allows the suggest server to respond more quickly with |
| 137 | // personalized suggestions as the user types. |
| 138 | const base::Feature kSearchProviderWarmUpOnFocus{ |
| 139 | "OmniboxWarmUpSearchProviderOnFocus", |
| 140 | #if defined(OS_IOS) |
| 141 | base::FEATURE_DISABLED_BY_DEFAULT |
| 142 | #else |
| 143 | base::FEATURE_ENABLED_BY_DEFAULT |
| 144 | #endif |
| 145 | }; |
| 146 | |
| 147 | // Feature used for the Zero Suggest Redirect to Chrome Field Trial. |
| 148 | const base::Feature kZeroSuggestRedirectToChrome{ |
| 149 | "ZeroSuggestRedirectToChrome", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 150 | |
| 151 | // Feature used to display the title of the current URL match. |
| 152 | const base::Feature kDisplayTitleForCurrentUrl{ |
| 153 | "OmniboxDisplayTitleForCurrentUrl", |
| 154 | #if !defined(OS_IOS) |
| 155 | base::FEATURE_ENABLED_BY_DEFAULT |
| 156 | #else |
| 157 | base::FEATURE_DISABLED_BY_DEFAULT |
| 158 | #endif |
| 159 | }; |
| 160 | |
| 161 | // Feature used for the max autocomplete matches UI experiment. |
| 162 | const base::Feature kUIExperimentMaxAutocompleteMatches{ |
| 163 | "OmniboxUIExperimentMaxAutocompleteMatches", |
| 164 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 165 | |
| 166 | // Feature used to display the search terms instead of the URL in the Omnibox |
| 167 | // when the user is on the search results page of the default search provider. |
| 168 | const base::Feature kQueryInOmnibox{"QueryInOmnibox", |
| 169 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 170 | |
| 171 | // Feature used for showing the URL suggestion favicons as a UI experiment, |
| 172 | // currently only used on desktop platforms. |
| 173 | const base::Feature kUIExperimentShowSuggestionFavicons{ |
| 174 | "OmniboxUIExperimentShowSuggestionFavicons", |
| 175 | base::FEATURE_ENABLED_BY_DEFAULT}; |
| 176 | |
| 177 | // Feature used to always swap the title and URL. |
| 178 | const base::Feature kUIExperimentSwapTitleAndUrl{ |
| 179 | "OmniboxUIExperimentSwapTitleAndUrl", |
| 180 | #if defined(OS_IOS) || defined(OS_ANDROID) |
| 181 | base::FEATURE_DISABLED_BY_DEFAULT |
| 182 | #else |
| 183 | base::FEATURE_ENABLED_BY_DEFAULT |
| 184 | #endif |
| 185 | }; |
| 186 | |
| 187 | // Feature used for the vertical margin UI experiment, currently only used on |
| 188 | // desktop platforms. |
| 189 | const base::Feature kUIExperimentVerticalMargin{ |
| 190 | "OmniboxUIExperimentVerticalMargin", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 191 | |
| 192 | // Feature used to color "blue" the generic search icon and search terms. |
| 193 | // Technically, this makes the search icon and search terms match the color of |
| 194 | // Omnibox link text, which is blue by convention. |
| 195 | const base::Feature kUIExperimentBlueSearchLoopAndSearchQuery{ |
| 196 | "OmniboxUIExperimentBlueSearchLoopAndSearchQuery", |
| 197 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 198 | |
| 199 | // Feature used to change the color of text in navigation suggestions. It |
| 200 | // changes title text from black to blue, and URL text from blue to gray. |
| 201 | const base::Feature kUIExperimentBlueTitlesAndGrayUrlsOnPageSuggestions{ |
| 202 | "OmniboxUIExperimentBlueTitlesAndGrayUrlsOnPageSuggestions", |
| 203 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 204 | |
| 205 | // Feature used to change the color of text in navigation suggestions. It |
| 206 | // changes title text from black to blue. |
| 207 | const base::Feature kUIExperimentBlueTitlesOnPageSuggestions{ |
| 208 | "OmniboxUIExperimentBlueTitlesOnPageSuggestions", |
| 209 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 210 | |
| 211 | // Feature used to show a " - Google Search", " - Bing Search", etc. suffix on |
| 212 | // all search suggestions instead of just the first one in each cluster. |
| 213 | const base::Feature kUIExperimentShowSuffixOnAllSearchSuggestions{ |
| 214 | "OmniboxUIExperimentShowSuffixOnAllSearchSuggestions", |
| 215 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 216 | |
| 217 | // Feature used to show a white background in the omnibox while it's unfocused. |
| 218 | // More technically, with this flag on, it uses the same background color as |
| 219 | // the results popup (conventionally white). |
| 220 | const base::Feature kUIExperimentWhiteBackgroundOnBlur{ |
| 221 | "OmniboxUIExperimentWhiteBackgroundOnBlur", |
| 222 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 223 | |
| 224 | // Feature used to show a generic vector icon for omnibox search instead of the |
| 225 | // search engine favicon. |
| 226 | // |
| 227 | // This feature flag's string has a typo: "Omnibox" => "Ominbox". |
| 228 | // Do not correct this typo, because this misspelled string is being used |
| 229 | // as-is in field trials. |
| 230 | const base::Feature kUIExperimentUseGenericSearchEngineIcon{ |
| 231 | "OminboxUIExperimentUseGenericSearchEngineIcon", |
| 232 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 233 | |
| 234 | // Feature used to bold the "user text" part of search suggestions instead |
| 235 | // of the "autocomplete" part. For example, if the user typed "point reyes", |
| 236 | // and the search suggestion was "point reyes weather", this feature makes |
| 237 | // the "point reyes" part of the suggestion bold, instead of "weather". |
| 238 | const base::Feature kUIExperimentBoldUserTextOnSearchSuggestions{ |
| 239 | "OmniboxUIExperimentBoldUserTextOnSearchSuggestions", |
| 240 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 241 | |
| 242 | // Feature used to unbold suggestion text. |
| 243 | const base::Feature kUIExperimentUnboldSuggestionText{ |
| 244 | "OmniboxUIExperimentUnboldSuggestionText", |
| 245 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 246 | |
| 247 | // Feature used to enable speculatively starting a service worker associated |
| 248 | // with the destination of the default match when the user's input looks like a |
| 249 | // query. |
| 250 | const base::Feature kSpeculativeServiceWorkerStartOnQueryInput{ |
| 251 | "OmniboxSpeculativeServiceWorkerStartOnQueryInput", |
| 252 | base::FEATURE_ENABLED_BY_DEFAULT |
| 253 | }; |
| 254 | |
| 255 | // Feature used to fetch document suggestions. |
| 256 | const base::Feature kDocumentProvider{"OmniboxDocumentProvider", |
| 257 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 258 | |
| 259 | // Feature used to dedupe Google Drive URLs between different formats. |
| 260 | // OmniboxDocumentProvider arms may wish to enable this, though it may also be |
| 261 | // run on its own. |
| 262 | const base::Feature kDedupeGoogleDriveURLs{"OmniboxDedupeGoogleDriveURLs", |
| 263 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 264 | |
| 265 | // Feature to replace the standard ZeroSuggest with icons for most visited sites |
| 266 | // and collections (bookmarks, history, recent tabs, reading list). Only |
| 267 | // available on iOS. |
| 268 | const base::Feature kOmniboxPopupShortcutIconsInZeroState{ |
| 269 | "OmniboxPopupShortcutIconsInZeroState", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 270 | |
| 271 | // Feature to use material design weather icons in the omnibox when displaying |
| 272 | // weather answers. |
| 273 | const base::Feature kOmniboxMaterialDesignWeatherIcons{ |
| 274 | "OmniboxMaterialDesignWeatherIcons", base::FEATURE_DISABLED_BY_DEFAULT}; |
| 275 | |
Tomasz Wiszkowski | 947f6d0d | 2019-03-15 22:27:25 | [diff] [blame^] | 276 | // Allow suggestions to be shown to the user on the New Tab Page upon focusing |
| 277 | // URL bar (the omnibox). |
| 278 | const base::Feature kZeroSuggestionsOnNTP{"OmniboxZeroSuggestionsOnNTP", |
| 279 | base::FEATURE_DISABLED_BY_DEFAULT}; |
| 280 | |
Tomasz Wiszkowski | d938a111 | 2019-03-06 18:01:57 | [diff] [blame] | 281 | } // namespace omnibox |