#include "services/network/sec_header_helpers.h"
#include <algorithm>
#include <string>
#include "base/feature_list.h"
#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/http/http_request_headers.h"
#include "net/url_request/url_request.h"
#include "services/network/public/cpp/cors/origin_access_list.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/initiator_lock_compatibility.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/request_destination.h"
#include "services/network/public/cpp/request_mode.h"
#include "services/network/public/mojom/fetch_api.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
namespace network {
namespace {
const char kSecFetchMode[] = …;
const char kSecFetchSite[] = …;
const char kSecFetchUser[] = …;
const char kSecFetchDest[] = …;
enum class SecFetchSiteValue { … };
const char* GetSecFetchSiteHeaderString(const SecFetchSiteValue& value) { … }
SecFetchSiteValue GetHeaderValueForTargetAndInitiator(
const GURL& target_url,
const url::Origin& initiator) { … }
SecFetchSiteValue GetHeaderValueForRequest(
net::URLRequest* request,
const GURL* pending_redirect_url,
const mojom::URLLoaderFactoryParams& factory_params,
const cors::OriginAccessList& origin_access_list) { … }
void SetSecFetchSiteHeader(net::URLRequest* request,
const GURL* pending_redirect_url,
const mojom::URLLoaderFactoryParams& factory_params,
const cors::OriginAccessList& origin_access_list) { … }
void SetSecFetchModeHeader(net::URLRequest* request,
network::mojom::RequestMode mode) { … }
void SetSecFetchUserHeader(net::URLRequest* request, bool has_user_activation) { … }
void SetSecFetchDestHeader(net::URLRequest* request,
network::mojom::RequestDestination dest) { … }
}
void SetFetchMetadataHeaders(
net::URLRequest* request,
network::mojom::RequestMode mode,
bool has_user_activation,
network::mojom::RequestDestination dest,
const GURL* pending_redirect_url,
const mojom::URLLoaderFactoryParams& factory_params,
const cors::OriginAccessList& origin_access_list) { … }
void MaybeRemoveSecHeaders(net::URLRequest* request,
const GURL& pending_redirect_url) { … }
}