• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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. This "opt-in"
22   // signal is from script execution, i.e. `document.requestStorageAccess()`.
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   // When specified, third party cookies should be forced disabled.
36   // Other cookie exceptions like the storage access API could result in
37   // third party cookies still being used when this is forced disabled.
38   // Used by WebView.
39   kForceDisableThirdPartyCookies = 6,
40   // When present, the caller may use an existing Storage Access API grant to
41   // access third-party cookies. Note that some integrations which have more
42   // stringent requirements, such as the FedCM/SAA integration (which requires
43   // the `identity-credentials-get` policy), are not in scope for this variant.
44   kStorageAccessGrantEligibleViaHeader = 7,
45 
46   kMaxValue = kStorageAccessGrantEligibleViaHeader,
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