content_features.cc 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346
  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. #include "content/public/common/content_features.h"
  5. #include "base/feature_list.h"
  6. #include "build/build_config.h"
  7. #include "build/chromeos_buildflags.h"
  8. #include "content/common/buildflags.h"
  9. #if BUILDFLAG(IS_WIN)
  10. #include "base/win/windows_version.h"
  11. #endif
  12. namespace features {
  13. // All features in alphabetical order.
  14. // Enables content-initiated, main frame navigations to data URLs.
  15. // TODO(meacer): Remove when the deprecation is complete.
  16. // https://www.chromestatus.com/feature/5669602927312896
  17. const base::Feature kAllowContentInitiatedDataUrlNavigations{
  18. "AllowContentInitiatedDataUrlNavigations",
  19. base::FEATURE_DISABLED_BY_DEFAULT};
  20. // Allows Blink to request fonts from the Android Downloadable Fonts API through
  21. // the service implemented on the Java side.
  22. const base::Feature kAndroidDownloadableFontsMatching{
  23. "AndroidDownloadableFontsMatching", base::FEATURE_ENABLED_BY_DEFAULT};
  24. #if BUILDFLAG(IS_WIN)
  25. const base::Feature kAudioProcessHighPriorityWin{
  26. "AudioProcessHighPriorityWin", base::FEATURE_DISABLED_BY_DEFAULT};
  27. #endif
  28. // Launches the audio service on the browser startup.
  29. const base::Feature kAudioServiceLaunchOnStartup{
  30. "AudioServiceLaunchOnStartup", base::FEATURE_DISABLED_BY_DEFAULT};
  31. // Runs the audio service in a separate process.
  32. const base::Feature kAudioServiceOutOfProcess {
  33. "AudioServiceOutOfProcess",
  34. // TODO(crbug.com/1052397): Remove !IS_CHROMEOS_LACROS once lacros starts being
  35. // built with OS_CHROMEOS instead of OS_LINUX.
  36. #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || \
  37. (BUILDFLAG(IS_LINUX) && !BUILDFLAG(IS_CHROMEOS_LACROS))
  38. base::FEATURE_ENABLED_BY_DEFAULT
  39. #else
  40. base::FEATURE_DISABLED_BY_DEFAULT
  41. #endif
  42. };
  43. // Enables the audio-service sandbox. This feature has an effect only when the
  44. // kAudioServiceOutOfProcess feature is enabled.
  45. const base::Feature kAudioServiceSandbox {
  46. "AudioServiceSandbox",
  47. #if BUILDFLAG(IS_WIN) || BUILDFLAG(IS_MAC) || BUILDFLAG(IS_FUCHSIA)
  48. base::FEATURE_ENABLED_BY_DEFAULT
  49. #else
  50. base::FEATURE_DISABLED_BY_DEFAULT
  51. #endif
  52. };
  53. // The following two features, when enabled, result in the browser process only
  54. // asking the renderer process to run beforeunload handlers if it knows such
  55. // handlers are registered. The two slightly differ in what they do and how
  56. // they behave:
  57. // . `kAvoidUnnecessaryBeforeUnloadCheckPostTask` in this case content continues
  58. // to report a beforeunload handler is present (even though it isn't). When
  59. // asked to dispatch the beforeunload handler, a post task is used (rather
  60. // than going to the renderer).
  61. // . `kAvoidUnnecessaryBeforeUnloadCheckSync` in this case content does not
  62. // report a beforeunload handler is present. A ramification of this is
  63. // navigations that would normally check beforeunload handlers before
  64. // continuing will not, and navigation will synchronously continue.
  65. // Only one should be used (if both are set, the second takes precedence). The
  66. // second is unsafe for Android WebView (and thus entirely disabled via
  67. // ContentBrowserClient::SupportsAvoidUnnecessaryBeforeUnloadCheckSync()),
  68. // because the embedder may trigger reentrancy, which cannot be avoided.
  69. const base::Feature kAvoidUnnecessaryBeforeUnloadCheckPostTask{
  70. "AvoidUnnecessaryBeforeUnloadCheck", base::FEATURE_ENABLED_BY_DEFAULT};
  71. const base::Feature kAvoidUnnecessaryBeforeUnloadCheckSync{
  72. "AvoidUnnecessaryBeforeUnloadCheckSync", base::FEATURE_DISABLED_BY_DEFAULT};
  73. // Kill switch for Background Fetch.
  74. const base::Feature kBackgroundFetch{"BackgroundFetch",
  75. base::FEATURE_ENABLED_BY_DEFAULT};
  76. // Enable using the BackForwardCache.
  77. const base::Feature kBackForwardCache{"BackForwardCache",
  78. base::FEATURE_ENABLED_BY_DEFAULT};
  79. // Allows pages that created a MediaSession service to stay eligible for the
  80. // back/forward cache.
  81. const base::Feature kBackForwardCacheMediaSessionService{
  82. "BackForwardCacheMediaSessionService", base::FEATURE_DISABLED_BY_DEFAULT};
  83. // Enable back/forward cache for screen reader users. This flag should be
  84. // removed once the https://crbug.com/1271450 is resolved.
  85. const base::Feature kEnableBackForwardCacheForScreenReader{
  86. "EnableBackForwardCacheForScreenReader", base::FEATURE_ENABLED_BY_DEFAULT};
  87. // BackForwardCache is disabled on low memory devices. The threshold is defined
  88. // via a field trial param: "memory_threshold_for_back_forward_cache_in_mb"
  89. // It is compared against base::SysInfo::AmountOfPhysicalMemoryMB().
  90. // "BackForwardCacheMemoryControls" is checked before "BackForwardCache". It
  91. // means the low memory devices will activate neither the control group nor the
  92. // experimental group of the BackForwardCache field trial.
  93. // BackForwardCacheMemoryControls is enabled only on Android to disable
  94. // BackForwardCache for lower memory devices due to memory limiations.
  95. const base::Feature kBackForwardCacheMemoryControls {
  96. "BackForwardCacheMemoryControls",
  97. #if BUILDFLAG(IS_ANDROID)
  98. base::FEATURE_ENABLED_BY_DEFAULT
  99. #else
  100. base::FEATURE_DISABLED_BY_DEFAULT
  101. #endif
  102. };
  103. // When this feature is enabled, private network requests initiated from
  104. // non-secure contexts in the `public` address space are blocked.
  105. //
  106. // See also:
  107. // - https://wicg.github.io/private-network-access/#integration-fetch
  108. // - kBlockInsecurePrivateNetworkRequestsFromPrivate
  109. // - kBlockInsecurePrivateNetworkRequestsFromUnknown
  110. // - kBlockInsecurePrivateNetworkRequestsForNavigations
  111. const base::Feature kBlockInsecurePrivateNetworkRequests{
  112. "BlockInsecurePrivateNetworkRequests", base::FEATURE_ENABLED_BY_DEFAULT};
  113. // When this feature is enabled, requests to localhost initiated from non-secure
  114. // contexts in the `private` IP address space are blocked.
  115. //
  116. // See also:
  117. // - https://wicg.github.io/private-network-access/#integration-fetch
  118. // - kBlockInsecurePrivateNetworkRequests
  119. const base::Feature kBlockInsecurePrivateNetworkRequestsFromPrivate{
  120. "BlockInsecurePrivateNetworkRequestsFromPrivate",
  121. base::FEATURE_DISABLED_BY_DEFAULT};
  122. // When this feature is enabled, requests to localhost initiated from non-secure
  123. // contexts in the `unknown` IP address space are blocked.
  124. //
  125. // See also:
  126. // - kBlockInsecurePrivateNetworkRequests
  127. const base::Feature kBlockInsecurePrivateNetworkRequestsFromUnknown{
  128. "BlockInsecurePrivateNetworkRequestsFromUnknown",
  129. base::FEATURE_DISABLED_BY_DEFAULT};
  130. // Enables use of the PrivateNetworkAccessNonSecureContextsAllowed deprecation
  131. // trial. This is a necessary yet insufficient condition: documents that wish to
  132. // make use of the trial must additionally serve a valid origin trial token.
  133. const base::Feature kBlockInsecurePrivateNetworkRequestsDeprecationTrial{
  134. "BlockInsecurePrivateNetworkRequestsDeprecationTrial",
  135. base::FEATURE_ENABLED_BY_DEFAULT};
  136. // When both kBlockInsecurePrivateNetworkRequestsForNavigations and
  137. // kBlockInsecurePrivateNetworkRequests are enabled, navigations initiated
  138. // by documents in a less-private network may only target a more-private network
  139. // if the initiating context is secure.
  140. const base::Feature kBlockInsecurePrivateNetworkRequestsForNavigations{
  141. "BlockInsecurePrivateNetworkRequestsForNavigations",
  142. base::FEATURE_DISABLED_BY_DEFAULT,
  143. };
  144. // When kPrivateNetworkAccessPermissionPrompt is enabled, public secure websites
  145. // are allowed to access private insecure subresources with user's permission.
  146. const base::Feature kPrivateNetworkAccessPermissionPrompt{
  147. "PrivateNetworkRequestPermissionPrompt", base::FEATURE_DISABLED_BY_DEFAULT};
  148. // Broker file operations on disk cache in the Network Service.
  149. // This is no-op if the network service is hosted in the browser process.
  150. const base::Feature kBrokerFileOperationsOnDiskCacheInNetworkService{
  151. "BrokerFileOperationsOnDiskCacheInNetworkService",
  152. base::FEATURE_DISABLED_BY_DEFAULT};
  153. // When enabled, keyboard user activation will be verified by the browser side.
  154. const base::Feature kBrowserVerifiedUserActivationKeyboard{
  155. "BrowserVerifiedUserActivationKeyboard", base::FEATURE_DISABLED_BY_DEFAULT};
  156. // When enabled, mouse user activation will be verified by the browser side.
  157. const base::Feature kBrowserVerifiedUserActivationMouse{
  158. "BrowserVerifiedUserActivationMouse", base::FEATURE_DISABLED_BY_DEFAULT};
  159. // If Canvas2D Image Chromium is allowed, this feature controls whether it is
  160. // enabled.
  161. const base::Feature kCanvas2DImageChromium {
  162. "Canvas2DImageChromium",
  163. #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_CHROMEOS_LACROS)
  164. base::FEATURE_ENABLED_BY_DEFAULT
  165. #else
  166. base::FEATURE_DISABLED_BY_DEFAULT
  167. #endif
  168. };
  169. // Clear the window.name property for the top-level cross-site navigations that
  170. // swap BrowsingContextGroups(BrowsingInstances).
  171. const base::Feature kClearCrossSiteCrossBrowsingContextGroupWindowName{
  172. "ClearCrossSiteCrossBrowsingContextGroupWindowName",
  173. base::FEATURE_DISABLED_BY_DEFAULT};
  174. const base::Feature kClickPointerEvent{"ClickPointerEvent",
  175. base::FEATURE_ENABLED_BY_DEFAULT};
  176. const base::Feature kCompositeBGColorAnimation{
  177. "CompositeBGColorAnimation", base::FEATURE_DISABLED_BY_DEFAULT};
  178. // When enabled, code cache does not use a browsing_data filter for deletions.
  179. extern const base::Feature kCodeCacheDeletionWithoutFilter{
  180. "CodeCacheDeletionWithoutFilter", base::FEATURE_ENABLED_BY_DEFAULT};
  181. // When enabled, event.movement is calculated in blink instead of in browser.
  182. const base::Feature kConsolidatedMovementXY{"ConsolidatedMovementXY",
  183. base::FEATURE_ENABLED_BY_DEFAULT};
  184. // Enables Blink cooperative scheduling.
  185. const base::Feature kCooperativeScheduling{"CooperativeScheduling",
  186. base::FEATURE_DISABLED_BY_DEFAULT};
  187. // Enables crash reporting via Reporting API.
  188. // https://www.w3.org/TR/reporting/#crash-report
  189. const base::Feature kCrashReporting{"CrashReporting",
  190. base::FEATURE_ENABLED_BY_DEFAULT};
  191. // Enables support for the `Critical-CH` response header.
  192. // https://github.com/WICG/client-hints-infrastructure/blob/master/reliability.md#critical-ch
  193. const base::Feature kCriticalClientHint{"CriticalClientHint",
  194. base::FEATURE_ENABLED_BY_DEFAULT};
  195. // Enable debugging the issue crbug.com/1201355
  196. const base::Feature kDebugHistoryInterventionNoUserActivation{
  197. "DebugHistoryInterventionNoUserActivation",
  198. base::FEATURE_DISABLED_BY_DEFAULT};
  199. // Enable changing source dynamically for desktop capture.
  200. const base::Feature kDesktopCaptureChangeSource{
  201. "DesktopCaptureChangeSource", base::FEATURE_ENABLED_BY_DEFAULT};
  202. #if BUILDFLAG(IS_CHROMEOS_LACROS)
  203. // Enables the alternative, improved desktop/window capturer for LaCrOS
  204. const base::Feature kDesktopCaptureLacrosV2{"DesktopCaptureLacrosV2",
  205. base::FEATURE_ENABLED_BY_DEFAULT};
  206. #endif
  207. // Adds a tab strip to PWA windows.
  208. // TODO(crbug.com/897314): Enable this feature.
  209. const base::Feature kDesktopPWAsTabStrip{"DesktopPWAsTabStrip",
  210. base::FEATURE_DISABLED_BY_DEFAULT};
  211. // Enable the device posture API.
  212. // Tracking bug for enabling device posture API: https://crbug.com/1066842.
  213. const base::Feature kDevicePosture{"DevicePosture",
  214. base::FEATURE_DISABLED_BY_DEFAULT};
  215. // Controls whether the Digital Goods API is enabled.
  216. // https://github.com/WICG/digital-goods/
  217. const base::Feature kDigitalGoodsApi {
  218. "DigitalGoodsApi",
  219. #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
  220. base::FEATURE_ENABLED_BY_DEFAULT
  221. #else
  222. base::FEATURE_DISABLED_BY_DEFAULT
  223. #endif
  224. };
  225. // Enable document policy for configuring and restricting feature behavior.
  226. const base::Feature kDocumentPolicy{"DocumentPolicy",
  227. base::FEATURE_ENABLED_BY_DEFAULT};
  228. // Enable document policy negotiation mechanism.
  229. const base::Feature kDocumentPolicyNegotiation{
  230. "DocumentPolicyNegotiation", base::FEATURE_DISABLED_BY_DEFAULT};
  231. // Enable establishing the GPU channel early in renderer startup.
  232. const base::Feature kEarlyEstablishGpuChannel{
  233. "EarlyEstablishGpuChannel", base::FEATURE_DISABLED_BY_DEFAULT};
  234. // Enable Early Hints subresource preloads for navigation.
  235. const base::Feature kEarlyHintsPreloadForNavigation{
  236. "EarlyHintsPreloadForNavigation", base::FEATURE_ENABLED_BY_DEFAULT};
  237. // Requires documents embedded via <iframe>, etc, to explicitly opt-into the
  238. // embedding: https://github.com/mikewest/embedding-requires-opt-in.
  239. const base::Feature kEmbeddingRequiresOptIn{"EmbeddingRequiresOptIn",
  240. base::FEATURE_DISABLED_BY_DEFAULT};
  241. // Enables canvas 2d methods BeginLayer and EndLayer.
  242. const base::Feature kEnableCanvas2DLayers{"EnableCanvas2DLayers",
  243. base::FEATURE_DISABLED_BY_DEFAULT};
  244. // Enables the Machine Learning Model Loader Web Platform API. Explainer:
  245. // https://github.com/webmachinelearning/model-loader/blob/main/explainer.md
  246. const base::Feature kEnableMachineLearningModelLoaderWebPlatformApi{
  247. "EnableMachineLearningModelLoaderWebPlatformApi",
  248. base::FEATURE_DISABLED_BY_DEFAULT};
  249. // Enables service workers on chrome-untrusted:// urls.
  250. const base::Feature kEnableServiceWorkersForChromeUntrusted{
  251. "EnableServiceWorkersForChromeUntrusted",
  252. base::FEATURE_DISABLED_BY_DEFAULT};
  253. // If this feature is enabled and device permission is not granted by the user,
  254. // media-device enumeration will provide at most one device per type and the
  255. // device IDs will not be available.
  256. // TODO(crbug.com/1019176): remove the feature in M89.
  257. const base::Feature kEnumerateDevicesHideDeviceIDs {
  258. "EnumerateDevicesHideDeviceIDs",
  259. #if BUILDFLAG(IS_ANDROID)
  260. base::FEATURE_DISABLED_BY_DEFAULT
  261. #else
  262. base::FEATURE_ENABLED_BY_DEFAULT
  263. #endif
  264. };
  265. // Content counterpart of ExperimentalContentSecurityPolicyFeatures in
  266. // third_party/blink/renderer/platform/runtime_enabled_features.json5. Enables
  267. // experimental Content Security Policy features ('navigate-to' and
  268. // 'prefetch-src').
  269. const base::Feature kExperimentalContentSecurityPolicyFeatures{
  270. "ExperimentalContentSecurityPolicyFeatures",
  271. base::FEATURE_DISABLED_BY_DEFAULT};
  272. // Extra CORS safelisted headers. See https://crbug.com/999054.
  273. const base::Feature kExtraSafelistedRequestHeadersForOutOfBlinkCors{
  274. "ExtraSafelistedRequestHeadersForOutOfBlinkCors",
  275. base::FEATURE_DISABLED_BY_DEFAULT};
  276. // Enables JavaScript API to intermediate federated identity requests.
  277. // Note that actual exposure of the FedCM API to web content is controlled
  278. // by the flag in RuntimeEnabledFeatures on the blink side. See also
  279. // the use of kSetOnlyIfOverridden in content/child/runtime_features.cc.
  280. // We enable it here by default to support use in origin trials.
  281. const base::Feature kFedCm{"FedCm", base::FEATURE_ENABLED_BY_DEFAULT};
  282. // Field trial boolean parameter which indicates whether FedCM auto
  283. // sign-in is enabled.
  284. const char kFedCmAutoSigninFieldTrialParamName[] = "AutoSignin";
  285. // Field trial boolean parameter which indicates whether FedCM IDP sign-out
  286. // is enabled.
  287. const char kFedCmIdpSignoutFieldTrialParamName[] = "IdpSignout";
  288. // Field trial boolean parameter which indicates that FedCM API is enabled in
  289. // cross-origin iframes.
  290. const char kFedCmIframeSupportFieldTrialParamName[] = "IframeSupport";
  291. // Kill switch for FedCm manifest validation.
  292. const base::Feature kFedCmManifestValidation{"FedCmManifestValidation",
  293. base::FEATURE_ENABLED_BY_DEFAULT};
  294. // Enables usage of the FedCM API with multiple identity providers at the same
  295. // time.
  296. const base::Feature kFedCmMultipleIdentityProviders{
  297. "FedCmMultipleIdentityProviders", base::FEATURE_DISABLED_BY_DEFAULT};
  298. // Enables usage of First Party Sets to determine cookie availability.
  299. constexpr base::Feature kFirstPartySets{"FirstPartySets",
  300. base::FEATURE_DISABLED_BY_DEFAULT};
  301. // Controls whether the client is considered a dogfooder for the FirstPartySets
  302. // feature.
  303. const base::FeatureParam<bool> kFirstPartySetsIsDogfooder{
  304. &kFirstPartySets, "FirstPartySetsIsDogfooder", false};
  305. // Whether to initialize the font manager when the renderer starts on a
  306. // background thread.
  307. const base::Feature kFontManagerEarlyInit{"FontManagerEarlyInit",
  308. base::FEATURE_ENABLED_BY_DEFAULT};
  309. // Enables fixes for matching src: local() for web fonts correctly against full
  310. // font name or postscript name. Rolling out behind a flag, as enabling this
  311. // enables a font indexer on Android which we need to test in the field first.
  312. const base::Feature kFontSrcLocalMatching{"FontSrcLocalMatching",
  313. base::FEATURE_ENABLED_BY_DEFAULT};
  314. #if !BUILDFLAG(IS_ANDROID)
  315. // Feature controlling whether or not memory pressure signals will be forwarded
  316. // to the GPU process.
  317. const base::Feature kForwardMemoryPressureEventsToGpuProcess {
  318. "ForwardMemoryPressureEventsToGpuProcess",
  319. #if BUILDFLAG(IS_FUCHSIA) || BUILDFLAG(IS_WIN)
  320. base::FEATURE_ENABLED_BY_DEFAULT
  321. #else
  322. base::FEATURE_DISABLED_BY_DEFAULT
  323. #endif
  324. };
  325. #endif
  326. // If enabled, limits the number of FLEDGE auctions that can be run between page
  327. // load and unload -- any attempt to run more than this number of auctions will
  328. // fail (return null to JavaScript).
  329. const base::Feature kFledgeLimitNumAuctions{"LimitNumFledgeAuctions",
  330. base::FEATURE_DISABLED_BY_DEFAULT};
  331. // The number of allowed auctions for each page load (load to unload).
  332. const base::FeatureParam<int> kFledgeLimitNumAuctionsParam{
  333. &kFledgeLimitNumAuctions, "max_auctions_per_page", 8};
  334. // Enables scrollers inside Blink to store scroll offsets in fractional
  335. // floating-point numbers rather than truncating to integers.
  336. const base::Feature kFractionalScrollOffsets{"FractionalScrollOffsets",
  337. base::FEATURE_DISABLED_BY_DEFAULT};
  338. // Puts network quality estimate related Web APIs in the holdback mode. When the
  339. // holdback is enabled the related Web APIs return network quality estimate
  340. // set by the experiment (regardless of the actual quality).
  341. const base::Feature kNetworkQualityEstimatorWebHoldback{
  342. "NetworkQualityEstimatorWebHoldback", base::FEATURE_DISABLED_BY_DEFAULT};
  343. // Enables the getDisplayMediaSet API for capturing multiple screens at once.
  344. const base::Feature kGetDisplayMediaSet{"GetDisplayMediaSet",
  345. base::FEATURE_DISABLED_BY_DEFAULT};
  346. // Enables auto selection of all screens in combination with the
  347. // getDisplayMediaSet API.
  348. const base::Feature kGetDisplayMediaSetAutoSelectAllScreens{
  349. "GetDisplayMediaSetAutoSelectAllScreens",
  350. base::FEATURE_DISABLED_BY_DEFAULT};
  351. // Determines if an extra brand version pair containing possibly escaped double
  352. // quotes and escaped backslashed should be added to the Sec-CH-UA header
  353. // (activated by kUserAgentClientHint)
  354. const base::Feature kGreaseUACH{"GreaseUACH", base::FEATURE_ENABLED_BY_DEFAULT};
  355. // To-be-disabled feature of payment apps receiving merchant and user identity
  356. // when a merchant website checks whether the payment app can make payments.
  357. const base::Feature kIdentityInCanMakePaymentEventFeature{
  358. "IdentityInCanMakePaymentEventFeature", base::FEATURE_ENABLED_BY_DEFAULT};
  359. // This is intended as a kill switch for the Idle Detection feature. To enable
  360. // this feature, the experimental web platform features flag should be set,
  361. // or the site should obtain an Origin Trial token.
  362. const base::Feature kIdleDetection{"IdleDetection",
  363. base::FEATURE_ENABLED_BY_DEFAULT};
  364. // A feature flag for the memory-backed code cache.
  365. const base::Feature kInMemoryCodeCache{"InMemoryCodeCache",
  366. base::FEATURE_DISABLED_BY_DEFAULT};
  367. // Historically most navigations required IPC from browser to renderer and
  368. // from renderer back to browser. This was done to check for before-unload
  369. // handlers on the current page and occurred regardless of whether a
  370. // before-unload handler was present. The navigation start time (as used in
  371. // various metrics) is the time the renderer initiates the IPC back to the
  372. // browser. If this feature is enabled, the navigation start time takes into
  373. // account the cost of the IPC from the browser to renderer. More specifically:
  374. // navigation_start = time_renderer_sends_ipc_to_browser -
  375. // (time_renderer_receives_ipc - time_browser_sends_ipc)
  376. // Note that navigation_start does not take into account the amount of time the
  377. // renderer spends processing the IPC (that is, executing script).
  378. const base::Feature kIncludeIpcOverheadInNavigationStart{
  379. "IncludeIpcOverheadInNavigationStart", base::FEATURE_ENABLED_BY_DEFAULT};
  380. // Kill switch for the GetInstalledRelatedApps API.
  381. const base::Feature kInstalledApp{"InstalledApp",
  382. base::FEATURE_ENABLED_BY_DEFAULT};
  383. // Allow Windows specific implementation for the GetInstalledRelatedApps API.
  384. const base::Feature kInstalledAppProvider{"InstalledAppProvider",
  385. base::FEATURE_ENABLED_BY_DEFAULT};
  386. // Show warning about clearing data from installed apps in the clear browsing
  387. // data flow. The warning will be shown in a second dialog.
  388. const base::Feature kInstalledAppsInCbd{"InstalledAppsInCbd",
  389. base::FEATURE_DISABLED_BY_DEFAULT};
  390. // Enable support for isolated web apps. This will guard features like serving
  391. // isolated web apps via the isolated-app:// scheme, and other advanced isolated
  392. // app functionality. See https://github.com/reillyeon/isolated-web-apps for a
  393. // general overview.
  394. const base::Feature kIsolatedWebApps{"IsolatedWebApps",
  395. base::FEATURE_DISABLED_BY_DEFAULT};
  396. // Alternative to switches::kIsolateOrigins, for turning on origin isolation.
  397. // List of origins to isolate has to be specified via
  398. // kIsolateOriginsFieldTrialParamName.
  399. const base::Feature kIsolateOrigins{"IsolateOrigins",
  400. base::FEATURE_DISABLED_BY_DEFAULT};
  401. const char kIsolateOriginsFieldTrialParamName[] = "OriginsList";
  402. // Allow process isolation of iframes with the 'sandbox' attribute set. Whether
  403. // or not such an iframe will be isolated may depend on options specified with
  404. // the attribute. Note: At present, only iframes with origin-restricted
  405. // sandboxes are isolated.
  406. const base::Feature kIsolateSandboxedIframes{"IsolateSandboxedIframes",
  407. base::FEATURE_DISABLED_BY_DEFAULT};
  408. const base::FeatureParam<IsolateSandboxedIframesGrouping>::Option
  409. isolated_sandboxed_iframes_grouping_types[] = {
  410. {IsolateSandboxedIframesGrouping::kPerSite, "per-site"},
  411. {IsolateSandboxedIframesGrouping::kPerOrigin, "per-origin"},
  412. {IsolateSandboxedIframesGrouping::kPerDocument, "per-document"}};
  413. const base::FeatureParam<IsolateSandboxedIframesGrouping>
  414. kIsolateSandboxedIframesGroupingParam{
  415. &kIsolateSandboxedIframes, "grouping",
  416. IsolateSandboxedIframesGrouping::kPerSite,
  417. &isolated_sandboxed_iframes_grouping_types};
  418. const base::Feature kLazyFrameLoading{"LazyFrameLoading",
  419. base::FEATURE_ENABLED_BY_DEFAULT};
  420. const base::Feature kLazyFrameVisibleLoadTimeMetrics {
  421. "LazyFrameVisibleLoadTimeMetrics",
  422. #if BUILDFLAG(IS_ANDROID)
  423. base::FEATURE_ENABLED_BY_DEFAULT
  424. #else
  425. base::FEATURE_DISABLED_BY_DEFAULT
  426. #endif
  427. };
  428. const base::Feature kLazyImageLoading{"LazyImageLoading",
  429. base::FEATURE_ENABLED_BY_DEFAULT};
  430. const base::Feature kLazyImageVisibleLoadTimeMetrics {
  431. "LazyImageVisibleLoadTimeMetrics",
  432. #if BUILDFLAG(IS_ANDROID)
  433. base::FEATURE_ENABLED_BY_DEFAULT
  434. #else
  435. base::FEATURE_DISABLED_BY_DEFAULT
  436. #endif
  437. };
  438. // Enable lazy initialization of the media controls.
  439. const base::Feature kLazyInitializeMediaControls{
  440. "LazyInitializeMediaControls", base::FEATURE_ENABLED_BY_DEFAULT};
  441. // Configures whether Blink on Windows 8.0 and below should use out of process
  442. // API font fallback calls to retrieve a fallback font family name as opposed to
  443. // using a hard-coded font lookup table.
  444. const base::Feature kLegacyWindowsDWriteFontFallback{
  445. "LegacyWindowsDWriteFontFallback", base::FEATURE_DISABLED_BY_DEFAULT};
  446. const base::Feature kLogJsConsoleMessages {
  447. "LogJsConsoleMessages",
  448. #if BUILDFLAG(IS_ANDROID)
  449. base::FEATURE_DISABLED_BY_DEFAULT
  450. #else
  451. base::FEATURE_ENABLED_BY_DEFAULT
  452. #endif
  453. };
  454. // Configures whether we set a lower limit for renderers that do not have a main
  455. // frame, similar to the limit that is already done for backgrounded renderers.
  456. const base::Feature kLowerMemoryLimitForNonMainRenderers{
  457. "LowerMemoryLimitForNonMainRenderers", base::FEATURE_DISABLED_BY_DEFAULT};
  458. // The MBI mode controls whether or not communication over the
  459. // AgentSchedulingGroup is ordered with respect to the render-process-global
  460. // legacy IPC channel, as well as the granularity of AgentSchedulingGroup
  461. // creation. This will break ordering guarantees between different agent
  462. // scheduling groups (ordering withing a group is still preserved).
  463. // DO NOT USE! The feature is not yet fully implemented. See crbug.com/1111231.
  464. const base::Feature kMBIMode {
  465. "MBIMode",
  466. #if BUILDFLAG(MBI_MODE_PER_RENDER_PROCESS_HOST) || \
  467. BUILDFLAG(MBI_MODE_PER_SITE_INSTANCE)
  468. base::FEATURE_ENABLED_BY_DEFAULT
  469. #else
  470. base::FEATURE_DISABLED_BY_DEFAULT
  471. #endif
  472. };
  473. const base::FeatureParam<MBIMode>::Option mbi_mode_types[] = {
  474. {MBIMode::kLegacy, "legacy"},
  475. {MBIMode::kEnabledPerRenderProcessHost, "per_render_process_host"},
  476. {MBIMode::kEnabledPerSiteInstance, "per_site_instance"}};
  477. const base::FeatureParam<MBIMode> kMBIModeParam {
  478. &kMBIMode, "mode",
  479. #if BUILDFLAG(MBI_MODE_PER_RENDER_PROCESS_HOST)
  480. MBIMode::kEnabledPerRenderProcessHost,
  481. #elif BUILDFLAG(MBI_MODE_PER_SITE_INSTANCE)
  482. MBIMode::kEnabledPerSiteInstance,
  483. #else
  484. MBIMode::kLegacy,
  485. #endif
  486. &mbi_mode_types
  487. };
  488. // If this feature is enabled, media-device enumerations use a cache that is
  489. // invalidated upon notifications sent by base::SystemMonitor. If disabled, the
  490. // cache is considered invalid on every enumeration request.
  491. const base::Feature kMediaDevicesSystemMonitorCache {
  492. "MediaDevicesSystemMonitorCaching",
  493. #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
  494. base::FEATURE_ENABLED_BY_DEFAULT
  495. #else
  496. base::FEATURE_DISABLED_BY_DEFAULT
  497. #endif
  498. };
  499. // Allow cross-context transfer of MediaStreamTracks.
  500. const base::Feature kMediaStreamTrackTransfer{
  501. "MediaStreamTrackTransfer", base::FEATURE_DISABLED_BY_DEFAULT};
  502. // If enabled Mojo uses a dedicated background thread to listen for incoming
  503. // IPCs. Otherwise it's configured to use Content's IO thread for that purpose.
  504. const base::Feature kMojoDedicatedThread{"MojoDedicatedThread",
  505. base::FEATURE_DISABLED_BY_DEFAULT};
  506. // Enables/disables the video capture service.
  507. const base::Feature kMojoVideoCapture{"MojoVideoCapture",
  508. base::FEATURE_ENABLED_BY_DEFAULT};
  509. // A secondary switch used in combination with kMojoVideoCapture.
  510. // This is intended as a kill switch to allow disabling the service on
  511. // particular groups of devices even if they forcibly enable kMojoVideoCapture
  512. // via a command-line argument.
  513. const base::Feature kMojoVideoCaptureSecondary{
  514. "MojoVideoCaptureSecondary", base::FEATURE_ENABLED_BY_DEFAULT};
  515. // When enable, iframe does not implicit capture mouse event.
  516. const base::Feature kMouseSubframeNoImplicitCapture{
  517. "MouseSubframeNoImplicitCapture", base::FEATURE_DISABLED_BY_DEFAULT};
  518. // When NavigationNetworkResponseQueue is enabled, the browser will schedule
  519. // some tasks related to navigation network responses in a kHighest priority
  520. // queue.
  521. const base::Feature kNavigationNetworkResponseQueue{
  522. "NavigationNetworkResponseQueue", base::FEATURE_DISABLED_BY_DEFAULT};
  523. // Preconnects socket at the construction of NavigationRequest.
  524. const base::Feature kNavigationRequestPreconnect{
  525. "NavigationRequestPreconnect", base::FEATURE_ENABLED_BY_DEFAULT};
  526. // Enables optimizations for renderer->browser mojo calls to avoid waiting on
  527. // the UI thread during navigation.
  528. const base::Feature kNavigationThreadingOptimizations{
  529. "NavigationThreadingOptimizations", base::FEATURE_ENABLED_BY_DEFAULT};
  530. // If the network service is enabled, runs it in process.
  531. const base::Feature kNetworkServiceInProcess {
  532. "NetworkServiceInProcess2",
  533. #if BUILDFLAG(IS_ANDROID)
  534. base::FEATURE_ENABLED_BY_DEFAULT
  535. #else
  536. base::FEATURE_DISABLED_BY_DEFAULT
  537. #endif
  538. };
  539. const base::Feature kNeverSlowMode{"NeverSlowMode",
  540. base::FEATURE_DISABLED_BY_DEFAULT};
  541. // Kill switch for Web Notification content images.
  542. const base::Feature kNotificationContentImage{"NotificationContentImage",
  543. base::FEATURE_ENABLED_BY_DEFAULT};
  544. // Enables the notification trigger API.
  545. const base::Feature kNotificationTriggers{"NotificationTriggers",
  546. base::FEATURE_ENABLED_BY_DEFAULT};
  547. // Controls the Origin-Agent-Cluster header. Tracking bug
  548. // https://crbug.com/1042415; flag removal bug (for when this is fully launched)
  549. // https://crbug.com/1148057.
  550. //
  551. // The name is "OriginIsolationHeader" because that was the old name when the
  552. // feature was under development.
  553. const base::Feature kOriginIsolationHeader{"OriginIsolationHeader",
  554. base::FEATURE_ENABLED_BY_DEFAULT};
  555. // History navigation in response to horizontal overscroll (aka gesture-nav).
  556. const base::Feature kOverscrollHistoryNavigation{
  557. "OverscrollHistoryNavigation", base::FEATURE_ENABLED_BY_DEFAULT};
  558. // Whether web apps can run periodic tasks upon network connectivity.
  559. const base::Feature kPeriodicBackgroundSync{"PeriodicBackgroundSync",
  560. base::FEATURE_DISABLED_BY_DEFAULT};
  561. // If Pepper 3D Image Chromium is allowed, this feature controls whether it is
  562. // enabled.
  563. // TODO(https://crbug.com/1196009): Remove this feature, remove the code that
  564. // uses it.
  565. const base::Feature kPepper3DImageChromium{"Pepper3DImageChromium",
  566. base::FEATURE_DISABLED_BY_DEFAULT};
  567. // Kill-switch to introduce a compatibility breaking restriction.
  568. const base::Feature kPepperCrossOriginRedirectRestriction{
  569. "PepperCrossOriginRedirectRestriction", base::FEATURE_ENABLED_BY_DEFAULT};
  570. // A browser-side equivalent of the Blink feature "DocumentPictureInPictureAPI".
  571. // This is used for sanity checks to ensure that the feature can't be enabled by
  572. // a compromised renderer despite the Blink flag not being enabled.
  573. //
  574. // Tracking bug: https://crbug.com/1269059
  575. // Removal bug (when no longer experimental): https://crbug.com/1285144
  576. const base::Feature kDocumentPictureInPictureAPI{
  577. "DocumentPictureInPictureAPI", base::FEATURE_DISABLED_BY_DEFAULT};
  578. // Enables process sharing for sites that do not require a dedicated process
  579. // by using a default SiteInstance. Default SiteInstances will only be used
  580. // on platforms that do not use full site isolation.
  581. // Note: This feature is mutally exclusive with
  582. // kProcessSharingWithStrictSiteInstances. Only one of these should be enabled
  583. // at a time.
  584. const base::Feature kProcessSharingWithDefaultSiteInstances{
  585. "ProcessSharingWithDefaultSiteInstances", base::FEATURE_ENABLED_BY_DEFAULT};
  586. // Whether cross-site frames should get their own SiteInstance even when
  587. // strict site isolation is disabled. These SiteInstances will still be
  588. // grouped into a shared default process based on BrowsingInstance.
  589. const base::Feature kProcessSharingWithStrictSiteInstances{
  590. "ProcessSharingWithStrictSiteInstances", base::FEATURE_DISABLED_BY_DEFAULT};
  591. // Tells the RenderFrameHost to send beforeunload messages on a different
  592. // local frame interface which will handle the messages at a higher priority.
  593. const base::Feature kHighPriorityBeforeUnload{
  594. "HighPriorityBeforeUnload", base::FEATURE_DISABLED_BY_DEFAULT};
  595. // Preload cookie database on NetworkContext creation.
  596. const base::Feature kPreloadCookies{"PreloadCookies",
  597. base::FEATURE_DISABLED_BY_DEFAULT};
  598. // Prerender2 holdback feature disables prerendering on all predictors. This is
  599. // useful in comparing the impact of blink::features::kPrerender2 experiment
  600. // with and without Prerendering.
  601. // Please note this feature is only used for experimental purposes, please don't
  602. // enable this feature by default.
  603. const base::Feature kPrerender2Holdback{"Prerender2Holdback",
  604. base::FEATURE_DISABLED_BY_DEFAULT};
  605. // Enables exposure of ads APIs in the renderer: Attribution Reporting,
  606. // FLEDGE, Topics.
  607. const base::Feature kPrivacySandboxAdsAPIsOverride{
  608. "PrivacySandboxAdsAPIsOverride", base::FEATURE_DISABLED_BY_DEFAULT};
  609. // Enables Private Network Access checks for all types of web workers.
  610. //
  611. // This affects initial worker script fetches, fetches initiated by workers
  612. // themselves, and service worker update fetches.
  613. //
  614. // The exact checks run are the same as for other document subresources, and
  615. // depend on the state of other Private Network Access feature flags:
  616. //
  617. // - `kBlockInsecurePrivateNetworkRequests`
  618. // - `kPrivateNetworkAccessSendPreflights`
  619. // - `kPrivateNetworkAccessRespectPreflightResults`
  620. //
  621. const base::Feature kPrivateNetworkAccessForWorkers = {
  622. "PrivateNetworkAccessForWorkers", base::FEATURE_DISABLED_BY_DEFAULT};
  623. // Requires that CORS preflight requests succeed before sending private network
  624. // requests. This flag implies `kPrivateNetworkAccessSendPreflights`.
  625. // See: https://wicg.github.io/private-network-access/#cors-preflight
  626. const base::Feature kPrivateNetworkAccessRespectPreflightResults = {
  627. "PrivateNetworkAccessRespectPreflightResults",
  628. base::FEATURE_DISABLED_BY_DEFAULT};
  629. // Enables sending CORS preflight requests ahead of private network requests.
  630. // See: https://wicg.github.io/private-network-access/#cors-preflight
  631. const base::Feature kPrivateNetworkAccessSendPreflights = {
  632. "PrivateNetworkAccessSendPreflights", base::FEATURE_ENABLED_BY_DEFAULT};
  633. // Enable the ProactivelySwapBrowsingInstance experiment. A browsing instance
  634. // represents a set of frames that can script each other. Currently, Chrome does
  635. // not always switch BrowsingInstance when navigating in between two unrelated
  636. // pages. This experiment makes Chrome swap BrowsingInstances for cross-site
  637. // HTTP(S) navigations when the BrowsingInstance doesn't contain any other
  638. // windows.
  639. const base::Feature kProactivelySwapBrowsingInstance{
  640. "ProactivelySwapBrowsingInstance", base::FEATURE_DISABLED_BY_DEFAULT};
  641. // Fires the `pushsubscriptionchange` event defined here:
  642. // https://w3c.github.io/push-api/#the-pushsubscriptionchange-event
  643. // for subscription refreshes, revoked permissions or subscription losses
  644. const base::Feature kPushSubscriptionChangeEvent{
  645. "PushSubscriptionChangeEvent", base::FEATURE_DISABLED_BY_DEFAULT};
  646. // Causes hidden tabs with crashed subframes to be marked for reload, meaning
  647. // that if a user later switches to that tab, the current page will be
  648. // reloaded. This will hide crashed subframes from the user at the cost of
  649. // extra reloads.
  650. const base::Feature kReloadHiddenTabsWithCrashedSubframes {
  651. "ReloadHiddenTabsWithCrashedSubframes",
  652. #if BUILDFLAG(IS_ANDROID)
  653. base::FEATURE_ENABLED_BY_DEFAULT
  654. #else
  655. base::FEATURE_DISABLED_BY_DEFAULT
  656. #endif
  657. };
  658. // Causes RenderAccessibilityHost messages to be handled initially on a thread
  659. // pool before being forwarded to the browser main thread to avoid so the
  660. // deserialization does not block it.
  661. //
  662. // TODO(nuskos): Once we've conducted a retroactive study of chrometto
  663. // improvements clean up this feature.
  664. const base::Feature kRenderAccessibilityHostDeserializationOffMainThread{
  665. "RenderAccessibilityHostDeserializationOffMainThread",
  666. base::FEATURE_ENABLED_BY_DEFAULT};
  667. // RenderDocument:
  668. //
  669. // Currently, a RenderFrameHost represents neither a frame nor a document, but a
  670. // frame in a given process. A new one is created after a different-process
  671. // navigation. The goal of RenderDocument is to get a new one for each document
  672. // instead.
  673. //
  674. // Design doc: https://bit.ly/renderdocument
  675. // Main bug tracker: https://crbug.com/936696
  676. // Enable using the RenderDocument.
  677. const base::Feature kRenderDocument{"RenderDocument",
  678. base::FEATURE_ENABLED_BY_DEFAULT};
  679. // Enables skipping the early call to CommitPending when navigating away from a
  680. // crashed frame.
  681. const base::Feature kSkipEarlyCommitPendingForCrashedFrame{
  682. "SkipEarlyCommitPendingForCrashedFrame", base::FEATURE_DISABLED_BY_DEFAULT};
  683. // Enables skipping the service worker fetch handler if the fetch handler is
  684. // identified as ignorable.
  685. const base::Feature kServiceWorkerSkipIgnorableFetchHandler{
  686. "ServiceWorkerSkipIgnorableFetchHandler",
  687. base::FEATURE_DISABLED_BY_DEFAULT};
  688. // This feature param controls if the empty service worker fetch handler is
  689. // skipped.
  690. constexpr base::FeatureParam<bool> kSkipEmptyFetchHandler{
  691. &kServiceWorkerSkipIgnorableFetchHandler,
  692. "SkipEmptyFetchHandler",
  693. false,
  694. };
  695. // Run video capture service in the Browser process as opposed to a dedicated
  696. // utility process
  697. const base::Feature kRunVideoCaptureServiceInBrowserProcess{
  698. "RunVideoCaptureServiceInBrowserProcess",
  699. base::FEATURE_DISABLED_BY_DEFAULT};
  700. // Enables saving pages as Web Bundle.
  701. const base::Feature kSavePageAsWebBundle{"SavePageAsWebBundle",
  702. base::FEATURE_DISABLED_BY_DEFAULT};
  703. // Browser-side feature flag for Secure Payment Confirmation (SPC) that also
  704. // controls the render side feature state. SPC initial launch is intended
  705. // only for Mac devices with Touch ID and and Windows devices with
  706. // Windows Hello authentication available and setup.
  707. const base::Feature kSecurePaymentConfirmation {
  708. "SecurePaymentConfirmationBrowser",
  709. #if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
  710. base::FEATURE_ENABLED_BY_DEFAULT
  711. #else
  712. base::FEATURE_DISABLED_BY_DEFAULT
  713. #endif
  714. };
  715. // Used to control whether to remove the restriction that PaymentCredential in
  716. // WebAuthn and secure payment confirmation method in PaymentRequest API must
  717. // use a user verifying platform authenticator. When enabled, this allows using
  718. // such devices as UbiKey on Linux, which can make development easier.
  719. const base::Feature kSecurePaymentConfirmationDebug{
  720. "SecurePaymentConfirmationDebug", base::FEATURE_DISABLED_BY_DEFAULT};
  721. // Make sendBeacon throw for a Blob with a non simple type.
  722. const base::Feature kSendBeaconThrowForBlobWithNonSimpleType{
  723. "SendBeaconThrowForBlobWithNonSimpleType",
  724. base::FEATURE_DISABLED_BY_DEFAULT};
  725. // Service worker based payment apps as defined by w3c here:
  726. // https://w3c.github.io/webpayments-payment-apps-api/
  727. // TODO(rouslan): Remove this.
  728. const base::Feature kServiceWorkerPaymentApps{"ServiceWorkerPaymentApps",
  729. base::FEATURE_ENABLED_BY_DEFAULT};
  730. // Enable connect-src CSP directive for the Web Payment API.
  731. const base::Feature kWebPaymentAPICSP{"WebPaymentAPICSP",
  732. base::FEATURE_DISABLED_BY_DEFAULT};
  733. // Use this feature to experiment terminating a service worker when it doesn't
  734. // control any clients: https://crbug.com/1043845.
  735. const base::Feature kServiceWorkerTerminationOnNoControllee{
  736. "ServiceWorkerTerminationOnNoControllee",
  737. base::FEATURE_DISABLED_BY_DEFAULT};
  738. // http://tc39.github.io/ecmascript_sharedmem/shmem.html
  739. // This feature is also enabled independently of this flag for cross-origin
  740. // isolated renderers.
  741. const base::Feature kSharedArrayBuffer{"SharedArrayBuffer",
  742. base::FEATURE_DISABLED_BY_DEFAULT};
  743. // If enabled, SharedArrayBuffer is present and can be transferred on desktop
  744. // platforms. This flag is used only as a "kill switch" as we migrate towards
  745. // requiring 'crossOriginIsolated'.
  746. const base::Feature kSharedArrayBufferOnDesktop{
  747. "SharedArrayBufferOnDesktop", base::FEATURE_DISABLED_BY_DEFAULT};
  748. // Signed Exchange Reporting for distributors
  749. // https://www.chromestatus.com/feature/5687904902840320
  750. const base::Feature kSignedExchangeReportingForDistributors{
  751. "SignedExchangeReportingForDistributors", base::FEATURE_ENABLED_BY_DEFAULT};
  752. // Subresource prefetching+loading via Signed HTTP Exchange
  753. // https://www.chromestatus.com/feature/5126805474246656
  754. const base::Feature kSignedExchangeSubresourcePrefetch{
  755. "SignedExchangeSubresourcePrefetch", base::FEATURE_ENABLED_BY_DEFAULT};
  756. // Origin-Signed HTTP Exchanges (for WebPackage Loading)
  757. // https://www.chromestatus.com/feature/5745285984681984
  758. const base::Feature kSignedHTTPExchange{"SignedHTTPExchange",
  759. base::FEATURE_ENABLED_BY_DEFAULT};
  760. // Whether to send a ping to the inner URL upon navigation or not.
  761. const base::Feature kSignedHTTPExchangePingValidity{
  762. "SignedHTTPExchangePingValidity", base::FEATURE_DISABLED_BY_DEFAULT};
  763. // Delays RenderProcessHost shutdown by a few seconds to allow the subframe's
  764. // process to be potentially reused. This aims to reduce process churn in
  765. // navigations where the source and destination share subframes.
  766. const base::Feature kSubframeShutdownDelay{"SubframeShutdownDelay",
  767. base::FEATURE_DISABLED_BY_DEFAULT};
  768. const base::FeatureParam<SubframeShutdownDelayType>::Option delay_types[] = {
  769. {SubframeShutdownDelayType::kConstant, "constant"},
  770. {SubframeShutdownDelayType::kConstantLong, "constant-long"},
  771. {SubframeShutdownDelayType::kHistoryBased, "history-based"},
  772. {SubframeShutdownDelayType::kHistoryBasedLong, "history-based-long"},
  773. {SubframeShutdownDelayType::kMemoryBased, "memory-based"}};
  774. const base::FeatureParam<SubframeShutdownDelayType>
  775. kSubframeShutdownDelayTypeParam{&kSubframeShutdownDelay, "type",
  776. SubframeShutdownDelayType::kConstant,
  777. &delay_types};
  778. // If enabled, GetUserMedia API will only work when the concerned tab is in
  779. // focus
  780. const base::Feature kUserMediaCaptureOnFocus{"UserMediaCaptureOnFocus",
  781. base::FEATURE_DISABLED_BY_DEFAULT};
  782. // This is intended as a kill switch for the WebOTP Service feature. To enable
  783. // this feature, the experimental web platform features flag should be set.
  784. const base::Feature kWebOTP{"WebOTP", base::FEATURE_ENABLED_BY_DEFAULT};
  785. // Enables WebOTP calls in cross-origin iframes if allowed by Permissions
  786. // Policy.
  787. const base::Feature kWebOTPAssertionFeaturePolicy{
  788. "WebOTPAssertionFeaturePolicy", base::FEATURE_DISABLED_BY_DEFAULT};
  789. // Enable the web lockscreen API implementation
  790. // (https://github.com/WICG/lock-screen) in Chrome.
  791. const base::Feature kWebLockScreenApi{"WebLockScreenApi",
  792. base::FEATURE_DISABLED_BY_DEFAULT};
  793. // Controls whether to isolate sites of documents that specify an eligible
  794. // Cross-Origin-Opener-Policy header. Note that this is only intended to be
  795. // used on Android, which does not use strict site isolation. See
  796. // https://crbug.com/1018656.
  797. const base::Feature kSiteIsolationForCrossOriginOpenerPolicy {
  798. "SiteIsolationForCrossOriginOpenerPolicy",
  799. // Enabled by default on Android only; see https://crbug.com/1206770.
  800. #if BUILDFLAG(IS_ANDROID)
  801. base::FEATURE_ENABLED_BY_DEFAULT
  802. #else
  803. base::FEATURE_DISABLED_BY_DEFAULT
  804. #endif
  805. };
  806. // This feature param (true by default) controls whether sites are persisted
  807. // across restarts.
  808. const base::FeatureParam<bool>
  809. kSiteIsolationForCrossOriginOpenerPolicyShouldPersistParam{
  810. &kSiteIsolationForCrossOriginOpenerPolicy,
  811. "should_persist_across_restarts", true};
  812. // This feature param controls the maximum size of stored sites. Only used
  813. // when persistence is also enabled.
  814. const base::FeatureParam<int>
  815. kSiteIsolationForCrossOriginOpenerPolicyMaxSitesParam{
  816. &kSiteIsolationForCrossOriginOpenerPolicy, "stored_sites_max_size",
  817. 100};
  818. // This feature param controls the period of time for which the stored sites
  819. // should remain valid. Only used when persistence is also enabled.
  820. const base::FeatureParam<base::TimeDelta>
  821. kSiteIsolationForCrossOriginOpenerPolicyExpirationTimeoutParam{
  822. &kSiteIsolationForCrossOriginOpenerPolicy, "expiration_timeout",
  823. base::Days(7)};
  824. // This feature turns on site isolation support in <webview> guests.
  825. const base::Feature kSiteIsolationForGuests{"SiteIsolationForGuests",
  826. base::FEATURE_DISABLED_BY_DEFAULT};
  827. // When enabled, OOPIFs will not try to reuse compatible processes from
  828. // unrelated tabs.
  829. const base::Feature kDisableProcessReuse{"DisableProcessReuse",
  830. base::FEATURE_DISABLED_BY_DEFAULT};
  831. // Controls whether SpareRenderProcessHostManager tries to always have a warm
  832. // spare renderer process around for the most recently requested BrowserContext.
  833. // This feature is only consulted in site-per-process mode.
  834. const base::Feature kSpareRendererForSitePerProcess{
  835. "SpareRendererForSitePerProcess", base::FEATURE_ENABLED_BY_DEFAULT};
  836. const base::Feature kStopVideoCaptureOnScreenLock{
  837. "StopVideoCaptureOnScreenLock", base::FEATURE_ENABLED_BY_DEFAULT};
  838. // Controls whether site isolation should use origins instead of scheme and
  839. // eTLD+1.
  840. const base::Feature kStrictOriginIsolation{"StrictOriginIsolation",
  841. base::FEATURE_DISABLED_BY_DEFAULT};
  842. // Enables subresource loading with Web Bundles.
  843. const base::Feature kSubresourceWebBundles{"SubresourceWebBundles",
  844. base::FEATURE_ENABLED_BY_DEFAULT};
  845. // Disallows window.{alert, prompt, confirm} if triggered inside a subframe that
  846. // is not same origin with the main frame.
  847. const base::Feature kSuppressDifferentOriginSubframeJSDialogs{
  848. "SuppressDifferentOriginSubframeJSDialogs",
  849. base::FEATURE_DISABLED_BY_DEFAULT};
  850. // Dispatch touch events to "SyntheticGestureController" for events from
  851. // Devtool Protocol Input.dispatchTouchEvent to simulate touch events close to
  852. // real OS events.
  853. const base::Feature kSyntheticPointerActions{"SyntheticPointerActions",
  854. base::FEATURE_DISABLED_BY_DEFAULT};
  855. // Whether optimizations controlled by kNavigationThreadingOptimizations are
  856. // moved to the IO thread or a separate background thread.
  857. const base::Feature kThreadingOptimizationsOnIO{
  858. "ThreadingOptimizationsOnIO", base::FEATURE_DISABLED_BY_DEFAULT};
  859. // This feature allows touch dragging and a context menu to occur
  860. // simultaneously, with the assumption that the menu is non-modal. Without this
  861. // feature, a long-press touch gesture can start either a drag or a context-menu
  862. // in Blink, not both (more precisely, a context menu is shown only if a drag
  863. // cannot be started).
  864. const base::Feature kTouchDragAndContextMenu{"TouchDragAndContextMenu",
  865. base::FEATURE_DISABLED_BY_DEFAULT};
  866. // Enables async touchpad pinch zoom events. We check the ACK of the first
  867. // synthetic wheel event in a pinch sequence, then send the rest of the
  868. // synthetic wheel events of the pinch sequence as non-blocking if the first
  869. // event’s ACK is not canceled.
  870. const base::Feature kTouchpadAsyncPinchEvents{"TouchpadAsyncPinchEvents",
  871. base::FEATURE_ENABLED_BY_DEFAULT};
  872. // Allows swipe left/right from touchpad change browser navigation. Currently
  873. // only enabled by default on CrOS, LaCrOS and Windows.
  874. const base::Feature kTouchpadOverscrollHistoryNavigation {
  875. "TouchpadOverscrollHistoryNavigation",
  876. #if BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN)
  877. base::FEATURE_ENABLED_BY_DEFAULT
  878. #else
  879. base::FEATURE_DISABLED_BY_DEFAULT
  880. #endif
  881. };
  882. // When TreatBootstrapAsDefault is enabled, the browser will execute tasks with
  883. // the kBootstrap task type on the default task queues (based on priority of
  884. // the task) rather than a dedicated high-priority task queue. Intended to
  885. // evaluate the impact of the already-launched prioritization of bootstrap
  886. // tasks (crbug.com/1258621).
  887. const base::Feature kTreatBootstrapAsDefault{"TreatBootstrapAsDefault",
  888. base::FEATURE_ENABLED_BY_DEFAULT};
  889. // This feature is for a reverse Origin Trial, enabling SharedArrayBuffer for
  890. // sites as they migrate towards requiring cross-origin isolation for these
  891. // features.
  892. // TODO(bbudge): Remove when the deprecation is complete.
  893. // https://developer.chrome.com/origintrials/#/view_trial/303992974847508481
  894. // https://crbug.com/1144104
  895. const base::Feature kUnrestrictedSharedArrayBuffer{
  896. "UnrestrictedSharedArrayBuffer", base::FEATURE_DISABLED_BY_DEFAULT};
  897. // Allows user activation propagation to all frames having the same origin as
  898. // the activation notifier frame. This is an intermediate measure before we
  899. // have an iframe attribute to declaratively allow user activation propagation
  900. // to subframes.
  901. const base::Feature kUserActivationSameOriginVisibility{
  902. "UserActivationSameOriginVisibility", base::FEATURE_ENABLED_BY_DEFAULT};
  903. // Enables comparing browser and renderer's DidCommitProvisionalLoadParams in
  904. // RenderFrameHostImpl::VerifyThatBrowserAndRendererCalculatedDidCommitParamsMatch.
  905. const base::Feature kVerifyDidCommitParams{"VerifyDidCommitParams",
  906. base::FEATURE_DISABLED_BY_DEFAULT};
  907. // Controls whether the <video>.getVideoPlaybackQuality() API is enabled.
  908. const base::Feature kVideoPlaybackQuality{"VideoPlaybackQuality",
  909. base::FEATURE_ENABLED_BY_DEFAULT};
  910. // Enables future V8 VM features
  911. const base::Feature kV8VmFuture{"V8VmFuture",
  912. base::FEATURE_DISABLED_BY_DEFAULT};
  913. // Enable window controls overlays for desktop PWAs
  914. const base::Feature kWebAppWindowControlsOverlay{
  915. "WebAppWindowControlsOverlay", base::FEATURE_ENABLED_BY_DEFAULT};
  916. // Enable WebAssembly baseline compilation (Liftoff).
  917. const base::Feature kWebAssemblyBaseline{"WebAssemblyBaseline",
  918. base::FEATURE_ENABLED_BY_DEFAULT};
  919. // Enable memory protection for code JITed for WebAssembly.
  920. const base::Feature kWebAssemblyCodeProtection{
  921. "WebAssemblyCodeProtection", base::FEATURE_ENABLED_BY_DEFAULT};
  922. #if (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) && defined(ARCH_CPU_X86_64)
  923. // Use memory protection keys in userspace (PKU) (if available) to protect code
  924. // JITed for WebAssembly. Fall back to traditional memory protection if
  925. // WebAssemblyCodeProtection is also enabled.
  926. const base::Feature kWebAssemblyCodeProtectionPku{
  927. "WebAssemblyCodeProtectionPku", base::FEATURE_ENABLED_BY_DEFAULT};
  928. #endif // (BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)) &&
  929. // defined(ARCH_CPU_X86_64)
  930. // Enable WebAssembly stack switching.
  931. #if defined(ARCH_CPU_X86_64)
  932. const base::Feature kEnableExperimentalWebAssemblyStackSwitching{
  933. "WebAssemblyExperimentalStackSwitching", base::FEATURE_DISABLED_BY_DEFAULT};
  934. #endif // defined(ARCH_CPU_X86_64)
  935. // Enable WebAssembly dynamic tiering (only tier up hot functions).
  936. const base::Feature kWebAssemblyDynamicTiering{
  937. "WebAssemblyDynamicTiering", base::FEATURE_ENABLED_BY_DEFAULT};
  938. // Enable WebAssembly lazy compilation (JIT on first call).
  939. const base::Feature kWebAssemblyLazyCompilation{
  940. "WebAssemblyLazyCompilation", base::FEATURE_DISABLED_BY_DEFAULT};
  941. // Enable WebAssembly SIMD.
  942. // https://github.com/WebAssembly/Simd
  943. const base::Feature kWebAssemblySimd{"WebAssemblySimd",
  944. base::FEATURE_ENABLED_BY_DEFAULT};
  945. // Enable WebAssembly tiering (Liftoff -> TurboFan).
  946. const base::Feature kWebAssemblyTiering{"WebAssemblyTiering",
  947. base::FEATURE_ENABLED_BY_DEFAULT};
  948. // Enable WebAssembly trap handler.
  949. const base::Feature kWebAssemblyTrapHandler {
  950. "WebAssemblyTrapHandler",
  951. #if ((BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS) || BUILDFLAG(IS_WIN) || \
  952. BUILDFLAG(IS_MAC)) && \
  953. defined(ARCH_CPU_X86_64)) || \
  954. (BUILDFLAG(IS_MAC) && defined(ARCH_CPU_ARM64))
  955. base::FEATURE_ENABLED_BY_DEFAULT
  956. #else
  957. base::FEATURE_DISABLED_BY_DEFAULT
  958. #endif
  959. };
  960. // Controls whether WebAuthn conditional UI requests are supported.
  961. const base::Feature kWebAuthConditionalUI{"WebAuthenticationConditionalUI",
  962. base::FEATURE_DISABLED_BY_DEFAULT};
  963. // Controls whether the Web Bluetooth API is enabled:
  964. // https://webbluetoothcg.github.io/web-bluetooth/
  965. const base::Feature kWebBluetooth{"WebBluetooth",
  966. base::FEATURE_DISABLED_BY_DEFAULT};
  967. // Controls whether Web Bluetooth should use the new permissions backend. The
  968. // new permissions backend uses ChooserContextBase, which is used by other
  969. // device APIs, such as WebUSB. When enabled, WebBluetoothWatchAdvertisements
  970. // and WebBluetoothGetDevices blink features are also enabled.
  971. const base::Feature kWebBluetoothNewPermissionsBackend{
  972. "WebBluetoothNewPermissionsBackend", base::FEATURE_DISABLED_BY_DEFAULT};
  973. // Controls whether Web Bundles (Bundled HTTP Exchanges) is enabled.
  974. // https://wicg.github.io/webpackage/draft-yasskin-wpack-bundled-exchanges.html
  975. // When this feature is enabled, Chromium can load unsigned Web Bundles local
  976. // file under file:// URL (and content:// URI on Android).
  977. const base::Feature kWebBundles{"WebBundles",
  978. base::FEATURE_DISABLED_BY_DEFAULT};
  979. // When this feature is enabled, Chromium will be able to load unsigned Web
  980. // Bundles file under https: URL and localhost http: URL.
  981. // TODO(crbug.com/1018640): Implement this feature.
  982. const base::Feature kWebBundlesFromNetwork{"WebBundlesFromNetwork",
  983. base::FEATURE_DISABLED_BY_DEFAULT};
  984. // If WebGL Image Chromium is allowed, this feature controls whether it is
  985. // enabled.
  986. const base::Feature kWebGLImageChromium{"WebGLImageChromium",
  987. base::FEATURE_ENABLED_BY_DEFAULT};
  988. // Enable the browser process components of the Web MIDI API. This flag does not
  989. // control whether the API is exposed in Blink.
  990. const base::Feature kWebMidi{"WebMidi", base::FEATURE_ENABLED_BY_DEFAULT};
  991. // Controls which backend is used to retrieve OTP on Android. When disabled
  992. // we use User Consent API.
  993. const base::Feature kWebOtpBackendAuto{"WebOtpBackendAuto",
  994. base::FEATURE_DISABLED_BY_DEFAULT};
  995. // The JavaScript API for payments on the web.
  996. const base::Feature kWebPayments{"WebPayments",
  997. base::FEATURE_ENABLED_BY_DEFAULT};
  998. // Use GpuMemoryBuffer backed VideoFrames in media streams.
  999. const base::Feature kWebRtcUseGpuMemoryBufferVideoFrames{
  1000. "WebRTC-UseGpuMemoryBufferVideoFrames", base::FEATURE_ENABLED_BY_DEFAULT};
  1001. // Enables code caching for scripts used on WebUI pages.
  1002. const base::Feature kWebUICodeCache{"WebUICodeCache",
  1003. base::FEATURE_DISABLED_BY_DEFAULT};
  1004. // Enables report-only Trusted Types experiment on WebUIs
  1005. const base::Feature kWebUIReportOnlyTrustedTypes{
  1006. "WebUIReportOnlyTrustedTypes", base::FEATURE_DISABLED_BY_DEFAULT};
  1007. // Controls whether the WebUSB API is enabled:
  1008. // https://wicg.github.io/webusb
  1009. const base::Feature kWebUsb{"WebUSB", base::FEATURE_ENABLED_BY_DEFAULT};
  1010. // Controls whether the WebXR Device API is enabled.
  1011. const base::Feature kWebXr{"WebXR", base::FEATURE_ENABLED_BY_DEFAULT};
  1012. // Enables access to AR features via the WebXR API.
  1013. const base::Feature kWebXrArModule{"WebXRARModule",
  1014. base::FEATURE_ENABLED_BY_DEFAULT};
  1015. #if BUILDFLAG(IS_ANDROID)
  1016. // Allows the use of page zoom in place of accessibility text autosizing, and
  1017. // updated UI to replace existing Chrome Accessibility Settings.
  1018. const base::Feature kAccessibilityPageZoom{"AccessibilityPageZoom",
  1019. base::FEATURE_DISABLED_BY_DEFAULT};
  1020. // Sets moderate binding to background renderers playing media, when enabled.
  1021. // Else the renderer will have strong binding.
  1022. const base::Feature kBackgroundMediaRendererHasModerateBinding{
  1023. "BackgroundMediaRendererHasModerateBinding",
  1024. base::FEATURE_DISABLED_BY_DEFAULT};
  1025. // When this feature is enabled the BindingManager for non-low-end devices will
  1026. // use a not perceptible binding for background renderers on Android Q+.
  1027. const base::Feature kBindingManagerUseNotPerceptibleBinding{
  1028. "BindingManagerUseNotPerceptibleBinding",
  1029. base::FEATURE_DISABLED_BY_DEFAULT};
  1030. // Reduce the priority of GPU process when in background so it is more likely
  1031. // to be killed first if the OS needs more memory.
  1032. const base::Feature kReduceGpuPriorityOnBackground{
  1033. "ReduceGpuPriorityOnBackground", base::FEATURE_DISABLED_BY_DEFAULT};
  1034. // Allows the use of an experimental feature to drop any AccessibilityEvents
  1035. // that are not relevant to currently enabled accessibility services.
  1036. const base::Feature kOnDemandAccessibilityEvents{
  1037. "OnDemandAccessibilityEvents", base::FEATURE_DISABLED_BY_DEFAULT};
  1038. // Request Desktop Site secondary settings for Android; including display
  1039. // setting and peripheral setting.
  1040. const base::Feature kRequestDesktopSiteAdditions{
  1041. "RequestDesktopSiteAdditions", base::FEATURE_DISABLED_BY_DEFAULT};
  1042. // Request Desktop Site per-site setting for Android.
  1043. // Refer to the launch bug (https://crbug.com/1244979) for more information.
  1044. const base::Feature kRequestDesktopSiteExceptions{
  1045. "RequestDesktopSiteExceptions", base::FEATURE_DISABLED_BY_DEFAULT};
  1046. // Screen Capture API support for Android
  1047. const base::Feature kUserMediaScreenCapturing{
  1048. "UserMediaScreenCapturing", base::FEATURE_DISABLED_BY_DEFAULT};
  1049. // Pre-warm up the network process on browser startup.
  1050. const base::Feature kWarmUpNetworkProcess{"WarmUpNetworkProcess",
  1051. base::FEATURE_DISABLED_BY_DEFAULT};
  1052. // Kill switch for the WebNFC feature. This feature can be enabled for all sites
  1053. // using the kEnableExperimentalWebPlatformFeatures flag.
  1054. // https://w3c.github.io/web-nfc/
  1055. const base::Feature kWebNfc{"WebNFC", base::FEATURE_ENABLED_BY_DEFAULT};
  1056. // When the context menu is triggered, the browser allows motion in a small
  1057. // region around the initial touch location menu to allow for finger jittering.
  1058. // This param holds the movement threshold in DIPs to consider drag an
  1059. // intentional drag, which will dismiss the current context menu and prevent new
  1060. // menu from showing.
  1061. const char kDragAndDropMovementThresholdDipParam[] =
  1062. "DragAndDropMovementThresholdDipParam";
  1063. // Temporarily pauses the compositor early in navigation.
  1064. const base::Feature kOptimizeEarlyNavigation{"OptimizeEarlyNavigation",
  1065. base::FEATURE_ENABLED_BY_DEFAULT};
  1066. const base::FeatureParam<base::TimeDelta> kCompositorLockTimeout{
  1067. &kOptimizeEarlyNavigation, "compositor_lock_timeout",
  1068. base::Milliseconds(150)};
  1069. #endif // BUILDFLAG(IS_ANDROID)
  1070. #if BUILDFLAG(IS_MAC)
  1071. // Enables caching of media devices for the purpose of enumerating them.
  1072. const base::Feature kDeviceMonitorMac{"DeviceMonitorMac",
  1073. base::FEATURE_ENABLED_BY_DEFAULT};
  1074. // Enable IOSurface based screen capturer.
  1075. const base::Feature kIOSurfaceCapturer{"IOSurfaceCapturer",
  1076. base::FEATURE_ENABLED_BY_DEFAULT};
  1077. const base::Feature kMacSyscallSandbox{"MacSyscallSandbox",
  1078. base::FEATURE_DISABLED_BY_DEFAULT};
  1079. // Feature that controls whether WebContentsOcclusionChecker should handle
  1080. // occlusion notifications.
  1081. const base::Feature kMacWebContentsOcclusion{"MacWebContentsOcclusion",
  1082. base::FEATURE_DISABLED_BY_DEFAULT};
  1083. // Enables retrying to obtain list of available cameras on Macbooks after
  1084. // restarting the video capture service if a previous attempt delivered zero
  1085. // cameras.
  1086. const base::Feature kRetryGetVideoCaptureDeviceInfos{
  1087. "RetryGetVideoCaptureDeviceInfos", base::FEATURE_DISABLED_BY_DEFAULT};
  1088. #endif // BUILDFLAG(IS_MAC)
  1089. #if defined(WEBRTC_USE_PIPEWIRE)
  1090. // Controls whether the PipeWire support for screen capturing is enabled on the
  1091. // Wayland display server.
  1092. const base::Feature kWebRtcPipeWireCapturer{"WebRTCPipeWireCapturer",
  1093. base::FEATURE_ENABLED_BY_DEFAULT};
  1094. #endif // defined(WEBRTC_USE_PIPEWIRE)
  1095. enum class VideoCaptureServiceConfiguration {
  1096. kEnabledForOutOfProcess,
  1097. kEnabledForBrowserProcess,
  1098. kDisabled
  1099. };
  1100. bool ShouldEnableVideoCaptureService() {
  1101. return base::FeatureList::IsEnabled(features::kMojoVideoCapture) &&
  1102. base::FeatureList::IsEnabled(features::kMojoVideoCaptureSecondary);
  1103. }
  1104. VideoCaptureServiceConfiguration GetVideoCaptureServiceConfiguration() {
  1105. if (!ShouldEnableVideoCaptureService())
  1106. return VideoCaptureServiceConfiguration::kDisabled;
  1107. // On ChromeOS the service must run in the browser process, because parts of the
  1108. // code depend on global objects that are only available in the Browser process.
  1109. // See https://crbug.com/891961.
  1110. #if BUILDFLAG(IS_ANDROID) || BUILDFLAG(IS_CHROMEOS)
  1111. return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
  1112. #else
  1113. #if BUILDFLAG(IS_WIN)
  1114. if (base::win::GetVersion() <= base::win::Version::WIN7)
  1115. return VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
  1116. #endif
  1117. return base::FeatureList::IsEnabled(
  1118. features::kRunVideoCaptureServiceInBrowserProcess)
  1119. ? VideoCaptureServiceConfiguration::kEnabledForBrowserProcess
  1120. : VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
  1121. #endif
  1122. }
  1123. bool IsVideoCaptureServiceEnabledForOutOfProcess() {
  1124. return GetVideoCaptureServiceConfiguration() ==
  1125. VideoCaptureServiceConfiguration::kEnabledForOutOfProcess;
  1126. }
  1127. bool IsVideoCaptureServiceEnabledForBrowserProcess() {
  1128. return GetVideoCaptureServiceConfiguration() ==
  1129. VideoCaptureServiceConfiguration::kEnabledForBrowserProcess;
  1130. }
  1131. } // namespace features