1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
content / browser / attribution_reporting / attribution_config.h [blame]
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_CONFIG_H_
#define CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_CONFIG_H_
#include <stdint.h>
#include "base/time/time.h"
#include "components/attribution_reporting/constants.h"
#include "components/attribution_reporting/privacy_math.h"
#include "content/common/content_export.h"
namespace content {
// See https://wicg.github.io/attribution-reporting-api/#vendor-specific-values
// for details.
struct CONTENT_EXPORT AttributionConfig {
// Controls rate limits for the API.
struct CONTENT_EXPORT RateLimitConfig {
RateLimitConfig();
~RateLimitConfig();
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
// Controls the rate-limiting time window for attribution.
base::TimeDelta time_window = base::Days(30);
// Maximum number of distinct reporting origins that can register sources
// for a given <source site, destination site> in `time_window`.
int64_t max_source_registration_reporting_origins = 100;
// Maximum number of distinct reporting origins that can create attributions
// for a given <source site, destination site> in `time_window`.
int64_t max_attribution_reporting_origins = 10;
// Maximum number of attributions for a given <source site, destination
// site, reporting site> in `time_window`.
int64_t max_attributions = 100;
// Maximum number of distinct reporting origins for a given <source site,
// reporting site> in `origins_per_site_window`.
int max_reporting_origins_per_source_reporting_site = 1;
// Controls the time window for reporting origins per site limit.
base::TimeDelta origins_per_site_window = base::Days(1);
friend bool operator==(const RateLimitConfig&,
const RateLimitConfig&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
struct CONTENT_EXPORT EventLevelLimit {
EventLevelLimit();
EventLevelLimit(const EventLevelLimit&);
EventLevelLimit(EventLevelLimit&&);
~EventLevelLimit();
EventLevelLimit& operator=(const EventLevelLimit&);
EventLevelLimit& operator=(EventLevelLimit&&);
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
// Controls how many reports can be in the storage per attribution
// destination.
int max_reports_per_destination = 1024;
friend bool operator==(const EventLevelLimit&,
const EventLevelLimit&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
struct CONTENT_EXPORT AggregateLimit {
AggregateLimit();
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
// Controls how many reports can be in the storage per attribution
// destination.
int max_reports_per_destination = 1024;
// Controls the report delivery time.
base::TimeDelta min_delay;
base::TimeDelta delay_span = base::Minutes(10);
double null_reports_rate_include_source_registration_time =
attribution_reporting::kNullReportsRateIncludeSourceRegistrationTime;
double null_reports_rate_exclude_source_registration_time =
attribution_reporting::kNullReportsRateExcludeSourceRegistrationTime;
int max_aggregatable_reports_per_source = 20;
friend bool operator==(const AggregateLimit&,
const AggregateLimit&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
struct CONTENT_EXPORT DestinationRateLimit {
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
static constexpr base::TimeDelta kPerDayRateLimitWindow = base::Days(1);
int max_total = 200;
int max_per_reporting_site = 50;
base::TimeDelta rate_limit_window = base::Minutes(1);
int max_per_reporting_site_per_day = 100;
friend bool operator==(const DestinationRateLimit&,
const DestinationRateLimit&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
struct CONTENT_EXPORT AggregatableDebugRateLimit {
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
int max_budget_per_context_site = 1048576;
int max_budget_per_context_reporting_site = 65536;
static constexpr base::TimeDelta kRateLimitWindow = base::Days(1);
int max_reports_per_source = 5;
friend bool operator==(const AggregatableDebugRateLimit&,
const AggregatableDebugRateLimit&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
AttributionConfig();
AttributionConfig(const AttributionConfig&);
AttributionConfig(AttributionConfig&&);
~AttributionConfig();
AttributionConfig& operator=(const AttributionConfig&);
AttributionConfig& operator=(AttributionConfig&&);
// Returns true if this config is valid.
[[nodiscard]] bool Validate() const;
// Controls how many sources can be in the storage per source origin.
int max_sources_per_origin = 4096;
// Controls the maximum number of distinct attribution destinations that can
// be in storage at any time for sources with the same <source site, reporting
// site>.
int max_destinations_per_source_site_reporting_site = 100;
RateLimitConfig rate_limit;
EventLevelLimit event_level_limit;
AggregateLimit aggregate_limit;
DestinationRateLimit destination_rate_limit;
AggregatableDebugRateLimit aggregatable_debug_rate_limit;
attribution_reporting::PrivacyMathConfig privacy_math_config;
friend bool operator==(const AttributionConfig&,
const AttributionConfig&) = default;
// When adding new members, the corresponding `Validate()` definition
// should also be updated.
};
} // namespace content
#endif // CONTENT_BROWSER_ATTRIBUTION_REPORTING_ATTRIBUTION_CONFIG_H_