#ifndef NET_FIRST_PARTY_SETS_FIRST_PARTY_SETS_CONTEXT_CONFIG_H_
#define NET_FIRST_PARTY_SETS_FIRST_PARTY_SETS_CONTEXT_CONFIG_H_
#include <optional>
#include "base/containers/flat_map.h"
#include "base/functional/function_ref.h"
#include "net/base/schemeful_site.h"
#include "net/first_party_sets/first_party_set_entry_override.h"
namespace mojo {
template <typename DataViewType, typename T>
struct StructTraits;
}
namespace network::mojom {
class FirstPartySetsContextConfigDataView;
}
namespace net {
class NET_EXPORT FirstPartySetsContextConfig {
public:
FirstPartySetsContextConfig();
static std::optional<FirstPartySetsContextConfig> Create(
base::flat_map<SchemefulSite, FirstPartySetEntryOverride> customizations,
base::flat_map<SchemefulSite, SchemefulSite> aliases = {});
FirstPartySetsContextConfig(FirstPartySetsContextConfig&& other);
FirstPartySetsContextConfig& operator=(FirstPartySetsContextConfig&& other);
~FirstPartySetsContextConfig();
FirstPartySetsContextConfig Clone() const;
bool operator==(const FirstPartySetsContextConfig& other) const;
bool empty() const { return customizations_.empty(); }
std::optional<FirstPartySetEntryOverride> FindOverride(
const SchemefulSite& site) const;
bool Contains(const SchemefulSite& site) const;
bool ForEachCustomizationEntry(
base::FunctionRef<bool(const SchemefulSite&,
const FirstPartySetEntryOverride&)> f) const;
void ForEachAlias(base::FunctionRef<void(const SchemefulSite&,
const SchemefulSite&)> f) const;
private:
friend struct mojo::StructTraits<
network::mojom::FirstPartySetsContextConfigDataView,
FirstPartySetsContextConfig>;
FirstPartySetsContextConfig(
base::flat_map<SchemefulSite, FirstPartySetEntryOverride> customizations,
base::flat_map<SchemefulSite, SchemefulSite> aliases);
base::flat_map<SchemefulSite, FirstPartySetEntryOverride> customizations_;
base::flat_map<SchemefulSite, SchemefulSite> aliases_;
};
}
#endif