• 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   // When specified, the user has indicated to force allowing third-party
17   // cookies.
18   kForceThirdPartyByUser = 0,
19   // When specified, third-party cookies may be allowed based on existence of
20   // TopLevelStorageAccess grants.
21   kTopLevelStorageAccessGrantEligible = 1,
22   // When present, the caller may use an existing Storage Access API grant (if
23   // a matching grant exists) to access third-party cookies. Otherwise, Storage
24   // Access API grants do not apply.
25   // TODO(https://crbug.com/1401089): this description isn't true yet; these
26   // variants are currently ignored, and grants are always accessible. This will
27   // be updated once all callers have been updated to pass this variant when
28   // appropriate.
29   kStorageAccessGrantEligible = 2,
30   kMaxValue = kStorageAccessGrantEligible,
31 };
32 
33 using CookieSettingOverrides =
34     base::EnumSet<CookieSettingOverride,
35                   CookieSettingOverride::kForceThirdPartyByUser,
36                   CookieSettingOverride::kMaxValue>;
37 
38 }  // namespace net
39 
40 #endif  // NET_COOKIES_COOKIE_SETTING_OVERRIDE_H_
41