chromium/third_party/blink/renderer/core/loader/alternate_signed_exchange_resource_info.h

// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_ALTERNATE_SIGNED_EXCHANGE_RESOURCE_INFO_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_ALTERNATE_SIGNED_EXCHANGE_RESOURCE_INFO_H_

#include <optional>

#include "services/network/public/mojom/fetch_api.mojom-forward.h"
#include "third_party/blink/public/mojom/fetch/fetch_api_request.mojom-blink-forward.h"
#include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/weborigin/kurl_hash.h"
#include "third_party/blink/renderer/platform/wtf/hash_map.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
#include "third_party/blink/renderer/platform/wtf/vector.h"

namespace blink {

enum class ResourceType : uint8_t;

// AlternateSignedExchangeResourceInfo keeps the alternate signed exchange
// resource information which is extracted from "alternate" link headers in the
// outer response and "allowed-alt-sxg" link headers in the inner response while
// handling a signed exchange.
// Example:
//  - In outer response:
//    link: <https://distributor.example/publisher.example/image_jpeg.sxg>;
//          rel="alternate";
//          type="application/signed-exchange;v=b3";
//          variants-04="accept;image/jpeg;image/webp";
//          variant-key-04="image/jpeg";
//          anchor="https://publisher.example/image";
//  - In inner response:
//    link: <https://publisher.example/image>;
//          rel="allowed-alt-sxg";
//          variants-04="accept;image/jpeg;image/webp";
//          variant-key-04="image/jpeg";
//          header-integrity="sha256-MEUCID..."
//  - The |alternative_resources_| will be like this:
//    {
//      "https://publisher.example/image": [{
//        anchor_url: "https://publisher.example/image",
//        alternative_url:
//            "https://distributor.example/publisher.example/image_jpeg.sxg",
//        header_integrity: "sha256-MEUCID...",
//        variants: "accept;image/jpeg;image/webp",
//        variant_key: "image/jpeg"
//      }]
//    }
// Note: When a valid "allowed-alt-sxg" link header exists in the inner response
// but there is no matching "alternate" link header in the outer response, this
// class keep the information with an invalid |alternative_url|.
class CORE_EXPORT AlternateSignedExchangeResourceInfo {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_ALTERNATE_SIGNED_EXCHANGE_RESOURCE_INFO_H_