1 // Copyright 2022 The Chromium Authors 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef NET_COOKIES_COOKIE_SETTING_OVERRIDE_H_ 6 #define NET_COOKIES_COOKIE_SETTING_OVERRIDE_H_ 7 8 #include "base/containers/enum_set.h" 9 10 namespace net { 11 12 // An enum of possible overrides for cookie setting checks. 13 // Use CookieSettingOverrides below for specifying any number of overrides 14 // together. The notion of no overrides is conveyable via an empty set. 15 enum class CookieSettingOverride { 16 kMinValue = 0, 17 // When specified, third-party cookies may be allowed based on existence of 18 // TopLevelStorageAccess grants. 19 kTopLevelStorageAccessGrantEligible = kMinValue, 20 // When present, the caller may use an existing Storage Access API grant (if 21 // a matching grant exists) to access third-party cookies. Otherwise, Storage 22 // Access API grants do not apply. 23 kStorageAccessGrantEligible = 1, 24 // Allows TPCD mitigations to be skipped when checking if third party cookies 25 // are allowed, meaning cookies will be blocked despite the presence of any of 26 // these grants/heuristics. 27 kSkipTPCDHeuristicsGrant = 2, 28 kSkipTPCDMetadataGrant = 3, 29 // Corresponds to skipping checks on the TPCD_TRIAL content setting, which 30 // backs 3PC accesses granted via 3PC deprecation trial. 31 kSkipTPCDTrial = 4, 32 // Corresponds to skipping checks on the TOP_LEVEL_TPCD_TRIAL content setting, 33 // which backs 3PC accesses granted via top-level 3PC deprecation trial. 34 kSkipTopLevelTPCDTrial = 5, 35 // Corresponds to checks that may grant 3PCs when a request opts into 36 // credentials and CORS protection. 37 // One example are subresource requests that are same-site with the top-level 38 // site but originate from a cross-site embed. 39 kCrossSiteCredentialedWithCORS = 6, 40 // When specified, third party cookies should be forced disabled. 41 // Other cookie exceptions like the storage access API could result in 42 // third party cookies still being used when this is forced disabled. 43 // Used by WebView. 44 kForceDisableThirdPartyCookies = 7, 45 46 kMaxValue = kForceDisableThirdPartyCookies, 47 }; 48 49 using CookieSettingOverrides = base::EnumSet<CookieSettingOverride, 50 CookieSettingOverride::kMinValue, 51 CookieSettingOverride::kMaxValue>; 52 53 } // namespace net 54 55 #endif // NET_COOKIES_COOKIE_SETTING_OVERRIDE_H_ 56