#include "net/first_party_sets/global_first_party_sets.h"
#include <iterator>
#include <map>
#include <optional>
#include <set>
#include <tuple>
#include <utility>
#include "base/containers/contains.h"
#include "base/containers/flat_map.h"
#include "base/containers/flat_set.h"
#include "base/functional/function_ref.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "base/types/optional_util.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/addition_overlaps_union_find.h"
#include "net/first_party_sets/first_party_set_entry.h"
#include "net/first_party_sets/first_party_set_entry_override.h"
#include "net/first_party_sets/first_party_set_metadata.h"
#include "net/first_party_sets/first_party_sets_context_config.h"
#include "net/first_party_sets/first_party_sets_validator.h"
#include "net/first_party_sets/local_set_declaration.h"
namespace net {
namespace {
FlattenedSets;
SingleSet;
FlattenedSets Flatten(const std::vector<SingleSet>& set_list) { … }
std::pair<SchemefulSite, FirstPartySetEntryOverride>
SiteAndEntryToSiteAndOverride(
const std::pair<SchemefulSite, FirstPartySetEntry>& pair) { … }
}
GlobalFirstPartySets::GlobalFirstPartySets() = default;
GlobalFirstPartySets::GlobalFirstPartySets(
base::Version public_sets_version,
base::flat_map<SchemefulSite, FirstPartySetEntry> entries,
base::flat_map<SchemefulSite, SchemefulSite> aliases)
: … { … }
GlobalFirstPartySets::GlobalFirstPartySets(
base::Version public_sets_version,
base::flat_map<SchemefulSite, FirstPartySetEntry> entries,
base::flat_map<SchemefulSite, SchemefulSite> aliases,
FirstPartySetsContextConfig manual_config,
base::flat_map<SchemefulSite, SchemefulSite> manual_aliases)
: … { … }
GlobalFirstPartySets::GlobalFirstPartySets(GlobalFirstPartySets&&) = default;
GlobalFirstPartySets& GlobalFirstPartySets::operator=(GlobalFirstPartySets&&) =
default;
GlobalFirstPartySets::~GlobalFirstPartySets() = default;
bool GlobalFirstPartySets::operator==(const GlobalFirstPartySets& other) const =
default;
bool GlobalFirstPartySets::operator!=(const GlobalFirstPartySets& other) const =
default;
GlobalFirstPartySets GlobalFirstPartySets::Clone() const { … }
std::optional<FirstPartySetEntry> GlobalFirstPartySets::FindEntry(
const SchemefulSite& site,
const FirstPartySetsContextConfig& config) const { … }
std::optional<FirstPartySetEntry> GlobalFirstPartySets::FindEntry(
const SchemefulSite& site,
const FirstPartySetsContextConfig* config) const { … }
base::flat_map<SchemefulSite, FirstPartySetEntry>
GlobalFirstPartySets::FindEntries(
const base::flat_set<SchemefulSite>& sites,
const FirstPartySetsContextConfig& config) const { … }
FirstPartySetMetadata GlobalFirstPartySets::ComputeMetadata(
const SchemefulSite& site,
const SchemefulSite* top_frame_site,
const FirstPartySetsContextConfig& fps_context_config) const { … }
void GlobalFirstPartySets::ApplyManuallySpecifiedSet(
const LocalSetDeclaration& local_set_declaration) { … }
void GlobalFirstPartySets::UnsafeSetManualConfig(
FirstPartySetsContextConfig manual_config) { … }
base::flat_map<SchemefulSite, FirstPartySetEntry>
GlobalFirstPartySets::FindPrimariesAffectedByAdditions(
const FlattenedSets& additions) const { … }
std::pair<base::flat_map<SchemefulSite, base::flat_set<SchemefulSite>>,
base::flat_set<SchemefulSite>>
GlobalFirstPartySets::FindPrimariesAffectedByReplacements(
const FlattenedSets& replacements,
const FlattenedSets& additions,
const base::flat_map<SchemefulSite, FirstPartySetEntry>&
addition_intersected_primaries) const { … }
FirstPartySetsContextConfig GlobalFirstPartySets::ComputeConfig(
const SetsMutation& mutation) const { … }
std::vector<base::flat_map<SchemefulSite, FirstPartySetEntry>>
GlobalFirstPartySets::NormalizeAdditionSets(
const std::vector<base::flat_map<SchemefulSite, FirstPartySetEntry>>&
addition_sets) const { … }
bool GlobalFirstPartySets::ForEachPublicSetEntry(
base::FunctionRef<bool(const SchemefulSite&, const FirstPartySetEntry&)> f)
const { … }
bool GlobalFirstPartySets::ForEachManualConfigEntry(
base::FunctionRef<bool(const SchemefulSite&,
const FirstPartySetEntryOverride&)> f) const { … }
bool GlobalFirstPartySets::ForEachEffectiveSetEntry(
const FirstPartySetsContextConfig& config,
base::FunctionRef<bool(const SchemefulSite&, const FirstPartySetEntry&)> f)
const { … }
bool GlobalFirstPartySets::ForEachEffectiveSetEntry(
const FirstPartySetsContextConfig* config,
base::FunctionRef<bool(const SchemefulSite&, const FirstPartySetEntry&)> f)
const { … }
void GlobalFirstPartySets::ForEachAlias(
base::FunctionRef<void(const SchemefulSite&, const SchemefulSite&)> f)
const { … }
bool GlobalFirstPartySets::IsValid(
const FirstPartySetsContextConfig* config) const { … }
std::ostream& operator<<(std::ostream& os, const GlobalFirstPartySets& sets) { … }
}