#ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_
#define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_H_
#include <memory>
#include <string>
#include <vector>
#include "content/browser/loader/navigation_loader_interceptor.h"
#include "content/common/content_export.h"
#include "services/network/public/mojom/cookie_access_observer.mojom.h"
#include "services/network/public/mojom/device_bound_sessions.mojom-forward.h"
#include "services/network/public/mojom/devtools_observer.mojom-forward.h"
#include "services/network/public/mojom/shared_dictionary_access_observer.mojom.h"
#include "services/network/public/mojom/trust_token_access_observer.mojom-forward.h"
#include "services/network/public/mojom/url_loader_network_service_observer.mojom.h"
namespace net {
class HttpRequestHeaders;
}
namespace content {
class BrowserContext;
class NavigationUIData;
class NavigationURLLoaderDelegate;
class NavigationURLLoaderFactory;
class PrefetchedSignedExchangeCache;
class ServiceWorkerMainResourceHandle;
class StoragePartition;
struct NavigationRequestInfo;
class CONTENT_EXPORT NavigationURLLoader {
public:
enum class LoaderType {
kRegular,
kNoopForBackForwardCache,
kNoopForPrerender,
kNoopForInitialWebUI,
};
static std::unique_ptr<NavigationURLLoader> Create(
BrowserContext* browser_context,
StoragePartition* storage_partition,
std::unique_ptr<NavigationRequestInfo> request_info,
std::unique_ptr<NavigationUIData> navigation_ui_data,
ServiceWorkerMainResourceHandle* service_worker_handle,
scoped_refptr<PrefetchedSignedExchangeCache>
prefetched_signed_exchange_cache,
NavigationURLLoaderDelegate* delegate,
LoaderType loader_type,
mojo::PendingRemote<network::mojom::CookieAccessObserver> cookie_observer,
mojo::PendingRemote<network::mojom::TrustTokenAccessObserver>
trust_token_observer,
mojo::PendingRemote<network::mojom::SharedDictionaryAccessObserver>
shared_dictionary_observer,
mojo::PendingRemote<network::mojom::URLLoaderNetworkServiceObserver>
url_loader_network_observer,
mojo::PendingRemote<network::mojom::DevToolsObserver> devtools_observer,
mojo::PendingRemote<network::mojom::DeviceBoundSessionAccessObserver>
device_bound_session_observer,
network::mojom::URLResponseHeadPtr cached_response_head = nullptr,
std::vector<std::unique_ptr<NavigationLoaderInterceptor>>
initial_interceptors = {});
static void SetFactoryForTesting(NavigationURLLoaderFactory* factory);
NavigationURLLoader(const NavigationURLLoader&) = delete;
NavigationURLLoader& operator=(const NavigationURLLoader&) = delete;
virtual ~NavigationURLLoader() {}
virtual void Start() = 0;
virtual void FollowRedirect(
std::vector<std::string> removed_headers,
net::HttpRequestHeaders modified_headers,
net::HttpRequestHeaders modified_cors_exempt_headers) = 0;
virtual bool SetNavigationTimeout(base::TimeDelta timeout) = 0;
virtual void CancelNavigationTimeout() = 0;
static uint32_t GetURLLoaderOptions(bool is_outermost_main_frame);
protected:
NavigationURLLoader() {}
};
}
#endif