1 // Copyright 2015 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 "content/public/common/content_features.h"
6 #include "build/build_config.h"
7 #include "net/net_buildflags.h"
8 
9 #if defined(OS_WIN)
10 #include "base/win/windows_version.h"
11 #endif
12 
13 namespace features {
14 
15 // All features in alphabetical order.
16 
17 // Enables the allowActivationDelegation attribute on iframes.
18 // https://www.chromestatus.com/features/6025124331388928
19 //
20 // TODO(mustaq): Deprecated, see kUserActivationPostMessageTransfer.
21 const base::Feature kAllowActivationDelegationAttr{
22     "AllowActivationDelegationAttr", base::FEATURE_DISABLED_BY_DEFAULT};
23 
24 // Enables content-initiated, main frame navigations to data URLs.
25 // TODO(meacer): Remove when the deprecation is complete.
26 //               https://www.chromestatus.com/feature/5669602927312896
27 const base::Feature kAllowContentInitiatedDataUrlNavigations{
28     "AllowContentInitiatedDataUrlNavigations",
29     base::FEATURE_DISABLED_BY_DEFAULT};
30 
31 // Allows popups during page unloading.
32 // TODO(https://crbug.com/937569): Remove this entirely in Chrome 88.
33 const base::Feature kAllowPopupsDuringPageUnload{
34     "AllowPopupsDuringPageUnload", base::FEATURE_DISABLED_BY_DEFAULT};
35 
36 // Accepts Origin-Signed HTTP Exchanges to be signed with certificates
37 // that do not have CanSignHttpExchangesDraft extension.
38 // TODO(https://crbug.com/862003): Remove when certificates with
39 // CanSignHttpExchangesDraft extension are available from trusted CAs.
40 const base::Feature kAllowSignedHTTPExchangeCertsWithoutExtension{
41     "AllowSignedHTTPExchangeCertsWithoutExtension",
42     base::FEATURE_DISABLED_BY_DEFAULT};
43 
44 // Launches the audio service on the browser startup.
45 const base::Feature kAudioServiceLaunchOnStartup{
46     "AudioServiceLaunchOnStartup", base::FEATURE_DISABLED_BY_DEFAULT};
47 
48 // Runs the audio service in a separate process.
49 const base::Feature kAudioServiceOutOfProcess {
50   "AudioServiceOutOfProcess",
51 #if defined(OS_WIN) || defined(OS_MACOSX) || \
52     (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_BSD)
53       base::FEATURE_ENABLED_BY_DEFAULT
54 #else
55       base::FEATURE_DISABLED_BY_DEFAULT
56 #endif
57 };
58 
59 // Kill switch for Background Fetch.
60 const base::Feature kBackgroundFetch{"BackgroundFetch",
61                                      base::FEATURE_ENABLED_BY_DEFAULT};
62 
63 // Enable using the BackForwardCache.
64 const base::Feature kBackForwardCache{"BackForwardCache",
65                                       base::FEATURE_DISABLED_BY_DEFAULT};
66 
67 // BackForwardCache is disabled on low memory devices. The threshold is defined
68 // via a field trial param: "memory_threshold_for_back_forward_cache_in_mb"
69 // It is compared against base::SysInfo::AmountOfPhysicalMemoryMB().
70 
71 // "BackForwardCacheMemoryControls" is checked before "BackForwardCache". It
72 // means the low memory devices will activate neither the control group nor the
73 // experimental group of the BackForwardCache field trial.
74 const base::Feature kBackForwardCacheMemoryControl{
75     "BackForwardCacheMemoryControls", base::FEATURE_DISABLED_BY_DEFAULT};
76 
77 // Block subresource requests whose URLs contain embedded credentials (e.g.
78 // `https://user:pass@example.com/resource`).
79 const base::Feature kBlockCredentialedSubresources{
80     "BlockCredentialedSubresources", base::FEATURE_ENABLED_BY_DEFAULT};
81 
82 // Use ThreadPriority::DISPLAY for browser UI and IO threads.
83 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
84 const base::Feature kBrowserUseDisplayThreadPriority{
85     "BrowserUseDisplayThreadPriority", base::FEATURE_ENABLED_BY_DEFAULT};
86 #else
87 const base::Feature kBrowserUseDisplayThreadPriority{
88     "BrowserUseDisplayThreadPriority", base::FEATURE_DISABLED_BY_DEFAULT};
89 #endif
90 
91 // When enabled, keyboard user activation will be verified by the browser side.
92 const base::Feature kBrowserVerifiedUserActivationKeyboard{
93     "BrowserVerifiedUserActivationKeyboard", base::FEATURE_DISABLED_BY_DEFAULT};
94 
95 // When enabled, mouse user activation will be verified by the browser side.
96 const base::Feature kBrowserVerifiedUserActivationMouse{
97     "BrowserVerifiedUserActivationMouse", base::FEATURE_DISABLED_BY_DEFAULT};
98 
99 // Enables code caching for inline scripts.
100 const base::Feature kCacheInlineScriptCode{"CacheInlineScriptCode",
101                                            base::FEATURE_ENABLED_BY_DEFAULT};
102 
103 // Enables support for parallel cache_storage operations via the
104 // "max_shared_ops" fieldtrial parameter.
105 const base::Feature kCacheStorageParallelOps{"CacheStorageParallelOps",
106                                              base::FEATURE_ENABLED_BY_DEFAULT};
107 
108 // Enables eagerly reading the response body in cache.match() when the
109 // operation was started from a FetchEvent handler with a matching request
110 // URL.
111 const base::Feature kCacheStorageEagerReading{
112     "CacheStorageEagerReading", base::FEATURE_DISABLED_BY_DEFAULT};
113 
114 // Enables scheduling the operation at high priority when a cache.match() is
115 // initiated from a FetchEvent handler with a matching request URL.
116 const base::Feature kCacheStorageHighPriorityMatch{
117     "CacheStorageHighPriorityMatch", base::FEATURE_ENABLED_BY_DEFAULT};
118 
119 // If Canvas2D Image Chromium is allowed, this feature controls whether it is
120 // enabled.
121 const base::Feature kCanvas2DImageChromium {
122   "Canvas2DImageChromium",
123 #if defined(OS_MACOSX)
124       base::FEATURE_ENABLED_BY_DEFAULT
125 #else
126       base::FEATURE_DISABLED_BY_DEFAULT
127 #endif
128 };
129 
130 // Enables the use of out of process rasterization for canvas.
131 const base::Feature kCanvasOopRasterization{"CanvasOopRasterization",
132                                             base::FEATURE_DISABLED_BY_DEFAULT};
133 
134 // When enabled, event.movement is calculated in blink instead of in browser.
135 const base::Feature kConsolidatedMovementXY{"ConsolidatedMovementXY",
136                                             base::FEATURE_ENABLED_BY_DEFAULT};
137 
138 // Controls whether the Conversion Measurement API is enabled.
139 const base::Feature kConversionMeasurement{"ConversionMeasurement",
140                                            base::FEATURE_DISABLED_BY_DEFAULT};
141 
142 // Show messages in the DevTools console about upcoming deprecations
143 // that would affect sent/received cookies.
144 const base::Feature kCookieDeprecationMessages{
145     "CookieDeprecationMessages", base::FEATURE_ENABLED_BY_DEFAULT};
146 
147 // Enables Blink cooperative scheduling.
148 const base::Feature kCooperativeScheduling{"CooperativeScheduling",
149                                            base::FEATURE_DISABLED_BY_DEFAULT};
150 
151 // Enables crash reporting via Reporting API.
152 // https://www.w3.org/TR/reporting/#crash-report
153 const base::Feature kCrashReporting{"CrashReporting",
154 #if BUILDFLAG(ENABLE_REPORTING)
155                                     base::FEATURE_ENABLED_BY_DEFAULT
156 #else
157                                     base::FEATURE_DISABLED_BY_DEFAULT
158 #endif
159 };
160 
161 // Puts save-data header in the holdback mode. This disables sending of
162 // save-data header to origins, and to the renderer processes within Chrome.
163 const base::Feature kDataSaverHoldback{"DataSaverHoldback",
164                                        base::FEATURE_DISABLED_BY_DEFAULT};
165 
166 // Enable changing source dynamically for desktop capture.
167 const base::Feature kDesktopCaptureChangeSource{
168     "DesktopCaptureChangeSource", base::FEATURE_ENABLED_BY_DEFAULT};
169 
170 // Enable document policy for configuring and restricting feature behavior.
171 const base::Feature kDocumentPolicy{"DocumentPolicy",
172                                     base::FEATURE_DISABLED_BY_DEFAULT};
173 
174 // If this feature is enabled and device permission is not granted by the user,
175 // media-device enumeration will provide at most one device per type and the
176 // device IDs will not be available.
177 // TODO(crbug.com/1019176): remove the feature in M82.
178 const base::Feature kEnumerateDevicesHideDeviceIDs{
179   "EnumerateDevicesHideDeviceIDs",
180 #if defined(OS_ANDROID)
181       base::FEATURE_DISABLED_BY_DEFAULT
182 #else
183       base::FEATURE_ENABLED_BY_DEFAULT
184 #endif
185 };
186 
187 // When a screen reader is detected, allow users the option of letting
188 // Google provide descriptions for unlabeled images.
189 const base::Feature kExperimentalAccessibilityLabels{
190     "ExperimentalAccessibilityLabels", base::FEATURE_ENABLED_BY_DEFAULT};
191 
192 // Throttle tasks in Blink background timer queues based on CPU budgets
193 // for the background tab. Bug: https://crbug.com/639852.
194 const base::Feature kExpensiveBackgroundTimerThrottling{
195     "ExpensiveBackgroundTimerThrottling", base::FEATURE_ENABLED_BY_DEFAULT};
196 
197 // Extra CORS safelisted headers. See https://crbug.com/999054.
198 const base::Feature kExtraSafelistedRequestHeadersForOutOfBlinkCors{
199     "ExtraSafelistedRequestHeadersForOutOfBlinkCors",
200     base::FEATURE_DISABLED_BY_DEFAULT};
201 
202 // Controls whether Client Hints are guarded by FeaturePolicy.
203 const base::Feature kFeaturePolicyForClientHints{
204     "FeaturePolicyForClientHints", base::FEATURE_DISABLED_BY_DEFAULT};
205 
206 // When enabled Feature Policy propagation is similar to sandbox flags and,
207 // sandbox flags are implemented on top of Feature Policy.
208 const base::Feature kFeaturePolicyForSandbox{"FeaturePolicyForSandbox",
209                                              base::FEATURE_DISABLED_BY_DEFAULT};
210 
211 // Enables fixes for matching src: local() for web fonts correctly against full
212 // font name or postscript name. Rolling out behind a flag, as enabling this
213 // enables a font indexer on Android which we need to test in the field first.
214 const base::Feature kFontSrcLocalMatching{"FontSrcLocalMatching",
215                                           base::FEATURE_ENABLED_BY_DEFAULT};
216 
217 #if !defined(OS_ANDROID)
218 // Feature controlling whether or not memory pressure signals will be forwarded
219 // to the GPU process.
220 const base::Feature kForwardMemoryPressureEventsToGpuProcess {
221   "ForwardMemoryPressureEventsToGpuProcess",
222 #if defined(OS_FUCHSIA) || defined(OS_WIN)
223       base::FEATURE_ENABLED_BY_DEFAULT
224 #else
225       base::FEATURE_DISABLED_BY_DEFAULT
226 #endif
227 };
228 #endif
229 
230 // Enables scrollers inside Blink to store scroll offsets in fractional
231 // floating-point numbers rather than truncating to integers.
232 const base::Feature kFractionalScrollOffsets{"FractionalScrollOffsets",
233                                              base::FEATURE_DISABLED_BY_DEFAULT};
234 
235 // Enables support for FTP URLs. When disabled FTP URLs will behave the same as
236 // any other URL scheme that's unknown to the UA. See https://crbug.com/333943
237 const base::Feature kFtpProtocol{"FtpProtocol",
238                                  base::FEATURE_ENABLED_BY_DEFAULT};
239 
240 // Puts network quality estimate related Web APIs in the holdback mode. When the
241 // holdback is enabled the related Web APIs return network quality estimate
242 // set by the experiment (regardless of the actual quality).
243 const base::Feature kNetworkQualityEstimatorWebHoldback{
244     "NetworkQualityEstimatorWebHoldback", base::FEATURE_DISABLED_BY_DEFAULT};
245 
246 // If a page does a client side redirect or adds to the history without a user
247 // gesture, then skip it on back/forward UI.
248 const base::Feature kHistoryManipulationIntervention{
249     "HistoryManipulationIntervention", base::FEATURE_ENABLED_BY_DEFAULT};
250 
251 // Prevents sandboxed iframes from using the history API to navigate frames
252 // outside their subttree, if they are restricted from doing top-level
253 // navigations.
254 const base::Feature kHistoryPreventSandboxedNavigation{
255     "HistoryPreventSandboxedNavigation", base::FEATURE_ENABLED_BY_DEFAULT};
256 
257 // This is intended as a kill switch for the Idle Detection feature. To enable
258 // this feature, the experimental web platform features flag should be set,
259 // or the site should obtain an Origin Trial token.
260 const base::Feature kIdleDetection{"IdleDetection",
261                                    base::FEATURE_ENABLED_BY_DEFAULT};
262 
263 // This flag is used to set field parameters to choose predictor we use when
264 // kResamplingInputEvents is disabled. It's used for gatherig accuracy metrics
265 // on finch and also for choosing predictor type for predictedEvents API without
266 // enabling resampling. It does not have any effect when the resampling flag is
267 // enabled.
268 const base::Feature kInputPredictorTypeChoice{
269     "InputPredictorTypeChoice", base::FEATURE_DISABLED_BY_DEFAULT};
270 
271 // Kill switch for the GetInstalledRelatedApps API.
272 const base::Feature kInstalledApp{"InstalledApp",
273                                   base::FEATURE_ENABLED_BY_DEFAULT};
274 
275 // Allow Windows specific implementation for the GetInstalledRelatedApps API.
276 const base::Feature kInstalledAppProvider{"InstalledAppProvider",
277                                           base::FEATURE_DISABLED_BY_DEFAULT};
278 
279 // Alternative to switches::kIsolateOrigins, for turning on origin isolation.
280 // List of origins to isolate has to be specified via
281 // kIsolateOriginsFieldTrialParamName.
282 const base::Feature kIsolateOrigins{"IsolateOrigins",
283                                     base::FEATURE_DISABLED_BY_DEFAULT};
284 const char kIsolateOriginsFieldTrialParamName[] = "OriginsList";
285 
286 const base::Feature kLazyFrameLoading{"LazyFrameLoading",
287                                       base::FEATURE_ENABLED_BY_DEFAULT};
288 const base::Feature kLazyFrameVisibleLoadTimeMetrics {
289   "LazyFrameVisibleLoadTimeMetrics",
290 #if defined(OS_ANDROID)
291       base::FEATURE_ENABLED_BY_DEFAULT
292 #else
293       base::FEATURE_DISABLED_BY_DEFAULT
294 #endif
295 };
296 const base::Feature kLazyImageLoading{"LazyImageLoading",
297                                       base::FEATURE_ENABLED_BY_DEFAULT};
298 const base::Feature kLazyImageVisibleLoadTimeMetrics {
299   "LazyImageVisibleLoadTimeMetrics",
300 #if defined(OS_ANDROID)
301       base::FEATURE_ENABLED_BY_DEFAULT
302 #else
303       base::FEATURE_DISABLED_BY_DEFAULT
304 #endif
305 };
306 
307 // Enable lazy initialization of the media controls.
308 const base::Feature kLazyInitializeMediaControls{
309     "LazyInitializeMediaControls", base::FEATURE_ENABLED_BY_DEFAULT};
310 
311 // Configures whether Blink on Windows 8.0 and below should use out of process
312 // API font fallback calls to retrieve a fallback font family name as opposed to
313 // using a hard-coded font lookup table.
314 const base::Feature kLegacyWindowsDWriteFontFallback{
315     "LegacyWindowsDWriteFontFallback", base::FEATURE_DISABLED_BY_DEFAULT};
316 
317 const base::Feature kLogJsConsoleMessages{"LogJsConsoleMessages",
318                                           base::FEATURE_DISABLED_BY_DEFAULT};
319 
320 // Enables lowering the priority of the resources in iframes.
321 const base::Feature kLowPriorityIframes{"LowPriorityIframes",
322                                         base::FEATURE_DISABLED_BY_DEFAULT};
323 
324 // If this feature is enabled, media-device enumerations use a cache that is
325 // invalidated upon notifications sent by base::SystemMonitor. If disabled, the
326 // cache is considered invalid on every enumeration request.
327 const base::Feature kMediaDevicesSystemMonitorCache {
328   "MediaDevicesSystemMonitorCaching",
329 #if defined(OS_MACOSX) || defined(OS_WIN)
330       base::FEATURE_ENABLED_BY_DEFAULT
331 #else
332       base::FEATURE_DISABLED_BY_DEFAULT
333 #endif
334 };
335 
336 // Enables/disables the video capture service.
337 const base::Feature kMojoVideoCapture{"MojoVideoCapture",
338                                       base::FEATURE_ENABLED_BY_DEFAULT};
339 
340 // A secondary switch used in combination with kMojoVideoCapture.
341 // This is intended as a kill switch to allow disabling the service on
342 // particular groups of devices even if they forcibly enable kMojoVideoCapture
343 // via a command-line argument.
344 const base::Feature kMojoVideoCaptureSecondary{
345     "MojoVideoCaptureSecondary", base::FEATURE_ENABLED_BY_DEFAULT};
346 
347 // When enable, iframe does not implicit capture mouse event.
348 const base::Feature kMouseSubframeNoImplicitCapture{
349     "MouseSubframeNoImplicitCapture", base::FEATURE_DISABLED_BY_DEFAULT};
350 
351 // If the network service is enabled, runs it in process.
352 const base::Feature kNetworkServiceInProcess {
353   "NetworkServiceInProcess",
354 #if defined(OS_ANDROID)
355       base::FEATURE_ENABLED_BY_DEFAULT
356 #else
357       base::FEATURE_DISABLED_BY_DEFAULT
358 #endif
359 };
360 
361 const base::Feature kNeverSlowMode{"NeverSlowMode",
362                                    base::FEATURE_DISABLED_BY_DEFAULT};
363 
364 // Kill switch for Web Notification content images.
365 const base::Feature kNotificationContentImage{"NotificationContentImage",
366                                               base::FEATURE_ENABLED_BY_DEFAULT};
367 
368 // Enables the notification trigger API.
369 const base::Feature kNotificationTriggers{"NotificationTriggers",
370                                           base::FEATURE_ENABLED_BY_DEFAULT};
371 
372 // Origin Isolation, via a header. See https://crbug.com/1042415
373 // Note that the origin policy-based variant of origin isolation is controlled
374 // by kOriginPolicy, instead.
375 const base::Feature kOriginIsolationHeader{"OriginIsolationHeader",
376                                            base::FEATURE_DISABLED_BY_DEFAULT};
377 
378 // Origin Policy. See https://crbug.com/751996
379 const base::Feature kOriginPolicy{"OriginPolicy",
380                                   base::FEATURE_DISABLED_BY_DEFAULT};
381 
382 // History navigation in response to horizontal overscroll (aka gesture-nav).
383 const base::Feature kOverscrollHistoryNavigation {
384   "OverscrollHistoryNavigation",
385 #if defined(OS_ANDROID)
386       base::FEATURE_DISABLED_BY_DEFAULT
387 #else
388       base::FEATURE_ENABLED_BY_DEFAULT
389 #endif
390 };
391 
392 // Whether document level event listeners should default 'passive' to true.
393 const base::Feature kPassiveDocumentEventListeners{
394     "PassiveDocumentEventListeners", base::FEATURE_ENABLED_BY_DEFAULT};
395 
396 // Whether document level wheel and mousewheel event listeners should default
397 // 'passive' to true.
398 const base::Feature kPassiveDocumentWheelEventListeners{
399     "PassiveDocumentWheelEventListeners", base::FEATURE_ENABLED_BY_DEFAULT};
400 
401 // Whether we should force a touchstart and first touchmove per scroll event
402 // listeners to be non-blocking during fling.
403 const base::Feature kPassiveEventListenersDueToFling{
404     "PassiveEventListenersDueToFling", base::FEATURE_ENABLED_BY_DEFAULT};
405 
406 // Whether web apps can run periodic tasks upon network connectivity.
407 const base::Feature kPeriodicBackgroundSync{"PeriodicBackgroundSync",
408                                             base::FEATURE_DISABLED_BY_DEFAULT};
409 
410 // If Pepper 3D Image Chromium is allowed, this feature controls whether it is
411 // enabled.
412 const base::Feature kPepper3DImageChromium {
413   "Pepper3DImageChromium",
414 #if defined(OS_MACOSX)
415       base::FEATURE_ENABLED_BY_DEFAULT
416 #else
417       base::FEATURE_DISABLED_BY_DEFAULT
418 #endif
419 };
420 
421 // Kill-switch to introduce a compatibility breaking restriction.
422 const base::Feature kPepperCrossOriginRedirectRestriction{
423     "PepperCrossOriginRedirectRestriction", base::FEATURE_ENABLED_BY_DEFAULT};
424 
425 // Whether we should composite a PLSA even if it means losing lcd text.
426 const base::Feature kPreferCompositingToLCDText = {
427     "PreferCompositingToLCDText", base::FEATURE_DISABLED_BY_DEFAULT};
428 
429 // Enables process sharing for sites that do not require a dedicated process
430 // by using a default SiteInstance. Default SiteInstances will only be used
431 // on platforms that do not use full site isolation.
432 // Note: This feature is mutally exclusive with
433 // kProcessSharingWithStrictSiteInstances. Only one of these should be enabled
434 // at a time.
435 const base::Feature kProcessSharingWithDefaultSiteInstances{
436     "ProcessSharingWithDefaultSiteInstances", base::FEATURE_ENABLED_BY_DEFAULT};
437 
438 // Whether cross-site frames should get their own SiteInstance even when
439 // strict site isolation is disabled. These SiteInstances will still be
440 // grouped into a shared default process based on BrowsingInstance.
441 const base::Feature kProcessSharingWithStrictSiteInstances{
442     "ProcessSharingWithStrictSiteInstances", base::FEATURE_DISABLED_BY_DEFAULT};
443 
444 // Under this flag bootstrap (aka startup) tasks will be prioritized. This flag
445 // is used by various modules to determine whether special scheduling
446 // arrangements need to be made to prioritize certain tasks.
447 const base::Feature kPrioritizeBootstrapTasks = {
448     "PrioritizeBootstrapTasks", base::FEATURE_ENABLED_BY_DEFAULT};
449 
450 // Enable the ProactivelySwapBrowsingInstance experiment. A browsing instance
451 // represents a set of frames that can script each other. Currently, Chrome does
452 // not always switch BrowsingInstance when navigating in between two unrelated
453 // pages. This experiment makes Chrome swap BrowsingInstances for cross-site
454 // HTTP(S) navigations when the BrowsingInstance doesn't contain any other
455 // windows.
456 const base::Feature kProactivelySwapBrowsingInstance{
457     "ProactivelySwapBrowsingInstance", base::FEATURE_DISABLED_BY_DEFAULT};
458 
459 // Reduce the amount of information in the default 'referer' header for
460 // cross-origin requests.
461 const base::Feature kReducedReferrerGranularity{
462     "ReducedReferrerGranularity", base::FEATURE_DISABLED_BY_DEFAULT};
463 
464 // Controls whether FileURLLoaderFactory can fetch additional files based on the
465 // isolated world's origin. This feature is disabled by default because we want
466 // content scripts to have the same permissions as the page they are injected
467 // into. This feature makes it possible to quickly revert to earlier permissive
468 // behavior if significant regressions are detected. See
469 // https://crbug.com/1049604.
470 const base::Feature kRelaxIsolatedWorldCorsInFileUrlLoaderFactory = {
471     "RelaxIsolatedWorldCorsInFileUrlLoaderFactory",
472     base::FEATURE_DISABLED_BY_DEFAULT};
473 
474 // Causes hidden tabs with crashed subframes to be marked for reload, meaning
475 // that if a user later switches to that tab, the current page will be
476 // reloaded.  This will hide crashed subframes from the user at the cost of
477 // extra reloads.
478 const base::Feature kReloadHiddenTabsWithCrashedSubframes {
479   "ReloadHiddenTabsWithCrashedSubframes",
480 #if defined(OS_ANDROID)
481       base::FEATURE_ENABLED_BY_DEFAULT
482 #else
483       base::FEATURE_DISABLED_BY_DEFAULT
484 #endif
485 };
486 
487 // RenderDocument:
488 //
489 // Currently, a RenderFrameHost represents neither a frame nor a document, but a
490 // frame in a given process. A new one is created after a different-process
491 // navigation. The goal of RenderDocument is to get a new one for each document
492 // instead.
493 //
494 // Design doc: https://bit.ly/renderdocument
495 // Main bug tracker: https://crbug.com/936696
496 
497 // Enable using the RenderDocument.
498 const base::Feature kRenderDocument{"RenderDocument",
499                                     base::FEATURE_DISABLED_BY_DEFAULT};
500 
501 const base::Feature kRequestUnbufferedDispatch{
502     "RequestUnbufferedDispatch", base::FEATURE_ENABLED_BY_DEFAULT};
503 
504 // Enables resampling input events on main thread.
505 const base::Feature kResamplingInputEvents{"ResamplingInputEvents",
506                                            base::FEATURE_DISABLED_BY_DEFAULT};
507 
508 // Run video capture service in the Browser process as opposed to a dedicated
509 // utility process
510 const base::Feature kRunVideoCaptureServiceInBrowserProcess{
511     "RunVideoCaptureServiceInBrowserProcess",
512     base::FEATURE_DISABLED_BY_DEFAULT};
513 
514 // Enables saving pages as Web Bundle.
515 const base::Feature kSavePageAsWebBundle{"SavePageAsWebBundle",
516                                          base::FEATURE_DISABLED_BY_DEFAULT};
517 
518 // Start streaming scripts on script preload.
519 const base::Feature kScriptStreamingOnPreload{"ScriptStreamingOnPreload",
520                                               base::FEATURE_ENABLED_BY_DEFAULT};
521 
522 // Make sendBeacon throw for a Blob with a non simple type.
523 const base::Feature kSendBeaconThrowForBlobWithNonSimpleType{
524     "SendBeaconThrowForBlobWithNonSimpleType",
525     base::FEATURE_DISABLED_BY_DEFAULT};
526 
527 // If enabled, ServiceWorkerContextCore lives on the UI thread rather than the
528 // IO thread.
529 // https://crbug.com/824858
530 const base::Feature kServiceWorkerOnUI{"ServiceWorkerOnUI",
531                                        base::FEATURE_DISABLED_BY_DEFAULT};
532 
533 // Service worker based payment apps as defined by w3c here:
534 // https://w3c.github.io/webpayments-payment-apps-api/
535 // TODO(rouslan): Remove this.
536 const base::Feature kServiceWorkerPaymentApps{"ServiceWorkerPaymentApps",
537                                               base::FEATURE_ENABLED_BY_DEFAULT};
538 
539 // If enabled, prefer to start service workers in an unused renderer process if
540 // available. This helps let navigations and service workers use the same
541 // process when a process was already created for a navigation but not yet
542 // claimed by it (as is common for navigations from the Android New Tab Page).
543 const base::Feature kServiceWorkerPrefersUnusedProcess{
544     "ServiceWorkerPrefersUnusedProcess", base::FEATURE_DISABLED_BY_DEFAULT};
545 
546 // Use this feature to experiment terminating a service worker when it doesn't
547 // control any clients: https://crbug.com/1043845.
548 const base::Feature kServiceWorkerTerminationOnNoControllee{
549     "ServiceWorkerTerminationOnNoControllee",
550     base::FEATURE_DISABLED_BY_DEFAULT};
551 
552 // http://tc39.github.io/ecmascript_sharedmem/shmem.html
553 const base::Feature kSharedArrayBuffer {
554   "SharedArrayBuffer",
555 #if defined(OS_ANDROID)
556       base::FEATURE_DISABLED_BY_DEFAULT
557 #else
558       base::FEATURE_ENABLED_BY_DEFAULT
559 #endif
560 };
561 
562 // Signed HTTP Exchange prefetch cache for navigations
563 // https://crbug.com/968427
564 const base::Feature kSignedExchangePrefetchCacheForNavigations{
565     "SignedExchangePrefetchCacheForNavigations",
566     base::FEATURE_DISABLED_BY_DEFAULT};
567 
568 // Signed Exchange Reporting for distributors
569 // https://www.chromestatus.com/features/5687904902840320
570 const base::Feature kSignedExchangeReportingForDistributors{
571     "SignedExchangeReportingForDistributors", base::FEATURE_ENABLED_BY_DEFAULT};
572 
573 // Subresource prefetching+loading via Signed HTTP Exchange
574 // https://www.chromestatus.com/features/5126805474246656
575 const base::Feature kSignedExchangeSubresourcePrefetch{
576     "SignedExchangeSubresourcePrefetch", base::FEATURE_DISABLED_BY_DEFAULT};
577 
578 // Origin-Signed HTTP Exchanges (for WebPackage Loading)
579 // https://www.chromestatus.com/features/5745285984681984
580 const base::Feature kSignedHTTPExchange{"SignedHTTPExchange",
581                                         base::FEATURE_ENABLED_BY_DEFAULT};
582 
583 // Whether to send a ping to the inner URL upon navigation or not.
584 const base::Feature kSignedHTTPExchangePingValidity{
585     "SignedHTTPExchangePingValidity", base::FEATURE_DISABLED_BY_DEFAULT};
586 
587 // This is intended as a kill switch for the SMS Receiver feature. To enable
588 // this feature, the experimental web platform features flag should be set,
589 // or the site should obtain an Origin Trial token.
590 const base::Feature kSmsReceiver{"SmsReceiver",
591                                  base::FEATURE_ENABLED_BY_DEFAULT};
592 
593 // Controls whether SpareRenderProcessHostManager tries to always have a warm
594 // spare renderer process around for the most recently requested BrowserContext.
595 // This feature is only consulted in site-per-process mode.
596 const base::Feature kSpareRendererForSitePerProcess{
597     "SpareRendererForSitePerProcess", base::FEATURE_ENABLED_BY_DEFAULT};
598 
599 // Enables Storage Pressure notifications and settings pages.
600 const base::Feature kStoragePressureUI{"StoragePressureUI",
601                                        base::FEATURE_DISABLED_BY_DEFAULT};
602 
603 // Enables the out-of-process Storage Service.
604 const base::Feature kStorageServiceOutOfProcess{
605     "StorageServiceOutOfProcess", base::FEATURE_DISABLED_BY_DEFAULT};
606 
607 // Enables the Storage Service sandbox whenever out-of-process Storage Service
608 // is enabled.
609 const base::Feature kStorageServiceSandbox{"StorageServiceSandbox",
610                                            base::FEATURE_DISABLED_BY_DEFAULT};
611 
612 // Controls whether site isolation should use origins instead of scheme and
613 // eTLD+1.
614 const base::Feature kStrictOriginIsolation{"StrictOriginIsolation",
615                                            base::FEATURE_DISABLED_BY_DEFAULT};
616 
617 // Dispatch touch events to "SyntheticGestureController" for events from
618 // Devtool Protocol Input.dispatchTouchEvent to simulate touch events close to
619 // real OS events.
620 const base::Feature kSyntheticPointerActions{"SyntheticPointerActions",
621                                              base::FEATURE_DISABLED_BY_DEFAULT};
622 
623 // Throttle Blink timers in out-of-view cross origin frames.
624 const base::Feature kTimerThrottlingForHiddenFrames{
625     "TimerThrottlingForHiddenFrames", base::FEATURE_ENABLED_BY_DEFAULT};
626 
627 // Enables async touchpad pinch zoom events. We check the ACK of the first
628 // synthetic wheel event in a pinch sequence, then send the rest of the
629 // synthetic wheel events of the pinch sequence as non-blocking if the first
630 // event’s ACK is not canceled.
631 const base::Feature kTouchpadAsyncPinchEvents{"TouchpadAsyncPinchEvents",
632                                               base::FEATURE_ENABLED_BY_DEFAULT};
633 
634 // Allows swipe left/right from touchpad change browser navigation. Currently
635 // only enabled by default on CrOS.
636 const base::Feature kTouchpadOverscrollHistoryNavigation {
637   "TouchpadOverscrollHistoryNavigation",
638 #if defined(OS_CHROMEOS) || defined(OS_WIN)
639       base::FEATURE_ENABLED_BY_DEFAULT
640 #else
641       base::FEATURE_DISABLED_BY_DEFAULT
642 #endif
643 };
644 
645 // Controls whether the Trusted Types API is available.
646 const base::Feature kTrustedDOMTypes{"TrustedDOMTypes",
647                                      base::FEATURE_ENABLED_BY_DEFAULT};
648 
649 // Controls whether the RenderProcessHost uses its frames' priorities for
650 // determining if it should be backgrounded. When all frames associated with a
651 // RenderProcessHost are low priority, that process may be backgrounded even if
652 // those frames are visible.
653 const base::Feature kUseFramePriorityInRenderProcessHost{
654     "UseFramePriorityInRenderProcessHost", base::FEATURE_DISABLED_BY_DEFAULT};
655 
656 // Allows developers transfer user activation state to any target window in the
657 // frame tree.
658 const base::Feature kUserActivationPostMessageTransfer{
659     "UserActivationPostMessageTransfer", base::FEATURE_DISABLED_BY_DEFAULT};
660 
661 // Allows user activation propagation to all frames having the same origin as
662 // the activation notifier frame.  This is an intermediate measure before we
663 // have an iframe attribute to declaratively allow user activation propagation
664 // to subframes.
665 const base::Feature kUserActivationSameOriginVisibility{
666     "UserActivationSameOriginVisibility", base::FEATURE_ENABLED_BY_DEFAULT};
667 
668 // An experimental replacement for the `User-Agent` header, defined in
669 // https://tools.ietf.org/html/draft-west-ua-client-hints.
670 const base::Feature kUserAgentClientHint{"UserAgentClientHint",
671                                          base::FEATURE_DISABLED_BY_DEFAULT};
672 
673 // Controls whether the <video>.getVideoPlaybackQuality() API is enabled.
674 const base::Feature kVideoPlaybackQuality{"VideoPlaybackQuality",
675                                           base::FEATURE_ENABLED_BY_DEFAULT};
676 
677 // Enables V8's low memory mode for subframes. This is used only
678 // in conjunction with the --site-per-process feature.
679 const base::Feature kV8LowMemoryModeForSubframes{
680     "V8LowMemoryModeForSubframes", base::FEATURE_DISABLED_BY_DEFAULT};
681 
682 // Enables future V8 VM features
683 const base::Feature kV8VmFuture{"V8VmFuture",
684                                 base::FEATURE_DISABLED_BY_DEFAULT};
685 
686 // Enable WebAssembly baseline compilation and tier up.
687 const base::Feature kWebAssemblyBaseline{"WebAssemblyBaseline",
688 #ifdef ARCH_CPU_X86_FAMILY
689                                          base::FEATURE_ENABLED_BY_DEFAULT
690 #else
691                                          base::FEATURE_DISABLED_BY_DEFAULT
692 #endif
693 };
694 
695 // Enable WebAssembly lazy compilation (JIT on first call).
696 const base::Feature kWebAssemblyLazyCompilation{
697     "WebAssemblyLazyCompilation", base::FEATURE_DISABLED_BY_DEFAULT};
698 
699 // Enable WebAssembly SIMD.
700 // https://github.com/WebAssembly/Simd
701 const base::Feature kWebAssemblySimd{"WebAssemblySimd",
702                                      base::FEATURE_DISABLED_BY_DEFAULT};
703 
704 // Enable WebAssembly tiering (Liftoff -> TurboFan).
705 const base::Feature kWebAssemblyTiering{"WebAssemblyTiering",
706                                         base::FEATURE_ENABLED_BY_DEFAULT};
707 
708 // Enable WebAssembly threads.
709 // https://github.com/WebAssembly/threads
710 const base::Feature kWebAssemblyThreads {
711   "WebAssemblyThreads",
712 #if defined(OS_ANDROID)
713       base::FEATURE_DISABLED_BY_DEFAULT
714 #else
715       base::FEATURE_ENABLED_BY_DEFAULT
716 #endif
717 };
718 
719 // Enable WebAssembly trap handler.
720 #if (defined(OS_BSD) || defined(OS_LINUX) || defined(OS_WIN) || defined(OS_MACOSX)) && \
721     defined(ARCH_CPU_X86_64)
722 const base::Feature kWebAssemblyTrapHandler{"WebAssemblyTrapHandler",
723                                             base::FEATURE_ENABLED_BY_DEFAULT};
724 #else
725 const base::Feature kWebAssemblyTrapHandler{"WebAssemblyTrapHandler",
726                                             base::FEATURE_DISABLED_BY_DEFAULT};
727 #endif
728 
729 // Controls whether the visibility of a WebContents can be OCCLUDED. When
730 // disabled, an occluded WebContents behaves exactly like a VISIBLE WebContents.
731 const base::Feature kWebContentsOcclusion {
732   "WebContentsOcclusion",
733 #if defined(OS_MACOSX) || defined(OS_CHROMEOS) || defined(OS_WIN)
734       base::FEATURE_ENABLED_BY_DEFAULT
735 #else
736       base::FEATURE_DISABLED_BY_DEFAULT
737 #endif
738 };
739 
740 // Controls whether the WebAuthentication API is enabled:
741 // https://w3c.github.io/webauthn
742 const base::Feature kWebAuth{"WebAuthentication",
743                              base::FEATURE_ENABLED_BY_DEFAULT};
744 
745 // Controls whether CTAP2 devices can communicate via the WebAuthentication API
746 // using pairingless BLE protocol.
747 // https://w3c.github.io/webauthn
748 const base::Feature kWebAuthCable {
749   "WebAuthenticationCable",
750 #if (!defined(OS_CHROMEOS) && defined(OS_LINUX)) || defined(OS_BSD)
751       base::FEATURE_DISABLED_BY_DEFAULT
752 #else
753       base::FEATURE_ENABLED_BY_DEFAULT
754 #endif
755 };
756 
757 // Controls whether Web Bluetooth should use the new permissions backend. The
758 // new permissions backend uses ChooserContextBase, which is used by other
759 // device APIs, such as WebUSB.
760 const base::Feature kWebBluetoothNewPermissionsBackend{
761     "WebBluetoothNewPermissionsBackend", base::FEATURE_DISABLED_BY_DEFAULT};
762 
763 // Controls whether Web Bundles (Bundled HTTP Exchanges) is enabled.
764 // https://wicg.github.io/webpackage/draft-yasskin-wpack-bundled-exchanges.html
765 // When this feature is enabled, Chromium can load unsigned Web Bundles local
766 // file under file:// URL (and content:// URI on Android).
767 const base::Feature kWebBundles{"WebBundles",
768                                 base::FEATURE_DISABLED_BY_DEFAULT};
769 
770 // When this feature is enabled, Chromium will be able to load unsigned Web
771 // Bundles file under https: URL and localhost http: URL.
772 // TODO(crbug.com/1018640): Implement this feature.
773 const base::Feature kWebBundlesFromNetwork{"WebBundlesFromNetwork",
774                                            base::FEATURE_DISABLED_BY_DEFAULT};
775 
776 // If WebGL Image Chromium is allowed, this feature controls whether it is
777 // enabled.
778 const base::Feature kWebGLImageChromium{"WebGLImageChromium",
779                                         base::FEATURE_ENABLED_BY_DEFAULT};
780 
781 // Enable experimental policy-controlled features and LAPIs
782 const base::Feature kExperimentalProductivityFeatures{
783     "ExperimentalProductivityFeatures", base::FEATURE_DISABLED_BY_DEFAULT};
784 
785 // When this feature is enabled, the Web OTP API will use the User Consent
786 // API to retrieve SMSes from the Android device.
787 const base::Feature kWebOtpBackend{"kWebOtpBackend",
788                                    base::FEATURE_DISABLED_BY_DEFAULT};
789 
790 // The JavaScript API for payments on the web.
791 // TODO(rouslan): Remove this.
792 const base::Feature kWebPayments{"WebPayments",
793                                  base::FEATURE_ENABLED_BY_DEFAULT};
794 
795 // Minimal user interface experience for payments on the web.
796 const base::Feature kWebPaymentsMinimalUI{"WebPaymentsMinimalUI",
797                                           base::FEATURE_DISABLED_BY_DEFAULT};
798 
799 // Makes WebRTC use ECDSA certs by default (i.e., when no cert type was
800 // specified in JS).
801 const base::Feature kWebRtcEcdsaDefault{"WebRTC-EnableWebRtcEcdsa",
802                                         base::FEATURE_ENABLED_BY_DEFAULT};
803 
804 // Use GpuMemoryBuffer backed VideoFrames in media streams.
805 const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames{
806     "WebRTC-UseGpuMemoryBufferVideoFrames", base::FEATURE_ENABLED_BY_DEFAULT};
807 
808 // Controls whether the WebUSB API is enabled:
809 // https://wicg.github.io/webusb
810 const base::Feature kWebUsb{"WebUSB", base::FEATURE_ENABLED_BY_DEFAULT};
811 
812 // Controls whether the WebXR Device API is enabled.
813 const base::Feature kWebXr{"WebXR", base::FEATURE_ENABLED_BY_DEFAULT};
814 
815 // Enables access to AR features via the WebXR API.
816 const base::Feature kWebXrArModule{"WebXRARModule",
817                                    base::FEATURE_ENABLED_BY_DEFAULT};
818 
819 // Enables access to raycasting against estimated XR scene geometry.
820 const base::Feature kWebXrHitTest{"WebXRHitTest",
821                                   base::FEATURE_ENABLED_BY_DEFAULT};
822 
823 // Enables access to experimental WebXR features.
824 const base::Feature kWebXrIncubations{"WebXRIncubations",
825                                       base::FEATURE_DISABLED_BY_DEFAULT};
826 const base::Feature kWebXrPermissionsApi{"WebXrPermissionsApi",
827                                          base::FEATURE_DISABLED_BY_DEFAULT};
828 
829 #if defined(OS_ANDROID)
830 // Autofill Accessibility in Android.
831 // crbug.com/627860
832 const base::Feature kAndroidAutofillAccessibility{
833     "AndroidAutofillAccessibility", base::FEATURE_ENABLED_BY_DEFAULT};
834 
835 // Sets moderate binding to background renderers playing media, when enabled.
836 // Else the renderer will have strong binding.
837 const base::Feature kBackgroundMediaRendererHasModerateBinding{
838     "BackgroundMediaRendererHasModerateBinding",
839     base::FEATURE_DISABLED_BY_DEFAULT};
840 
841 // Pre-warm up the network process on browser startup.
842 const base::Feature kWarmUpNetworkProcess{"WarmUpNetworkProcess",
843                                           base::FEATURE_DISABLED_BY_DEFAULT};
844 
845 // Force display to tick at ~60Hz refresh rate.
846 const base::Feature kForce60HzRefreshRate{"Force60HzRefreshRate",
847                                           base::FEATURE_DISABLED_BY_DEFAULT};
848 
849 // Kill switch for the WebNFC feature. This feature can be enabled for all sites
850 // using the kEnableExperimentalWebPlatformFeatures flag or by a particular site
851 // if it includes an Origin Trial key.  https://w3c.github.io/web-nfc/
852 const base::Feature kWebNfc{"WebNFC", base::FEATURE_ENABLED_BY_DEFAULT};
853 #endif  // defined(OS_ANDROID)
854 
855 #if defined(OS_CHROMEOS)
856 // If this flag is enabled, Web UI pages can call DisablePolymer2() on the
857 // shared resource during setup in order to use Polymer 1. Note: Currently, this
858 // only supports one Web UI page disabling Polymer 2.
859 // TODO(crbug.com/955194): Remove this once chrome://oobe migrates off of
860 // Polymer 1.
861 const base::Feature kWebUIPolymer2Exceptions{"WebUIPolymer2Exceptions",
862                                              base::FEATURE_ENABLED_BY_DEFAULT};
863 #endif  // defined(OS_CHROMEOS)
864 
865 #if defined(OS_MACOSX)
866 // Enables caching of media devices for the purpose of enumerating them.
867 const base::Feature kDeviceMonitorMac{"DeviceMonitorMac",
868                                       base::FEATURE_ENABLED_BY_DEFAULT};
869 
870 // Enable IOSurface based screen capturer.
871 const base::Feature kIOSurfaceCapturer{"IOSurfaceCapturer",
872                                        base::FEATURE_ENABLED_BY_DEFAULT};
873 
874 const base::Feature kMacSyscallSandbox{"MacSyscallSandbox",
875                                        base::FEATURE_DISABLED_BY_DEFAULT};
876 
877 const base::Feature kMacV2GPUSandbox{"MacV2GPUSandbox",
878                                      base::FEATURE_DISABLED_BY_DEFAULT};
879 
880 // Enables retrying to obtain list of available cameras on Macbooks after
881 // restarting the video capture service if a previous attempt delivered zero
882 // cameras.
883 const base::Feature kRetryGetVideoCaptureDeviceInfos{
884     "RetryGetVideoCaptureDeviceInfos", base::FEATURE_DISABLED_BY_DEFAULT};
885 #endif  // defined(OS_MACOSX)
886 
887 #if defined(WEBRTC_USE_PIPEWIRE)
888 // Controls whether the PipeWire support for screen capturing is enabled on the
889 // Wayland display server.
890 const base::Feature kWebRtcPipeWireCapturer{"WebRTCPipeWireCapturer",
891                                             base::FEATURE_DISABLED_BY_DEFAULT};
892 #endif  // defined(WEBRTC_USE_PIPEWIRE)
893 
894 enum class VideoCaptureServiceConfiguration {
895   kEnabledForOutOfProcess,
896   kEnabledForBrowserProcess,
897   kDisabled
898 };
899 
ShouldEnableVideoCaptureService()900 bool ShouldEnableVideoCaptureService() {
901   return base::FeatureList::IsEnabled(features::kMojoVideoCapture) &&
902          base::FeatureList::IsEnabled(features::kMojoVideoCaptureSecondary);
903 }
904 
GetVideoCaptureServiceConfiguration()905 VideoCaptureServiceConfiguration GetVideoCaptureServiceConfiguration() {
906   if (!ShouldEnableVideoCaptureService())
907     return VideoCaptureServiceConfiguration::kDisabled;
908 
909 // On ChromeOS the service must run in the browser process, because parts of the
910 // code depend on global objects that are only available in the Browser process.
911 // See https://crbug.com/891961.
912 #if defined(OS_ANDROID) || defined(OS_CHROMEOS)
913   return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
914 #else
915 #if defined(OS_WIN)
916   if (base::win::GetVersion() <= base::win::Version::WIN7)
917     return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
918 #endif
919   return base::FeatureList::IsEnabled(
920              features::kRunVideoCaptureServiceInBrowserProcess)
921              ? VideoCaptureServiceConfiguration::kEnabledForBrowserProcess
922              : VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
923 #endif
924 }
925 
IsVideoCaptureServiceEnabledForOutOfProcess()926 bool IsVideoCaptureServiceEnabledForOutOfProcess() {
927   return GetVideoCaptureServiceConfiguration() ==
928          VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
929 }
930 
IsVideoCaptureServiceEnabledForBrowserProcess()931 bool IsVideoCaptureServiceEnabledForBrowserProcess() {
932   return GetVideoCaptureServiceConfiguration() ==
933          VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
934 }
935 
936 }  // namespace features
937