#include "content/browser/aggregation_service/aggregatable_report_sender.h"
#include <memory>
#include <optional>
#include <string>
#include <string_view>
#include <utility>
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "base/values.h"
#include "content/public/browser/storage_partition.h"
#include "net/base/isolation_info.h"
#include "net/base/load_flags.h"
#include "net/base/net_errors.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/fetch_api.mojom.h"
#include "url/gurl.h"
namespace content {
namespace {
DelayType;
void RecordHistograms(std::optional<DelayType> delay_type,
int net_error,
std::optional<int> http_response_code,
AggregatableReportSender::RequestStatus status) { … }
}
AggregatableReportSender::AggregatableReportSender(
StoragePartition* storage_partition)
: … { … }
AggregatableReportSender::AggregatableReportSender(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool enable_debug_logging)
: … { … }
AggregatableReportSender::~AggregatableReportSender() = default;
std::unique_ptr<AggregatableReportSender>
AggregatableReportSender::CreateForTesting(
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool enable_debug_logging) { … }
void AggregatableReportSender::SendReport(const GURL& url,
const base::Value& contents,
std::optional<DelayType> delay_type,
ReportSentCallback callback) { … }
void AggregatableReportSender::OnReportSent(
UrlLoaderList::iterator it,
ReportSentCallback callback,
std::optional<DelayType> delay_type,
scoped_refptr<net::HttpResponseHeaders> headers) { … }
}