#include "content/browser/aggregation_service/aggregatable_report_assembler.h"
#include <memory>
#include <optional>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/memory/scoped_refptr.h"
#include "base/metrics/histogram_functions.h"
#include "base/ranges/algorithm.h"
#include "base/time/default_clock.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/browser/aggregation_service/aggregation_service_key_fetcher.h"
#include "content/browser/aggregation_service/aggregation_service_network_fetcher_impl.h"
#include "content/browser/aggregation_service/aggregation_service_storage_context.h"
#include "content/browser/aggregation_service/public_key.h"
#include "content/public/browser/storage_partition.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
namespace content {
namespace {
void RecordAssemblyStatus(AggregatableReportAssembler::AssemblyStatus status) { … }
}
AggregatableReportAssembler::AggregatableReportAssembler(
AggregationServiceStorageContext* storage_context,
StoragePartition* storage_partition)
: … { … }
AggregatableReportAssembler::AggregatableReportAssembler(
AggregationServiceStorageContext* storage_context,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool enable_debug_logging)
: … { … }
AggregatableReportAssembler::AggregatableReportAssembler(
std::unique_ptr<AggregationServiceKeyFetcher> fetcher,
std::unique_ptr<AggregatableReport::Provider> report_provider)
: … { … }
AggregatableReportAssembler::~AggregatableReportAssembler() = default;
AggregatableReportAssembler::PendingRequest::PendingRequest(
AggregatableReportRequest report_request,
AggregatableReportAssembler::AssemblyCallback callback,
size_t num_processing_urls)
: … { … }
AggregatableReportAssembler::PendingRequest::PendingRequest(
AggregatableReportAssembler::PendingRequest&& other) = default;
AggregatableReportAssembler::PendingRequest&
AggregatableReportAssembler::PendingRequest::operator=(
AggregatableReportAssembler::PendingRequest&& other) = default;
AggregatableReportAssembler::PendingRequest::~PendingRequest() = default;
std::unique_ptr<AggregatableReportAssembler>
AggregatableReportAssembler::CreateForTesting(
std::unique_ptr<AggregationServiceKeyFetcher> fetcher,
std::unique_ptr<AggregatableReport::Provider> report_provider) { … }
std::unique_ptr<AggregatableReportAssembler>
AggregatableReportAssembler::CreateForTesting(
AggregationServiceStorageContext* storage_context,
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory,
bool enable_debug_logging) { … }
void AggregatableReportAssembler::AssembleReport(
AggregatableReportRequest report_request,
AssemblyCallback callback) { … }
void AggregatableReportAssembler::OnPublicKeyFetched(
int64_t report_id,
size_t processing_url_index,
std::optional<PublicKey> key,
AggregationServiceKeyFetcher::PublicKeyFetchStatus status) { … }
void AggregatableReportAssembler::OnAllPublicKeysFetched(
int64_t report_id,
PendingRequest& pending_request) { … }
}