#include "third_party/blink/public/common/storage_key/storage_key.h"
#include <memory>
#include <ostream>
#include <string>
#include <string_view>
#include <tuple>
#include "base/feature_list.h"
#include "base/ranges/algorithm.h"
#include "base/strings/strcat.h"
#include "base/strings/string_number_conversions.h"
#include "base/types/optional_util.h"
#include "net/base/features.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "third_party/abseil-cpp/absl/strings/ascii.h"
#include "url/gurl.h"
namespace {
enum class EncodedAttribute : uint8_t { … };
std::string SerializeAttributeSeparator(const EncodedAttribute type) { … }
std::optional<EncodedAttribute> DeserializeAttributeSeparator(
const std::string_view& in) { … }
bool ValidSeparatorWithData(std::string_view in, size_t pos_of_caret) { … }
}
namespace blink {
std::optional<StorageKey> StorageKey::Deserialize(std::string_view in) { … }
std::optional<StorageKey> StorageKey::DeserializeForLocalStorage(
std::string_view in) { … }
StorageKey StorageKey::CreateFromStringForTesting(const std::string& origin) { … }
bool StorageKey::FromWire(
const url::Origin& origin,
const net::SchemefulSite& top_level_site,
const net::SchemefulSite& top_level_site_if_third_party_enabled,
const std::optional<base::UnguessableToken>& nonce,
blink::mojom::AncestorChainBit ancestor_chain_bit,
blink::mojom::AncestorChainBit ancestor_chain_bit_if_third_party_enabled,
StorageKey& out) { … }
bool StorageKey::IsThirdPartyStoragePartitioningEnabled() { … }
StorageKey StorageKey::CreateFirstParty(const url::Origin& origin) { … }
StorageKey StorageKey::CreateWithNonce(const url::Origin& origin,
const base::UnguessableToken& nonce) { … }
StorageKey StorageKey::Create(const url::Origin& origin,
const net::SchemefulSite& top_level_site,
blink::mojom::AncestorChainBit ancestor_chain_bit,
bool third_party_partitioning_allowed) { … }
StorageKey StorageKey::CreateFromOriginAndIsolationInfo(
const url::Origin& origin,
const net::IsolationInfo& isolation_info) { … }
StorageKey StorageKey::WithOrigin(const url::Origin& origin) const { … }
StorageKey::StorageKey(const url::Origin& origin,
const net::SchemefulSite& top_level_site,
const base::UnguessableToken* nonce,
blink::mojom::AncestorChainBit ancestor_chain_bit,
bool third_party_partitioning_allowed)
: … { … }
std::string StorageKey::Serialize() const { … }
std::string StorageKey::SerializeForLocalStorage() const { … }
std::string StorageKey::GetDebugString() const { … }
std::string StorageKey::GetMemoryDumpString(size_t max_length) const { … }
const net::SiteForCookies StorageKey::ToNetSiteForCookies() const { … }
const net::IsolationInfo StorageKey::ToPartialNetIsolationInfo() const { … }
bool StorageKey::ShouldSkipKeyDueToPartitioning(
const std::string& reg_key_string) { … }
const std::optional<net::CookiePartitionKey> StorageKey::ToCookiePartitionKey()
const { … }
bool StorageKey::MatchesOriginForTrustedStorageDeletion(
const url::Origin& origin) const { … }
bool StorageKey::MatchesRegistrableDomainForTrustedStorageDeletion(
std::string_view domain) const { … }
bool StorageKey::ExactMatchForTesting(const StorageKey& other) const { … }
bool operator==(const StorageKey& lhs, const StorageKey& rhs) { … }
bool operator!=(const StorageKey& lhs, const StorageKey& rhs) { … }
bool operator<(const StorageKey& lhs, const StorageKey& rhs) { … }
std::ostream& operator<<(std::ostream& ostream, const StorageKey& sk) { … }
bool StorageKey::IsValid() const { … }
}