chromium/third_party/blink/public/platform/child_url_loader_factory_bundle.h

// Copyright 2018 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_PUBLIC_PLATFORM_CHILD_URL_LOADER_FACTORY_BUNDLE_H_
#define THIRD_PARTY_BLINK_PUBLIC_PLATFORM_CHILD_URL_LOADER_FACTORY_BUNDLE_H_

#include <map>
#include <memory>
#include <vector>

#include "base/functional/callback.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "services/network/public/mojom/url_loader_factory.mojom-forward.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/loader/url_loader_factory_bundle.h"
#include "third_party/blink/public/mojom/loader/fetch_later.mojom.h"
#include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h"
#include "third_party/blink/public/platform/cross_variant_mojo_util.h"
#include "third_party/blink/public/platform/web_common.h"

namespace blink {

// Holds the internal state of a ChildURLLoaderFactoryBundle in a form that is
// safe to pass across sequences.
//
// |pending_subresource_proxying_loader_factory| is used only by the frames who
// may send prefetch requests by <link rel="prefetch"> tags, or send fetch
// requests with {browsingTopics: true} flag. For prefetch, this loader factory
// allows prefetch loading to be done by the browser process (therefore less
// memory pressure), and also adds special handling for Signed Exchanges (SXG)
// when the flag is enabled. TODO(crbug/803776): deprecate this once SXG
// specific code is moved into Network Service unless we see huge memory benefit
// for doing this. For topics, this loader factory allows intercepting and
// processing the topics headers in the browser process.
//
// |pending_keep_alive_loader_factory| is used only by the frames who may send
// fetch requests with {keepalive: true} flag. The loader factory allows
// keepalive request handling to be proxied via the browser process. The browser
// may forward the response back if the request initiator frame is still alive.
// It is only set if `blink::features::kKeepAliveInBrowserMigration` is true.
// See also crbug.com/1356128 and
// https://docs.google.com/document/d/1ZzxMMBvpqn8VZBZKnb7Go8TWjnrGcXuLS_USwVVRUvY
//
// |pending_fetch_later_loader_factory| is used only by the frames who may send
// fetchLater() requests. The loader factory allows such requests to be proxied
// via the browser process.
// It is only set if `blink::features::kFetchLaterAPI` is true.
// See also crbug.com/1465781 and
// https://docs.google.com/document/d/1U8XSnICPY3j-fjzG35UVm6zjwL6LvX6ETU3T8WrzLyQ
class BLINK_PLATFORM_EXPORT ChildPendingURLLoaderFactoryBundle
    : public blink::PendingURLLoaderFactoryBundle {};

// This class extends URLLoaderFactoryBundle to support prefetch loader factory
// and subresource overrides (the latter to support MimeHandlerViewGuest).
class BLINK_PLATFORM_EXPORT ChildURLLoaderFactoryBundle
    : public blink::URLLoaderFactoryBundle {};

}  // namespace blink

#endif  // THIRD_PARTY_BLINK_PUBLIC_PLATFORM_CHILD_URL_LOADER_FACTORY_BUNDLE_H_