// 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.
module network.mojom;
import "mojo/public/mojom/base/version.mojom";
import "services/network/public/mojom/schemeful_site.mojom";
// This struct should match net::FirstPartySetEntry::SiteIndex in
// //net/first_party_sets/first_party_set_entry.h
struct SiteIndex {
uint32 value;
};
// This enum should match //net/first_party_sets/first_party_set_entry.h.
enum SiteType {
kPrimary,
kAssociated,
kService,
};
// This struct should match //net/first_party_sets/first_party_set_entry.h.
struct FirstPartySetEntry {
SchemefulSite primary;
SiteType site_type;
SiteIndex? site_index;
};
// This struct must match the class fields defined in
// //net/first_party_sets/first_party_set_metadata.h.
struct FirstPartySetMetadata {
// std::nullopt indicates that the frame's site is not associated with any
// First-Party Set.
FirstPartySetEntry? frame_entry;
// std::nullopt indicates that the top frame's site is not associated with
// any First-Party Set.
FirstPartySetEntry? top_frame_entry;
};
struct FirstPartySetEntryOverride {
// If `entry` is null, that means the site is considered deleted from the
// existing First-Party Sets, for the given context. Otherwise, the site is
// considered re-mapped to a potentially different/new First-Party Set, using
// the given entry.
FirstPartySetEntry? entry;
};
// This struct must match the class fields defined in
// //net/first_party_sets/first_party_sets_context_config.h.
struct FirstPartySetsContextConfig {
// This map must be computed against the public First-Party Sets, where the
// keys are member sites and the values are the ultimate entries of the final
// First-Party Sets combining the public sets and the modifications.
map<SchemefulSite, FirstPartySetEntryOverride> customizations;
};
// This struct must match the class fields defined in
// //net/first_party_sets/first_party_sets_cache_filter.h.
struct FirstPartySetsCacheFilter {
// The filter used to bypass cache. The key is site may be bypassed for
// cache access, the value indicates the browser run of which the site
// was marked to be cleared.
map<SchemefulSite, int64> filter;
// The id of the current browser run, to mark the cache entry when persisting.
// The cache filter should be no-op if this is 0.
// TODO(crbug.com/40489779): Make this optional.
int64 browser_run_id = 0;
};
// This struct must match the class fields defined in
// //net/first_party_sets/global_first_party_sets.h.
struct GlobalFirstPartySets {
// The version of the public sets component. This may be invalid if the
// "First-Party Sets" component has not been installed yet, or has been
// corrupted. Entries and aliases from invalid components are ignored.
mojo_base.mojom.Version public_sets_version;
// The mapping from site to FPS entry from public sets.
map<SchemefulSite, FirstPartySetEntry> sets;
// The mapping from site alias to canonical site from public sets.
map<SchemefulSite, SchemefulSite> aliases;
// The config induced by the manually-supplied set. This config contains all
// relevant ccTLD aliases.
FirstPartySetsContextConfig manual_config;
// The aliases contained in the manually-supplied set.
map<SchemefulSite, SchemefulSite> manual_aliases;
};