chromium/components/attribution_reporting/attribution_scopes_set.cc

// Copyright 2024 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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) {}

}  // namespace

// static
base::expected<AttributionScopesSet, SourceRegistrationError>
AttributionScopesSet::FromJSON(base::Value::Dict& reg,
                               uint32_t attribution_scope_limit) {}

// static
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 {}

// Rather than retrieving the whole intersection and checking its size using
// `std::set_intersection`, we iterate through and compare each element and
// early exit when two matching elements are found.
bool AttributionScopesSet::HasIntersection(
    const AttributionScopesSet& other_scopes) const {}

}  // namespace attribution_reporting