1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439
|
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file defines the browser-specific base::FeatureList features that are
// limited to top chrome UI.
#ifndef CHROME_BROWSER_UI_UI_FEATURES_H_
#define CHROME_BROWSER_UI_UI_FEATURES_H_
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "build/branding_buildflags.h"
#include "build/build_config.h"
#include "chrome/common/buildflags.h"
#include "extensions/buildflags/buildflags.h"
namespace features {
// All features in alphabetical order. The features should be documented
// alongside the definition of their values in the .cc file.
// TODO(crbug.com/40598679): Remove this when the tab dragging
// interactive_ui_tests pass on Wayland.
BASE_DECLARE_FEATURE(kAllowWindowDragUsingSystemDragDrop);
BASE_DECLARE_FEATURE(kAllowEyeDropperWGCScreenCapture);
BASE_DECLARE_FEATURE(kCloseOmniboxPopupOnInactiveAreaClick);
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX)
BASE_DECLARE_FEATURE(kFewerUpdateConfirmations);
#endif
#if BUILDFLAG(ENABLE_EXTENSIONS)
// Controls how extensions show up in the main menu. When enabled, if the
// current profile has no extensions, instead of a full extensions submenu, only
// the "Discover Chrome Extensions" item will be present.
BASE_DECLARE_FEATURE(kExtensionsCollapseMainMenu);
#endif // BUILDFLAG(ENABLE_EXTENSIONS)
#if BUILDFLAG(IS_WIN)
BASE_DECLARE_FEATURE(kOfferPinToTaskbarWhenSettingToDefault);
BASE_DECLARE_FEATURE(kOfferPinToTaskbarInFirstRunExperience);
BASE_DECLARE_FEATURE(kOfferPinToTaskbarInfoBar);
#endif
#if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
BASE_DECLARE_FEATURE(kPdfInfoBar);
enum class PdfInfoBarTrigger { kPdfLoad = 0, kStartup = 1 };
inline constexpr base::FeatureParam<PdfInfoBarTrigger>::Option
kPdfInfoBarTriggerOptions[] = {{PdfInfoBarTrigger::kPdfLoad, "pdf-load"},
{PdfInfoBarTrigger::kStartup, "startup"}};
inline constexpr base::FeatureParam<PdfInfoBarTrigger> kPdfInfoBarTrigger(
&kPdfInfoBar,
"trigger",
PdfInfoBarTrigger::kPdfLoad,
&kPdfInfoBarTriggerOptions);
#endif // BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC)
BASE_DECLARE_FEATURE(kPreloadTopChromeWebUI);
// This enum entry values must be in sync with
// WebUIContentsPreloadManager::PreloadMode.
enum class PreloadTopChromeWebUIMode {
kPreloadOnWarmup = 0,
kPreloadOnMakeContents = 1
};
inline constexpr char kPreloadTopChromeWebUIModeName[] = "preload-mode";
inline constexpr char kPreloadTopChromeWebUIModePreloadOnWarmupName[] =
"preload-on-warmup";
inline constexpr char kPreloadTopChromeWebUIModePreloadOnMakeContentsName[] =
"preload-on-make-contents";
inline constexpr base::FeatureParam<PreloadTopChromeWebUIMode>::Option
kPreloadTopChromeWebUIModeOptions[] = {
{PreloadTopChromeWebUIMode::kPreloadOnWarmup,
kPreloadTopChromeWebUIModePreloadOnWarmupName},
{PreloadTopChromeWebUIMode::kPreloadOnMakeContents,
kPreloadTopChromeWebUIModePreloadOnMakeContentsName}};
inline constexpr base::FeatureParam<PreloadTopChromeWebUIMode>
kPreloadTopChromeWebUIMode(
&kPreloadTopChromeWebUI,
kPreloadTopChromeWebUIModeName,
PreloadTopChromeWebUIMode::kPreloadOnWarmup,
&kPreloadTopChromeWebUIModeOptions);
// If smart preload is enabled, the preload WebUI is determined by historical
// engagement scores and whether a WebUI is currently being shown.
// If disabled, always preload Tab Search.
inline constexpr char kPreloadTopChromeWebUISmartPreloadName[] =
"smart-preload";
inline constexpr base::FeatureParam<bool> kPreloadTopChromeWebUISmartPreload(
&kPreloadTopChromeWebUI,
kPreloadTopChromeWebUISmartPreloadName,
true);
// If delay preload is enabled, the preloading is delayed until the first
// non empty paint of an observed web contents.
//
// In case of browser startup, the observed web contents is the active web
// contents of the last created browser.
//
// In case of Request() is called, the requested web contents is observed.
//
// In case of web contents destroy, the preloading simply waits for a fixed
// amount of time.
inline constexpr char kPreloadTopChromeWebUIDelayPreloadName[] =
"delay-preload";
inline constexpr base::FeatureParam<bool> kPreloadTopChromeWebUIDelayPreload(
&kPreloadTopChromeWebUI,
kPreloadTopChromeWebUIDelayPreloadName,
true);
// An list of exclude origins for WebUIs that don't participate in preloading.
// The list is a string of format "<origin>,<origin2>,...,<origin-n>", where
// each <origin> is a WebUI origin, e.g. "chrome://tab-search.top-chrome". This
// is used for emergency preloading shutoff for problematic WebUIs.
inline constexpr char kPreloadTopChromeWebUIExcludeOriginsName[] =
"exclude-origins";
inline constexpr base::FeatureParam<std::string>
kPreloadTopChromeWebUIExcludeOrigins(
&kPreloadTopChromeWebUI,
kPreloadTopChromeWebUIExcludeOriginsName,
"");
BASE_DECLARE_FEATURE(kPreloadTopChromeWebUILessNavigations);
#if !BUILDFLAG(IS_ANDROID)
BASE_DECLARE_FEATURE(kPressAndHoldEscToExitBrowserFullscreen);
#endif
BASE_DECLARE_FEATURE(kScrimForBrowserWindowModal);
BASE_DECLARE_FEATURE(KScrimForTabModal);
BASE_DECLARE_FEATURE(kSideBySide);
BASE_DECLARE_FEATURE_PARAM(base::TimeDelta, kSideBySideShowDropTargetDelay);
BASE_DECLARE_FEATURE_PARAM(int, kSideBySideDropTargetInnerPadding);
enum class MiniToolbarActiveConfiguration {
// Hides the toolbar in the active view.
Hide,
// Shows only the menu button in the active view.
ShowMenuOnly,
// Shows favicon, domain, alerts and menu button in the active view.
ShowAll
};
BASE_DECLARE_FEATURE_PARAM(MiniToolbarActiveConfiguration,
kSideBySideMiniToolbarActiveConfiguration);
BASE_DECLARE_FEATURE(kSideBySideLinkMenuNewBadge);
bool IsNtpFooterEnabledWithoutSideBySide();
BASE_DECLARE_FEATURE(kTabDuplicateMetrics);
BASE_DECLARE_FEATURE(kTabScrollingButtonPosition);
inline constexpr char kTabScrollingButtonPositionParameterName[] =
"buttonPosition";
BASE_DECLARE_FEATURE(kSidePanelResizing);
BASE_DECLARE_FEATURE(kSidePanelSearchCompanion);
BASE_DECLARE_FEATURE(kTabGroupsCollapseFreezing);
BASE_DECLARE_FEATURE(kTabHoverCardImages);
// These parameters control how long the hover card system waits before
// requesting a preview image from a tab where no preview image is available.
// Values are in ms.
inline constexpr char kTabHoverCardImagesNotReadyDelayParameterName[] =
"page_not_ready_delay";
inline constexpr char kTabHoverCardImagesLoadingDelayParameterName[] =
"page_loading_delay";
inline constexpr char kTabHoverCardImagesLoadedDelayParameterName[] =
"page_loaded_delay";
// Determines how long to wait during a hover card slide transition before a
// placeholder image is displayed via crossfade.
// -1: disable crossfade entirely
// 0: show placeholder immediately
// 1: show placeholder when the card lands on the new tab
// between 0 and 1: show at a percentage of transition
//
// Note: crossfade is automatically disabled if animations are disabled at the
// OS level (e.g. for accessibility).
inline constexpr char kTabHoverCardImagesCrossfadePreviewAtParameterName[] =
"crossfade_preview_at";
// Adds an amount of time (in ms) to the show delay when tabs are max width -
// typically when there are less than 5 or 6 tabs in a browser window.
inline constexpr char kTabHoverCardAdditionalMaxWidthDelay[] =
"additional_max_width_delay";
BASE_DECLARE_FEATURE(kTabOrganization);
bool IsTabOrganization();
BASE_DECLARE_FEATURE(kTabstripDeclutter);
bool IsTabstripDeclutterEnabled();
BASE_DECLARE_FEATURE(kTabstripDedupe);
bool IsTabstripDedupeEnabled();
BASE_DECLARE_FEATURE(kTabOrganizationAppMenuItem);
BASE_DECLARE_FEATURE(kTabOrganizationModelStrategy);
BASE_DECLARE_FEATURE(kTabOrganizationEnableNudgeForEnterprise);
BASE_DECLARE_FEATURE(kTabOrganizationUserInstruction);
// Duration of inactivity after which a tab is considered stale for declutter.
inline constexpr base::FeatureParam<base::TimeDelta>
kTabstripDeclutterStaleThresholdDuration(&kTabstripDeclutter,
"stale_threshold_duration",
base::Days(7));
// Interval between a recomputation of stale tabs for declutter.
inline constexpr base::FeatureParam<base::TimeDelta>
kTabstripDeclutterTimerInterval(&kTabstripDeclutter,
"declutter_timer_interval",
base::Minutes(10));
// Default interval after showing a nudge to prevent another nudge from being
// shown for declutter.
inline constexpr base::FeatureParam<base::TimeDelta>
kTabstripDeclutterNudgeTimerInterval(&kTabstripDeclutter,
"nudge_timer_interval",
base::Minutes(6 * 60));
// The target (and minimum) interval between proactive nudge triggers. Measured
// against a clock that only runs while Chrome is in the foreground.
inline constexpr base::FeatureParam<base::TimeDelta>
kTabOrganizationTriggerPeriod(&kTabOrganization,
"trigger_period",
base::Hours(6));
// The base to use for the trigger logic's exponential backoff.
inline constexpr base::FeatureParam<double>
kTabOrganizationTriggerBackoffBase(&kTabOrganization, "backoff_base", 2.0);
// The minimum score threshold for proactive nudge triggering to occur.
inline constexpr base::FeatureParam<double> kTabOrganizationTriggerThreshold(
&kTabOrganization,
"trigger_threshold",
7.0);
// The maximum sensitivity score for a tab to contribute to trigger scoring.
inline constexpr base::FeatureParam<double>
kTabOrganizationTriggerSensitivityThreshold(&kTabOrganization,
"trigger_sensitivity_threshold",
0.5);
// Enable 'demo mode' for Tab Organization triggering, which triggers much more
// predictably and frequently.
inline constexpr base::FeatureParam<bool> KTabOrganizationTriggerDemoMode(
&kTabOrganization,
"trigger_demo_mode",
false);
BASE_DECLARE_FEATURE(kTearOffWebAppTabOpensWebAppWindow);
#if !BUILDFLAG(IS_ANDROID)
// Enables a three-button password save dialog variant (essentially adding a
// "not now" button alongside "never").
BASE_DECLARE_FEATURE(kThreeButtonPasswordSaveDialog);
#endif
bool IsToolbarPinningEnabled();
BASE_DECLARE_FEATURE(kPinnedCastButton);
BASE_DECLARE_FEATURE(kEnterpriseProfileBadgingForAvatar);
BASE_DECLARE_FEATURE(kEnterpriseProfileBadgingForMenu);
BASE_DECLARE_FEATURE(kEnterpriseBadgingForNtpFooter);
BASE_DECLARE_FEATURE(kNTPFooterBadgingPolicies);
BASE_DECLARE_FEATURE(kEnterpriseProfileBadgingPolicies);
BASE_DECLARE_FEATURE(kEnterpriseManagementDisclaimerUsesCustomLabel);
BASE_DECLARE_FEATURE(kEnterpriseUpdatedProfileCreationScreen);
BASE_DECLARE_FEATURE(kManagedProfileRequiredInterstitial);
// Enables using the same colors used for the default app menu button for the
// avatar button states using default colors.
BASE_DECLARE_FEATURE(kEnableAppMenuButtonColorsForDefaultAvatarButtonStates);
BASE_DECLARE_FEATURE(kWebUITabStrip);
// Controls whether the context menu is shown on a touch press or a touch
// tap gesture on the WebUI Tab Strip.
BASE_DECLARE_FEATURE(kWebUITabStripContextMenuAfterTap);
// Cocoa to views migration.
#if BUILDFLAG(IS_MAC)
BASE_DECLARE_FEATURE(kViewsFirstRunDialog);
BASE_DECLARE_FEATURE(kViewsJSAppModalDialog);
#endif
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
BASE_DECLARE_FEATURE(kUsePortalAccentColor);
#endif
// Controls whether the site-specific data dialog shows a related installed
// applications section.
BASE_DECLARE_FEATURE(kPageSpecificDataDialogRelatedInstalledAppsSection);
// Feature for the promotion banner on the top of chrome://management page
BASE_DECLARE_FEATURE(kEnableManagementPromotionBanner);
// Enable display for the Chrome Enterprise Core promotion banner on
// the chrome://policy page.
BASE_DECLARE_FEATURE(kEnablePolicyPromotionBanner);
// Controls whether a performance improvement in browser feature support
// checking is enabled.
BASE_DECLARE_FEATURE(kInlineFullscreenPerfExperiment);
// Controls whether the new page actions framework should be displaying page
// actions.
BASE_DECLARE_FEATURE(kPageActionsMigration);
// For development only, set this to enable all page actions.
inline constexpr base::FeatureParam<bool>
kPageActionsMigrationEnableAll(&kPageActionsMigration, "enable_all", false);
// The following feature params indicate whether individual features should
// have their page actions controlled using the new framework.
inline constexpr base::FeatureParam<bool> kPageActionsMigrationLensOverlay(
&kPageActionsMigration,
"lens_overlay",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationMemorySaver(
&kPageActionsMigration,
"memory_saver",
false);
inline constexpr base::FeatureParam<bool>
kPageActionsMigrationTranslate(&kPageActionsMigration, "translate", false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationIntentPicker(
&kPageActionsMigration,
"intent_picker",
false);
inline constexpr base::FeatureParam<bool>
kPageActionsMigrationZoom(&kPageActionsMigration, "zoom", false);
inline constexpr base::FeatureParam<bool>
kPageActionsMigrationOfferNotification(&kPageActionsMigration,
"offer_notification",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationFileSystemAccess(
&kPageActionsMigration,
"file_system_access",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationPwaInstall(
&kPageActionsMigration,
"pwa_install",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationPriceInsights(
&kPageActionsMigration,
"price_insights",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationManagePasswords(
&kPageActionsMigration,
"manage_passwords",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationCookieControls(
&kPageActionsMigration,
"cookie_controls",
false);
inline constexpr base::FeatureParam<bool> kPageActionsMigrationAutofillAddress(
&kPageActionsMigration,
"autofill_address",
false);
// Determines whether the "save password" page action displays different UI if
// the user has said to never save passwords for that site.
BASE_DECLARE_FEATURE(kSavePasswordsContextualUi);
// Controls whether browser tab loading animations are driven by the compositor
// vs. a repeating timer.
BASE_DECLARE_FEATURE(kCompositorLoadingAnimations);
// If enabled, the by date history will show in the side panel.
BASE_DECLARE_FEATURE(kByDateHistoryInSidePanel);
// Controls whether to use the TabStrip browser api's controller.
BASE_DECLARE_FEATURE(kTabStripBrowserApi);
// Controls where tab search lives in the browser.
BASE_DECLARE_FEATURE(kTabstripComboButton);
BASE_DECLARE_FEATURE(kLaunchedTabSearchToolbarButton);
inline constexpr base::FeatureParam<bool> kTabstripComboButtonHasBackground(
&kTabstripComboButton,
"has_background",
false);
inline constexpr base::FeatureParam<bool>
kTabstripComboButtonHasReverseButtonOrder(&kTabstripComboButton,
"reverse_button_order",
false);
inline constexpr base::FeatureParam<bool> kTabSearchToolbarButton(
&kTabstripComboButton,
"tab_search_toolbar_button",
false);
bool IsTabSearchMoving();
bool HasTabstripComboButtonWithBackground();
bool HasTabstripComboButtonWithReverseButtonOrder();
bool HasTabSearchToolbarButton();
} // namespace features
#endif // CHROME_BROWSER_UI_UI_FEATURES_H_
|