#include "components/ip_protection/common/ip_protection_proxy_config_fetcher.h"
#include <string>
#include <vector>
#include "base/base64.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/strings/strcat.h"
#include "base/time/time.h"
#include "components/ip_protection/get_proxy_config.pb.h"
#include "components/ip_protection/common/ip_protection_proxy_config_retriever.h"
#include "net/base/features.h"
#include "net/base/proxy_chain.h"
#include "net/base/proxy_server.h"
#include "net/base/proxy_string_util.h"
#include "services/network/public/mojom/network_context.mojom.h"
#include "third_party/abseil-cpp/absl/time/time.h"
namespace ip_protection {
IpProtectionProxyConfigFetcher::IpProtectionProxyConfigFetcher(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
std::string type,
std::string api_key) { … }
IpProtectionProxyConfigFetcher::IpProtectionProxyConfigFetcher(
std::unique_ptr<IpProtectionProxyConfigRetriever>
ip_protection_proxy_config_retriever)
: … { … }
IpProtectionProxyConfigFetcher::~IpProtectionProxyConfigFetcher() = default;
void IpProtectionProxyConfigFetcher::CallGetProxyConfig(
GetProxyListCallback callback,
std::optional<std::string> oauth_token) { … }
void IpProtectionProxyConfigFetcher::OnGetProxyConfigCompleted(
GetProxyListCallback callback,
base::expected<ip_protection::GetProxyConfigResponse, std::string>
response) { … }
bool IpProtectionProxyConfigFetcher::IsProxyConfigResponseError(
const base::expected<ip_protection::GetProxyConfigResponse, std::string>&
response) { … }
std::vector<net::ProxyChain>
IpProtectionProxyConfigFetcher::GetProxyListFromProxyConfigResponse(
ip_protection::GetProxyConfigResponse response) { … }
std::optional<ip_protection::GeoHint>
IpProtectionProxyConfigFetcher::GetGeoHintFromProxyConfigResponse(
ip_protection::GetProxyConfigResponse& response) { … }
void IpProtectionProxyConfigFetcher::SetUpForTesting(
std::unique_ptr<IpProtectionProxyConfigRetriever>
ip_protection_proxy_config_retriever) { … }
net::ProxyChain IpProtectionProxyConfigFetcher::MakeChainForTesting(
std::vector<std::string> hostnames,
int chain_id) { … }
}