blob: 818cb38b4c24656950d141d94a7e57c15cc41530 [file] [log] [blame]
Avi Drissman4a8573c2022-09-09 19:35:541// Copyright 2019 The Chromium Authors
Charlene Yan0724dc562019-04-12 17:57:412// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// This file defines the browser-specific base::FeatureList features that are
6// limited to top chrome UI.
7
8#ifndef CHROME_BROWSER_UI_UI_FEATURES_H_
9#define CHROME_BROWSER_UI_UI_FEATURES_H_
10
11#include "base/feature_list.h"
Thomas Lukaszewicz31c038da2020-09-24 22:49:0712#include "base/metrics/field_trial_params.h"
Dana Fried16e9d9c2021-01-28 09:32:2813#include "build/branding_buildflags.h"
Charlene Yan0724dc562019-04-12 17:57:4114#include "build/build_config.h"
Yuta Hijikata40b891d2020-11-27 09:05:0115#include "build/chromeos_buildflags.h"
Peter Boström92add81d2019-08-12 22:14:2416#include "chrome/common/buildflags.h"
Devlin Cronin83636982022-09-15 20:32:2217#include "extensions/buildflags/buildflags.h"
Charlene Yan0724dc562019-04-12 17:57:4118
19namespace features {
20
21// All features in alphabetical order. The features should be documented
22// alongside the definition of their values in the .cc file.
23
Alison Gale91301922024-04-15 19:35:2724// TODO(crbug.com/40598679): Remove this when the tab dragging
Max Ihlenfeldt6f51c1c2022-01-25 23:58:5925// interactive_ui_tests pass on Wayland.
Daniel Cheng0b6369f2022-09-20 17:59:3926BASE_DECLARE_FEATURE(kAllowWindowDragUsingSystemDragDrop);
Max Ihlenfeldt6f51c1c2022-01-25 23:58:5927
Luis Juan Sanchez Padilla949923c2023-08-25 16:07:4128BASE_DECLARE_FEATURE(kAllowEyeDropperWGCScreenCapture);
29
Daniel Cheng0b6369f2022-09-20 17:59:3930BASE_DECLARE_FEATURE(kChromeLabs);
Elaine Chiend674b5b2023-07-26 20:22:4631extern const char kChromeLabsActivationParameterName[];
32extern const base::FeatureParam<int> kChromeLabsActivationPercentage;
Elaine Chien29fce992020-12-01 17:44:3433
Naman Narula572d88a02023-11-03 17:15:1034BASE_DECLARE_FEATURE(kCloseOmniboxPopupOnInactiveAreaClick);
35
Charles Meng59979412024-02-22 18:47:4236BASE_DECLARE_FEATURE(kDefaultBrowserPromptRefresh);
Alison Gale60cdbc822024-03-28 22:20:2537BASE_DECLARE_FEATURE(kDefaultBrowserPromptRefreshTrial);
38
39// String representation of the study group for running a synthetic trial.
40extern const base::FeatureParam<std::string>
41 kDefaultBrowserPromptRefreshStudyGroup;
Charles Meng59979412024-02-22 18:47:4242
Alison Galed7f2598d2024-03-15 15:39:1843// Whether to show the default browser info bar prompt.
44extern const base::FeatureParam<bool> kShowDefaultBrowserInfoBar;
45
46// Whether to show the default browser app menu chip prompt.
47extern const base::FeatureParam<bool> kShowDefaultBrowserAppMenuChip;
48
Alison Gale9b585ba2024-04-12 01:07:4449// Whether to show the default browser app menu item anytime the browser isn't
50// default, even if the app menu chip prompt isn't enabled.
51extern const base::FeatureParam<bool> kShowDefaultBrowserAppMenuItem;
52
Charles Meng59979412024-02-22 18:47:4253// Whether to show the updated info bar strings.
54extern const base::FeatureParam<bool> kUpdatedInfoBarCopy;
55
56// Base duration after which the user may be remprompted.
57extern const base::FeatureParam<base::TimeDelta> kRepromptDuration;
58
Charles Meng7e9ad6c2024-03-12 21:03:3359// Maximum number of times a user will be prompted. When set to a negative
60// value, the user will be prompted indefinitely.
Charles Meng59979412024-02-22 18:47:4261extern const base::FeatureParam<int> kMaxPromptCount;
62
63// Exponential backoff multiplier for the reprompt duration.
64extern const base::FeatureParam<int> kRepromptDurationMultiplier;
65
Charles Meng38b43cd12024-04-11 21:09:4566// The duration after which the app menu prompt should not longer be shown.
67extern const base::FeatureParam<base::TimeDelta> kDefaultBrowserAppMenuDuration;
68
Charles Meng35bfa2382024-04-19 23:20:3769// Whether the app menu chip should use more prominent colors.
70extern const base::FeatureParam<bool> kAppMenuChipColorPrimary;
71
Justin Lulejian54634a82023-03-09 23:47:4672BASE_DECLARE_FEATURE(kExtensionsMenuInAppMenu);
Keren Zhuab97ffe2023-09-23 00:06:1473bool IsExtensionMenuInRootAppMenu();
Justin Lulejian54634a82023-03-09 23:47:4674
Brian Malcolmbf99d992021-10-06 01:51:2175#if !defined(ANDROID)
Daniel Cheng0b6369f2022-09-20 17:59:3976BASE_DECLARE_FEATURE(kAccessCodeCastUI);
Benjamin Zielinski11f187f82021-07-12 23:51:5277#endif
78
Zack Han2a3a57f22024-06-10 17:00:2279#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
80BASE_DECLARE_FEATURE(kFewerUpdateConfirmations);
81#endif
82
Jochen Eisinger44ea67d2023-04-13 14:42:2083#if !BUILDFLAG(IS_ANDROID) && BUILDFLAG(GOOGLE_CHROME_BRANDING)
aliaaborhamyfc8b62322024-05-13 17:41:5384BASE_DECLARE_FEATURE(kIOSPromoRefreshedPasswordBubble);
85
Aliaa Alborhamy8730b1a2024-04-11 15:22:1886BASE_DECLARE_FEATURE(kIOSPromoAddressBubble);
Kenichi Ishibashibb5b5232024-04-09 02:10:1287
Aliaa Alborhamy8730b1a2024-04-11 15:22:1888BASE_DECLARE_FEATURE(kIOSPromoBookmarkBubble);
Aliaa Alborhamya7802612024-03-21 13:49:4589// This enum lists the possible params for the kIOSPromoBookmarkBubble promo.
90// The first is the launch candidate, the other one is for debugging/testing.
91enum class IOSPromoBookmarkBubbleActivation {
92 kContextual,
93 kAlwaysShowWithBookmarkBubble,
94};
95extern const base::FeatureParam<IOSPromoBookmarkBubbleActivation>
96 kIOSPromoBookmarkBubbleActivationParam;
aliaaborhamy12be3c7102024-06-04 14:14:5297
98BASE_DECLARE_FEATURE(kIOSPromoPaymentBubble);
Jochen Eisinger6ef16de2023-03-23 20:44:1899#endif
100
Ehimare Okoyomon04c9bfe22023-07-13 14:04:28101#if !BUILDFLAG(IS_ANDROID)
102BASE_DECLARE_FEATURE(kHaTSWebUI);
103#endif
104
Takumi Fujimoto6d6fa1852024-03-11 21:09:20105#if !BUILDFLAG(IS_ANDROID)
106BASE_DECLARE_FEATURE(kKeyboardAndPointerLockPrompt);
107#endif
108
Devlin Cronin83636982022-09-15 20:32:22109#if BUILDFLAG(ENABLE_EXTENSIONS)
Daniel Cheng0b6369f2022-09-20 17:59:39110BASE_DECLARE_FEATURE(kLightweightExtensionOverrideConfirmations);
Devlin Cronin83636982022-09-15 20:32:22111#endif
112
Keren Zhuff3005d12024-02-18 22:53:09113BASE_DECLARE_FEATURE(kPreloadTopChromeWebUI);
Keren Zhu2af4aa082024-02-28 17:10:27114// This enum entry values must be in sync with
115// WebUIContentsPreloadManager::PreloadMode.
116enum class PreloadTopChromeWebUIMode {
117 kPreloadOnWarmup = 0,
118 kPreloadOnMakeContents = 1
119};
Keren Zhub2247ef2024-05-17 17:21:37120extern const char kPreloadTopChromeWebUIModeName[];
121extern const char kPreloadTopChromeWebUIModePreloadOnWarmupName[];
122extern const char kPreloadTopChromeWebUIModePreloadOnMakeContentsName[];
Keren Zhu2af4aa082024-02-28 17:10:27123extern const base::FeatureParam<PreloadTopChromeWebUIMode>
124 kPreloadTopChromeWebUIMode;
Keren Zhu2bd3731a2024-08-19 15:09:04125
Keren Zhu83632032024-06-13 19:12:53126// If smart preload is enabled, the preload WebUI is determined by historical
127// engagement scores and whether a WebUI is currently being shown.
128// If disabled, always preload Tab Search.
Keren Zhu2bd3731a2024-08-19 15:09:04129extern const char kPreloadTopChromeWebUISmartPreloadName[];
Keren Zhu83632032024-06-13 19:12:53130extern const base::FeatureParam<bool> kPreloadTopChromeWebUISmartPreload;
Keren Zhuff3005d12024-02-18 22:53:09131
Keren Zhu2bd3731a2024-08-19 15:09:04132// If delay preload is enabled, the preloading is delayed until the first
133// non empty paint of an observed web contents.
134//
135// In case of browser startup, the observed web contents is the active web
136// contents of the last created browser.
137//
138// In case of Request() is called, the requested web contents is observed.
139//
140// In case of web contents destroy, the preloading simply waits for a fixed
141// amount of time.
142extern const char kPreloadTopChromeWebUIDelayPreloadName[];
143extern const base::FeatureParam<bool> kPreloadTopChromeWebUIDelayPreload;
144
Muyao Xu8105b7112024-03-04 20:15:51145#if !BUILDFLAG(IS_ANDROID)
146BASE_DECLARE_FEATURE(kPressAndHoldEscToExitBrowserFullscreen);
147#endif
148
Pengchao Caibe83f682023-07-10 23:43:40149BASE_DECLARE_FEATURE(kResponsiveToolbar);
150
Emily Shacka43abf72024-09-24 18:14:29151BASE_DECLARE_FEATURE(kTabDuplicateMetrics);
152
David Pennington423db8f2022-10-24 22:30:04153BASE_DECLARE_FEATURE(kTabScrollingButtonPosition);
154extern const char kTabScrollingButtonPositionParameterName[];
155
Daniel Cheng0b6369f2022-09-20 17:59:39156BASE_DECLARE_FEATURE(kSidePanelWebView);
Elly Fong-Jonesfe05ca12022-09-09 23:38:47157
Caroline Rising4812636e2023-04-10 14:35:24158#if !defined(ANDROID)
159BASE_DECLARE_FEATURE(kSidePanelCompanionDefaultPinned);
Caroline Rising4812636e2023-04-10 14:35:24160#endif
161
Marlon Facey41373d72b2022-10-11 02:34:09162BASE_DECLARE_FEATURE(kSidePanelJourneysQueryless);
Jingqi Sunac0acdd2024-06-10 18:02:38163BASE_DECLARE_FEATURE(kSidePanelResizing);
Ben Goldbergerbde1cb0c2023-01-05 23:35:50164BASE_DECLARE_FEATURE(kSidePanelSearchCompanion);
Marlon Faceyfce1a9e2022-03-31 23:48:06165
Michael Crouseb56427f2023-04-12 00:47:49166BASE_DECLARE_FEATURE(kSideSearch);
Daniel Cheng0b6369f2022-09-20 17:59:39167BASE_DECLARE_FEATURE(kSideSearchFeedback);
Daniel Cheng0b6369f2022-09-20 17:59:39168BASE_DECLARE_FEATURE(kSearchWebInSidePanel);
tom927b2ab82021-09-23 03:45:27169
Daniel Cheng0b6369f2022-09-20 17:59:39170BASE_DECLARE_FEATURE(kSideSearchAutoTriggering);
Thomas Lukaszewicz35268cac2022-08-20 00:35:00171extern const base::FeatureParam<int> kSideSearchAutoTriggeringReturnCount;
172
François Doray9fe45bbd2022-11-17 21:21:13173BASE_DECLARE_FEATURE(kTabGroupsCollapseFreezing);
174
Daniel Cheng0b6369f2022-09-20 17:59:39175BASE_DECLARE_FEATURE(kTabHoverCardImages);
Dana Fried25251882021-09-13 22:19:31176
177// These parameters control how long the hover card system waits before
178// requesting a preview image from a tab where no preview image is available.
179// Values are in ms.
Dana Fried1254a2b2021-03-10 22:00:45180extern const char kTabHoverCardImagesNotReadyDelayParameterName[];
181extern const char kTabHoverCardImagesLoadingDelayParameterName[];
182extern const char kTabHoverCardImagesLoadedDelayParameterName[];
Dana Fried25251882021-09-13 22:19:31183
184// Determines how long to wait during a hover card slide transition before a
185// placeholder image is displayed via crossfade.
186// -1: disable crossfade entirely
187// 0: show placeholder immediately
188// 1: show placeholder when the card lands on the new tab
189// between 0 and 1: show at a percentage of transition
190//
191// Note: crossfade is automatically disabled if animations are disabled at the
192// OS level (e.g. for accessibility).
Dana Fried43e6bbe2021-07-15 22:48:54193extern const char kTabHoverCardImagesCrossfadePreviewAtParameterName[];
Dana Fried25251882021-09-13 22:19:31194
195// Adds an amount of time (in ms) to the show delay when tabs are max width -
196// typically when there are less than 5 or 6 tabs in a browser window.
Dana Friedd3e015b2021-07-16 01:22:35197extern const char kTabHoverCardAdditionalMaxWidthDelay[];
Dana Fried25251882021-09-13 22:19:31198
Emily Shackc5d2d11a952023-08-24 20:14:33199BASE_DECLARE_FEATURE(kTabOrganization);
200bool IsTabOrganization();
201
Shibalik Mohapatra04fd5392024-08-06 22:42:16202BASE_DECLARE_FEATURE(kTabstripDeclutter);
Shibalik Mohapatra16ee7fcdc2024-08-21 16:36:14203bool IsTabstripDeclutterEnabled();
Shibalik Mohapatra04fd5392024-08-06 22:42:16204
Emily Shack2099c342024-02-13 20:45:13205BASE_DECLARE_FEATURE(kMultiTabOrganization);
206
Emily Shackd71d3d4f2024-04-20 17:02:46207BASE_DECLARE_FEATURE(kTabOrganizationAppMenuItem);
208
Emily Shackbe4f8e52024-03-18 19:40:54209BASE_DECLARE_FEATURE(kTabReorganization);
210
Emily Shackd71d3d4f2024-04-20 17:02:46211BASE_DECLARE_FEATURE(kTabReorganizationDivider);
212
Emily Shack07fd1332024-08-19 23:30:22213BASE_DECLARE_FEATURE(kTabOrganizationModelStrategy);
214
Emily Shackcaa1a3b12024-09-12 22:30:39215BASE_DECLARE_FEATURE(kTabOrganizationEnableNudgeForEnterprise);
216
Shibalik Mohapatra9642c832024-09-30 23:12:01217// Duration of inactivity after which a tab is considered stale for declutter.
218extern const base::FeatureParam<base::TimeDelta>
219 kTabstripDeclutterStaleThresholdDuration;
220// Interval between a recomputation of stale tabs for declutter.
221extern const base::FeatureParam<base::TimeDelta>
222 kTabstripDeclutterTimerInterval;
223// Default interval after showing a nudge to prevent another nudge from being
224// shown for declutter.
225extern const base::FeatureParam<base::TimeDelta>
226 kTabstripDeclutterNudgeTimerInterval;
227
Taylor Bergquistccd323842023-11-20 22:00:51228// The target (and minimum) interval between proactive nudge triggers. Measured
229// against a clock that only runs while Chrome is in the foreground.
230extern const base::FeatureParam<base::TimeDelta> kTabOrganizationTriggerPeriod;
231
232// The base to use for the trigger logic's exponential backoff.
233extern const base::FeatureParam<double> kTabOrganizationTriggerBackoffBase;
234
235// The minimum score threshold for proactive nudge triggering to occur.
236extern const base::FeatureParam<double> kTabOrganizationTriggerThreshold;
237
Taylor Bergquiste0388722023-12-12 23:00:54238// The maximum sensitivity score for a tab to contribute to trigger scoring.
239extern const base::FeatureParam<double>
240 kTabOrganizationTriggerSensitivityThreshold;
241
Taylor Bergquist096c024c2023-12-14 23:37:42242// Enable 'demo mode' for Tab Organization triggering, which triggers much more
243// predictably and frequently.
244extern const base::FeatureParam<bool> KTabOrganizationTriggerDemoMode;
245
Daniel Cheng0b6369f2022-09-20 17:59:39246BASE_DECLARE_FEATURE(kTabSearchChevronIcon);
Tom58439ac72021-07-01 19:15:56247
Daniel Cheng0b6369f2022-09-20 17:59:39248BASE_DECLARE_FEATURE(kTabSearchFeedback);
Roman Arora4d4bb4b2020-09-24 17:28:13249
Daniel Cheng0b6369f2022-09-20 17:59:39250BASE_DECLARE_FEATURE(kTabSearchRecentlyClosed);
Yuheng Huang58af2732021-10-19 00:00:52251
Roman Aroraadcb4dc2021-04-01 23:45:24252// Default number of recently closed entries to display by default when no
253// search text is provided.
254extern const base::FeatureParam<int>
255 kTabSearchRecentlyClosedDefaultItemDisplayCount;
256
Roman Arora0a976ba2021-06-17 00:58:39257// A threshold of recently closed tabs after which to stop adding recently
258// closed item data to the profile data payload should the minimum display
259// count have been met.
260extern const base::FeatureParam<int> kTabSearchRecentlyClosedTabCountThreshold;
Roman Aroraadcb4dc2021-04-01 23:45:24261
David Bienvenuc7079c32023-12-16 00:39:55262BASE_DECLARE_FEATURE(kTearOffWebAppTabOpensWebAppWindow);
263
Caroline Rising53437cb2024-02-06 03:03:31264BASE_DECLARE_FEATURE(kToolbarPinning);
265
Joseph Park4e7b414f2024-02-14 18:31:38266bool IsToolbarPinningEnabled();
267
Anunoy Ghoshb7b7eca2023-04-13 18:38:23268#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
269BASE_DECLARE_FEATURE(kUpdateTextOptions);
270extern const base::FeatureParam<int> kUpdateTextOptionNumber;
271#endif
272
Yann Dago16b94d62024-01-29 19:44:29273BASE_DECLARE_FEATURE(kEnterpriseProfileBadging);
Yann Dagofd4102d2024-09-27 17:15:04274BASE_DECLARE_FEATURE(kEnterpriseProfileBadgingPolicies);
Yann Dago5c6d4b22024-04-12 19:53:29275BASE_DECLARE_FEATURE(kEnterpriseUpdatedProfileCreationScreen);
Yann Dago16b94d62024-01-29 19:44:29276
Daniel Cheng0b6369f2022-09-20 17:59:39277BASE_DECLARE_FEATURE(kWebUITabStrip);
Collin Baker33a13f52019-12-13 00:30:23278
Tombae388942021-08-17 02:44:00279// Controls whether the context menu is shown on a touch press or a touch
280// tap gesture on the WebUI Tab Strip.
Daniel Cheng0b6369f2022-09-20 17:59:39281BASE_DECLARE_FEATURE(kWebUITabStripContextMenuAfterTap);
Tombae388942021-08-17 02:44:00282
Keren Zhu5680b21d2021-05-14 19:01:07283// Cocoa to views migration.
Xiaohan Wange9439fd2022-01-18 21:00:31284#if BUILDFLAG(IS_MAC)
Daniel Cheng0b6369f2022-09-20 17:59:39285BASE_DECLARE_FEATURE(kViewsFirstRunDialog);
Daniel Cheng0b6369f2022-09-20 17:59:39286BASE_DECLARE_FEATURE(kViewsJSAppModalDialog);
Keren Zhu5680b21d2021-05-14 19:01:07287#endif
288
揚帆起航7e91f81c2022-09-27 20:00:46289BASE_DECLARE_FEATURE(kStopLoadingAnimationForHiddenWindow);
Alex Attaree691b92022-09-26 20:37:57290
Tom Anderson72a68662024-07-10 16:35:45291#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
292BASE_DECLARE_FEATURE(kUsePortalAccentColor);
293#endif
294
dljames1bedc20c2024-07-25 18:03:36295// This feature introduces a toggle that allows users to switch between the
296// standard UI and a compact version of the UI by right clicking the empty area
297// in the Tabstrip.
298BASE_DECLARE_FEATURE(kCompactMode);
Lia Hiscock3c59c0d22024-09-12 22:57:19299
300// Controls whether the site-specific data dialog shows a related installed
301// applications section.
302BASE_DECLARE_FEATURE(kPageSpecificDataDialogRelatedInstalledAppsSection);
303
Charlene Yan0724dc562019-04-12 17:57:41304} // namespace features
305
306#endif // CHROME_BROWSER_UI_UI_FEATURES_H_