#include "chrome/browser/media/router/discovery/dial/dial_url_fetcher.h"
#include <optional>
#include "base/functional/bind.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "components/version_info/version_info.h"
#include "content/public/browser/browser_thread.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/http/http_util.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "net/url_request/redirect_info.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
constexpr int kMaxRetries = …;
constexpr int kMaxResponseSizeBytes = …;
namespace media_router {
namespace {
constexpr net::NetworkTrafficAnnotationTag kDialUrlFetcherTrafficAnnotation = …;
void BindURLLoaderFactoryReceiverOnUIThread(
mojo::PendingReceiver<network::mojom::URLLoaderFactory> receiver) { … }
std::string GetFakeOriginForDialLaunch() { … }
}
DialURLFetcher::DialURLFetcher(DialURLFetcher::SuccessCallback success_cb,
DialURLFetcher::ErrorCallback error_cb)
: … { … }
DialURLFetcher::~DialURLFetcher() { … }
const network::mojom::URLResponseHead* DialURLFetcher::GetResponseHead() const { … }
void DialURLFetcher::Get(const GURL& url, bool set_origin_header) { … }
void DialURLFetcher::Delete(const GURL& url) { … }
void DialURLFetcher::Post(const GURL& url,
const std::optional<std::string>& post_data) { … }
void DialURLFetcher::Start(const GURL& url,
const std::string& method,
const std::optional<std::string>& post_data,
int max_retries,
bool set_origin_header) { … }
void DialURLFetcher::ReportError(const std::string& message) { … }
std::optional<int> DialURLFetcher::GetHttpResponseCode() const { … }
void DialURLFetcher::ReportRedirectError(
const GURL& url_before_redirect,
const net::RedirectInfo& redirect_info,
const network::mojom::URLResponseHead& response_head,
std::vector<std::string>* to_be_removed_headers) { … }
void DialURLFetcher::StartDownload() { … }
void DialURLFetcher::ProcessResponse(std::unique_ptr<std::string> response) { … }
}