#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "third_party/blink/renderer/core/loader/alternate_signed_exchange_resource_info.h"
#include "media/media_buildflags.h"
#include "net/http/http_request_headers.h"
#include "services/network/public/cpp/constants.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "third_party/blink/public/common/loader/network_utils.h"
#include "third_party/blink/public/common/web_package/signed_exchange_consts.h"
#include "third_party/blink/public/common/web_package/web_package_request_matcher.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink.h"
#include "third_party/blink/public/platform/web_url.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/loader/link_header.h"
#include "third_party/blink/renderer/platform/wtf/hash_functions.h"
#include "third_party/blink/renderer/platform/wtf/text/string_hash.h"
namespace blink {
namespace {
constexpr char kAlternate[] = …;
constexpr char kAllowedAltSxg[] = …;
AlternateSignedExchangeMachingKey;
AlternateSignedExchangeMachingKey MakeKey(const String& anchor,
const String& variants,
const String& variant_key) { … }
void AddAlternateUrlIfValid(
const LinkHeader& header,
HashMap<AlternateSignedExchangeMachingKey, KURL>* alternate_urls) { … }
std::unique_ptr<AlternateSignedExchangeResourceInfo::Entry>
CreateEntryForLinkHeaderIfValid(
const LinkHeader& header,
const HashMap<AlternateSignedExchangeMachingKey, KURL>& alternate_urls) { … }
}
std::unique_ptr<AlternateSignedExchangeResourceInfo>
AlternateSignedExchangeResourceInfo::CreateIfValid(
const String& outer_link_header,
const String& inner_link_header) { … }
AlternateSignedExchangeResourceInfo::AlternateSignedExchangeResourceInfo(
EntryMap alternative_resources)
: … { … }
AlternateSignedExchangeResourceInfo::Entry*
AlternateSignedExchangeResourceInfo::FindMatchingEntry(
const KURL& url,
std::optional<ResourceType> resource_type,
const Vector<String>& languages) const { … }
AlternateSignedExchangeResourceInfo::Entry*
AlternateSignedExchangeResourceInfo::FindMatchingEntry(
const KURL& url,
network::mojom::RequestDestination request_destination,
const Vector<String>& languages) const { … }
AlternateSignedExchangeResourceInfo::Entry*
AlternateSignedExchangeResourceInfo::FindMatchingEntry(
const KURL& url,
const char* accept_header,
const Vector<String>& languages) const { … }
}