#ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_DELEGATE_H_
#include <memory>
#include "content/common/content_export.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/network/public/mojom/early_hints.mojom-forward.h"
#include "services/network/public/mojom/url_loader.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/blink/public/common/navigation/navigation_policy.h"
#include "url/origin.h"
namespace net {
class NetworkAnonymizationKey;
struct RedirectInfo;
}
namespace network {
struct URLLoaderCompletionStatus;
}
namespace content {
class NavigationEarlyHintsManager;
struct NavigationEarlyHintsManagerParams;
struct GlobalRequestID;
struct SubresourceLoaderParams;
class CONTENT_EXPORT NavigationURLLoaderDelegate {
public:
struct CONTENT_EXPORT EarlyHints {
EarlyHints();
~EarlyHints();
EarlyHints(EarlyHints&& other);
EarlyHints& operator=(EarlyHints&& other);
EarlyHints(const EarlyHints& other) = delete;
EarlyHints& operator=(const EarlyHints& other) = delete;
bool was_resource_hints_received = false;
std::unique_ptr<NavigationEarlyHintsManager> manager;
};
NavigationURLLoaderDelegate(const NavigationURLLoaderDelegate&) = delete;
NavigationURLLoaderDelegate& operator=(const NavigationURLLoaderDelegate&) =
delete;
virtual void OnRequestRedirected(
const net::RedirectInfo& redirect_info,
const net::NetworkAnonymizationKey& network_anonymization_key,
network::mojom::URLResponseHeadPtr response) = 0;
virtual void OnResponseStarted(
network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints,
network::mojom::URLResponseHeadPtr response_head,
mojo::ScopedDataPipeConsumerHandle response_body,
GlobalRequestID request_id,
bool is_download,
net::NetworkAnonymizationKey network_anonymization_key,
absl::optional<SubresourceLoaderParams> subresource_loader_params,
EarlyHints early_hints) = 0;
virtual void OnRequestFailed(
const network::URLLoaderCompletionStatus& status) = 0;
virtual absl::optional<NavigationEarlyHintsManagerParams>
CreateNavigationEarlyHintsManagerParams(
const network::mojom::EarlyHints& early_hints) = 0;
protected:
NavigationURLLoaderDelegate() {}
virtual ~NavigationURLLoaderDelegate() {}
};
}
#endif