#include "services/network/network_service_proxy_delegate.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/scoped_refptr.h"
#include "base/strings/strcat.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/url_loader.h"
#include "url/url_constants.h"
namespace network {
namespace {
bool ApplyProxyConfigToProxyInfo(const net::ProxyConfig::ProxyRules& rules,
const net::ProxyRetryInfoMap& proxy_retry_info,
const GURL& url,
net::ProxyInfo* proxy_info) { … }
bool CheckProxyList(const net::ProxyList& proxy_list,
const net::ProxyServer& target_proxy) { … }
bool RulesContainsProxy(const net::ProxyConfig::ProxyRules& proxy_rules,
const net::ProxyServer& target_proxy) { … }
bool IsValidCustomProxyConfig(const mojom::CustomProxyConfig& config) { … }
void MergeRequestHeaders(net::HttpRequestHeaders* out,
const net::HttpRequestHeaders& in) { … }
}
NetworkServiceProxyDelegate::NetworkServiceProxyDelegate(
mojom::CustomProxyConfigPtr initial_config,
mojo::PendingReceiver<mojom::CustomProxyConfigClient>
config_client_receiver,
mojo::PendingRemote<mojom::CustomProxyConnectionObserver> observer_remote)
: … { … }
NetworkServiceProxyDelegate::~NetworkServiceProxyDelegate() = default;
void NetworkServiceProxyDelegate::OnResolveProxy(
const GURL& url,
const net::NetworkAnonymizationKey& network_anonymization_key,
const std::string& method,
const net::ProxyRetryInfoMap& proxy_retry_info,
net::ProxyInfo* result) { … }
void NetworkServiceProxyDelegate::OnSuccessfulRequestAfterFailures(
const net::ProxyRetryInfoMap& proxy_retry_info) { … }
void NetworkServiceProxyDelegate::OnFallback(const net::ProxyChain& bad_chain,
int net_error) { … }
net::Error NetworkServiceProxyDelegate::OnBeforeTunnelRequest(
const net::ProxyChain& proxy_chain,
size_t chain_index,
net::HttpRequestHeaders* extra_headers) { … }
net::Error NetworkServiceProxyDelegate::OnTunnelHeadersReceived(
const net::ProxyChain& proxy_chain,
size_t chain_index,
const net::HttpResponseHeaders& response_headers) { … }
void NetworkServiceProxyDelegate::SetProxyResolutionService(
net::ProxyResolutionService* proxy_resolution_service) { … }
void NetworkServiceProxyDelegate::OnCustomProxyConfigUpdated(
mojom::CustomProxyConfigPtr proxy_config,
OnCustomProxyConfigUpdatedCallback callback) { … }
bool NetworkServiceProxyDelegate::IsInProxyConfig(
const net::ProxyChain& proxy_chain) const { … }
bool NetworkServiceProxyDelegate::EligibleForProxy(
const net::ProxyInfo& proxy_info,
const std::string& method) const { … }
void NetworkServiceProxyDelegate::OnObserverDisconnect() { … }
}