#include "components/update_client/net/network_impl.h"
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/functional/callback_helpers.h"
#include "base/numerics/safe_conversions.h"
#include "components/update_client/net/network_chromium.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/is_potentially_trustworthy.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "url/gurl.h"
namespace {
const net::NetworkTrafficAnnotationTag traffic_annotation = …;
std::string GetStringHeader(const network::SimpleURLLoader* simple_url_loader,
const char* header_name) { … }
int64_t GetInt64Header(const network::SimpleURLLoader* simple_url_loader,
const char* header_name) { … }
}
namespace update_client {
NetworkFetcherImpl::NetworkFetcherImpl(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_network_factory,
SendCookiesPredicate cookie_predicate)
: … { … }
NetworkFetcherImpl::~NetworkFetcherImpl() = default;
void NetworkFetcherImpl::PostRequest(
const GURL& url,
const std::string& post_data,
const std::string& content_type,
const base::flat_map<std::string, std::string>& post_additional_headers,
ResponseStartedCallback response_started_callback,
ProgressCallback progress_callback,
PostRequestCompleteCallback post_request_complete_callback) { … }
base::OnceClosure NetworkFetcherImpl::DownloadToFile(
const GURL& url,
const base::FilePath& file_path,
ResponseStartedCallback response_started_callback,
ProgressCallback progress_callback,
DownloadToFileCompleteCallback download_to_file_complete_callback) { … }
void NetworkFetcherImpl::OnResponseStartedCallback(
ResponseStartedCallback response_started_callback,
const GURL& final_url,
const network::mojom::URLResponseHead& response_head) { … }
void NetworkFetcherImpl::OnProgressCallback(ProgressCallback progress_callback,
uint64_t current) { … }
NetworkFetcherChromiumFactory::NetworkFetcherChromiumFactory(
scoped_refptr<network::SharedURLLoaderFactory> shared_url_network_factory,
SendCookiesPredicate cookie_predicate)
: … { … }
NetworkFetcherChromiumFactory::~NetworkFetcherChromiumFactory() = default;
std::unique_ptr<NetworkFetcher> NetworkFetcherChromiumFactory::Create() const { … }
}