#include "services/network/private_network_access_checker.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "net/base/transport_info.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/ip_address_space_util.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/mojom/client_security_state.mojom.h"
#include "services/network/public/mojom/ip_address_space.mojom.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "url/gurl.h"
namespace network {
namespace {
Result;
Policy;
mojom::ClientSecurityStatePtr GetRequestClientSecurityState(
const ResourceRequest& request) { … }
const mojom::ClientSecurityState* ChooseClientSecurityState(
const mojom::ClientSecurityState* factory_client_security_state,
const mojom::ClientSecurityState* request_client_security_state) { … }
std::optional<net::IPAddress> ParsePrivateIpFromUrl(const GURL& url) { … }
}
PrivateNetworkAccessChecker::PrivateNetworkAccessChecker(
const ResourceRequest& request,
const mojom::ClientSecurityState* factory_client_security_state,
int32_t url_load_options)
: … { … }
PrivateNetworkAccessChecker::~PrivateNetworkAccessChecker() = default;
PrivateNetworkAccessCheckResult PrivateNetworkAccessChecker::Check(
const net::TransportInfo& transport_info) { … }
void PrivateNetworkAccessChecker::ResetForRedirect(const GURL& new_url) { … }
void PrivateNetworkAccessChecker::ResetForRetry() { … }
mojom::ClientSecurityStatePtr
PrivateNetworkAccessChecker::CloneClientSecurityState() const { … }
mojom::IPAddressSpace PrivateNetworkAccessChecker::ClientAddressSpace() const { … }
bool PrivateNetworkAccessChecker::IsPolicyPreflightWarn() const { … }
Result PrivateNetworkAccessChecker::CheckInternal(
mojom::IPAddressSpace resource_address_space) { … }
void PrivateNetworkAccessChecker::SetRequestUrl(const GURL& url) { … }
bool PrivateNetworkAccessChecker::NeedPermission(
const GURL& url,
bool is_web_secure_context,
mojom::IPAddressSpace target_address_space) { … }
}