#include "services/network/ip_protection/ip_protection_proxy_delegate.h"
#include <memory>
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/strcat.h"
#include "components/ip_protection/common/ip_protection_data_types.h"
#include "components/ip_protection/common/ip_protection_telemetry.h"
#include "components/ip_protection/common/masked_domain_list_manager.h"
#include "net/base/features.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/url_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_util.h"
#include "net/proxy_resolution/proxy_info.h"
#include "net/proxy_resolution/proxy_resolution_service.h"
#include "net/proxy_resolution/proxy_retry_info.h"
#include "services/network/ip_protection/ip_protection_geo_utils.h"
#include "services/network/ip_protection/ip_protection_proxy_list_manager_impl.h"
#include "services/network/ip_protection/ip_protection_token_cache_manager_impl.h"
#include "services/network/url_loader.h"
#include "url/url_constants.h"
namespace network {
namespace {
MaskedDomainListManager;
}
IpProtectionProxyDelegate::IpProtectionProxyDelegate(
MaskedDomainListManager* masked_domain_list_manager,
std::unique_ptr<IpProtectionConfigCache> ipp_config_cache,
bool is_ip_protection_enabled)
: … { … }
IpProtectionProxyDelegate::~IpProtectionProxyDelegate() = default;
void IpProtectionProxyDelegate::SetReceiver(
mojo::PendingReceiver<network::mojom::IpProtectionProxyDelegate>
pending_receiver) { … }
void IpProtectionProxyDelegate::OnResolveProxy(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key,
const std::string& method,
const net::ProxyRetryInfoMap& proxy_retry_info,
net::ProxyInfo* result) { … }
bool IpProtectionProxyDelegate::CheckEligibility(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key) const { … }
bool IpProtectionProxyDelegate::CheckAvailability(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key) const { … }
void IpProtectionProxyDelegate::OnSuccessfulRequestAfterFailures(
const net::ProxyRetryInfoMap& proxy_retry_info) { … }
void IpProtectionProxyDelegate::OnFallback(const net::ProxyChain& bad_chain,
int net_error) { … }
net::Error IpProtectionProxyDelegate::OnBeforeTunnelRequest(
const net::ProxyChain& proxy_chain,
size_t chain_index,
net::HttpRequestHeaders* extra_headers) { … }
net::Error IpProtectionProxyDelegate::OnTunnelHeadersReceived(
const net::ProxyChain& proxy_chain,
size_t chain_index,
const net::HttpResponseHeaders& response_headers) { … }
void IpProtectionProxyDelegate::SetProxyResolutionService(
net::ProxyResolutionService* proxy_resolution_service) { … }
void IpProtectionProxyDelegate::VerifyIpProtectionConfigGetterForTesting(
VerifyIpProtectionConfigGetterForTestingCallback callback) { … }
void IpProtectionProxyDelegate::SetIpProtectionEnabled(bool enabled) { … }
void IpProtectionProxyDelegate::IsIpProtectionEnabledForTesting(
IsIpProtectionEnabledForTestingCallback callback) { … }
void IpProtectionProxyDelegate::OnIpProtectionConfigAvailableForTesting(
VerifyIpProtectionConfigGetterForTestingCallback callback) { … }
void IpProtectionProxyDelegate::
InvalidateIpProtectionConfigCacheTryAgainAfterTime() { … }
net::ProxyList IpProtectionProxyDelegate::MergeProxyRules(
const net::ProxyList& existing_proxy_list,
const net::ProxyList& custom_proxy_list) { … }
}