#include "components/attribution_reporting/attribution_scopes_set.h"
#include <stddef.h>
#include <stdint.h>
#include <limits>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include "base/check_op.h"
#include "base/containers/flat_set.h"
#include "base/notreached.h"
#include "base/ranges/algorithm.h"
#include "base/types/expected.h"
#include "base/types/expected_macros.h"
#include "base/values.h"
#include "components/attribution_reporting/constants.h"
#include "components/attribution_reporting/parsing_utils.h"
#include "components/attribution_reporting/source_registration_error.mojom.h"
#include "components/attribution_reporting/trigger_registration_error.mojom.h"
namespace attribution_reporting {
namespace {
SourceRegistrationError;
TriggerRegistrationError;
enum class AttributionScopesError { … };
base::expected<AttributionScopesSet, AttributionScopesError> ScopesFromJSON(
base::Value::List* list,
size_t max_string_size,
size_t max_set_size) { … }
void Serialize(const base::flat_set<std::string>& scopes,
std::string_view key,
base::Value::Dict& dict) { … }
}
base::expected<AttributionScopesSet, SourceRegistrationError>
AttributionScopesSet::FromJSON(base::Value::Dict& reg,
uint32_t attribution_scope_limit) { … }
base::expected<AttributionScopesSet, TriggerRegistrationError>
AttributionScopesSet::FromJSON(base::Value::Dict& reg) { … }
AttributionScopesSet::AttributionScopesSet(Scopes scopes)
: … { … }
AttributionScopesSet::AttributionScopesSet() = default;
AttributionScopesSet::~AttributionScopesSet() = default;
AttributionScopesSet::AttributionScopesSet(const AttributionScopesSet&) =
default;
AttributionScopesSet::AttributionScopesSet(AttributionScopesSet&&) = default;
AttributionScopesSet& AttributionScopesSet::operator=(
const AttributionScopesSet&) = default;
AttributionScopesSet& AttributionScopesSet::operator=(AttributionScopesSet&&) =
default;
bool AttributionScopesSet::IsValidForSource(uint32_t scope_limit) const { … }
void AttributionScopesSet::SerializeForSource(base::Value::Dict& dict) const { … }
void AttributionScopesSet::SerializeForTrigger(base::Value::Dict& dict) const { … }
bool AttributionScopesSet::HasIntersection(
const AttributionScopesSet& other_scopes) const { … }
}