#include "components/optimization_guide/core/prediction_model_fetcher_impl.h"
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "components/optimization_guide/core/model_util.h"
#include "components/optimization_guide/core/optimization_guide_features.h"
#include "components/optimization_guide/core/optimization_guide_util.h"
#include "components/optimization_guide/proto/models.pb.h"
#include "components/variations/net/variations_http_headers.h"
#include "net/base/load_flags.h"
#include "net/base/url_util.h"
#include "net/http/http_request_headers.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
#include "net/traffic_annotation/network_traffic_annotation.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"
namespace optimization_guide {
PredictionModelFetcherImpl::PredictionModelFetcherImpl(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
const GURL& optimization_guide_service_get_models_url)
: … { … }
PredictionModelFetcherImpl::~PredictionModelFetcherImpl() = default;
bool PredictionModelFetcherImpl::FetchOptimizationGuideServiceModels(
const std::vector<proto::ModelInfo>& models_request_info,
proto::RequestContext request_context,
const std::string& locale,
ModelsFetchedCallback models_fetched_callback) { … }
void PredictionModelFetcherImpl::HandleResponse(
const std::string& get_models_response_data,
int net_status,
int response_code) { … }
void PredictionModelFetcherImpl::OnURLLoadComplete(
std::unique_ptr<std::string> response_body) { … }
}