#include "components/search_engines/template_url_fetcher.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/not_fatal_until.h"
#include "base/ranges/algorithm.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/search_engines/template_url.h"
#include "components/search_engines/template_url_parser.h"
#include "components/search_engines/template_url_service.h"
#include "net/base/load_flags.h"
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/resource_request.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
namespace {
constexpr int kOpenSearchRetryCount = …;
constexpr int kOpenSearchTimeoutSeconds = …;
const net::NetworkTrafficAnnotationTag kTrafficAnnotation = …;
}
class TemplateURLFetcher::RequestDelegate { … };
TemplateURLFetcher::RequestDelegate::RequestDelegate(
TemplateURLFetcher* fetcher,
const std::u16string& keyword,
const GURL& osdd_url,
const GURL& favicon_url,
const url::Origin& initiator,
network::mojom::URLLoaderFactory* url_loader_factory,
int render_frame_id,
int32_t request_id)
: … { … }
void TemplateURLFetcher::RequestDelegate::OnTemplateURLParsed(
std::unique_ptr<TemplateURL> template_url) { … }
void TemplateURLFetcher::RequestDelegate::OnLoaded() { … }
void TemplateURLFetcher::RequestDelegate::OnSimpleLoaderComplete(
std::unique_ptr<std::string> response_body) { … }
void TemplateURLFetcher::RequestDelegate::AddSearchProvider() { … }
TemplateURLFetcher::TemplateURLFetcher(TemplateURLService* template_url_service)
: … { … }
TemplateURLFetcher::~TemplateURLFetcher() { … }
void TemplateURLFetcher::ScheduleDownload(
const std::u16string& keyword,
const GURL& osdd_url,
const GURL& favicon_url,
const url::Origin& initiator,
network::mojom::URLLoaderFactory* url_loader_factory,
int render_frame_id,
int32_t request_id) { … }
void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { … }