#ifndef NET_FIRST_PARTY_SETS_FIRST_PARTY_SET_ENTRY_OVERRIDE_H_
#define NET_FIRST_PARTY_SETS_FIRST_PARTY_SET_ENTRY_OVERRIDE_H_
#include <optional>
#include "net/base/net_export.h"
#include "net/first_party_sets/first_party_set_entry.h"
namespace mojo {
template <typename DataViewType, typename T>
struct StructTraits;
}
namespace network::mojom {
class FirstPartySetEntryOverrideDataView;
}
namespace net {
class NET_EXPORT FirstPartySetEntryOverride {
public:
FirstPartySetEntryOverride();
explicit FirstPartySetEntryOverride(FirstPartySetEntry entry);
FirstPartySetEntryOverride(FirstPartySetEntryOverride&& other);
FirstPartySetEntryOverride& operator=(FirstPartySetEntryOverride&& other);
FirstPartySetEntryOverride(const FirstPartySetEntryOverride& other);
FirstPartySetEntryOverride& operator=(
const FirstPartySetEntryOverride& other);
~FirstPartySetEntryOverride();
bool operator==(const FirstPartySetEntryOverride& other) const;
bool IsDeletion() const { return !entry_.has_value(); }
const FirstPartySetEntry& GetEntry() const {
CHECK(!IsDeletion());
return entry_.value();
}
private:
friend struct mojo::StructTraits<
network::mojom::FirstPartySetEntryOverrideDataView,
FirstPartySetEntryOverride>;
std::optional<FirstPartySetEntry> entry_;
};
NET_EXPORT std::ostream& operator<<(std::ostream& os,
const FirstPartySetEntryOverride& override);
}
#endif