#include "content/browser/private_aggregation/private_aggregation_internals_handler_impl.h"
#include <iterator>
#include <optional>
#include <string>
#include <utility>
#include <vector>
#include "base/barrier_closure.h"
#include "base/check.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/json/json_writer.h"
#include "base/ranges/algorithm.h"
#include "base/time/time.h"
#include "base/values.h"
#include "content/browser/aggregation_service/aggregatable_report.h"
#include "content/browser/aggregation_service/aggregation_service.h"
#include "content/browser/aggregation_service/aggregation_service_storage.h"
#include "content/browser/private_aggregation/private_aggregation_internals.mojom.h"
#include "content/browser/private_aggregation/private_aggregation_manager.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_ui.h"
namespace content {
namespace {
AggregationService* GetAggregationService(WebContents* web_contents) { … }
PrivateAggregationManager* GetPrivateAggregationManager(
WebContents* web_contents) { … }
private_aggregation_internals::mojom::WebUIAggregatableReportPtr
CreateWebUIAggregatableReport(
const AggregatableReportRequest& request,
std::optional<AggregationServiceStorage::RequestId> id,
std::optional<base::Time> actual_report_time,
private_aggregation_internals::mojom::ReportStatus status,
const std::optional<AggregatableReport>& report) { … }
void ForwardReportsToWebUI(
private_aggregation_internals::mojom::Handler::GetReportsCallback
web_ui_callback,
std::vector<AggregationServiceStorage::RequestAndId> requests_and_ids) { … }
}
PrivateAggregationInternalsHandlerImpl::PrivateAggregationInternalsHandlerImpl(
WebUI* web_ui,
mojo::PendingRemote<private_aggregation_internals::mojom::Observer>
observer,
mojo::PendingReceiver<private_aggregation_internals::mojom::Handler>
handler)
: … { … }
PrivateAggregationInternalsHandlerImpl::
~PrivateAggregationInternalsHandlerImpl() = default;
void PrivateAggregationInternalsHandlerImpl::GetReports(
private_aggregation_internals::mojom::Handler::GetReportsCallback
callback) { … }
void PrivateAggregationInternalsHandlerImpl::SendReports(
const std::vector<AggregationServiceStorage::RequestId>& ids,
private_aggregation_internals::mojom::Handler::SendReportsCallback
callback) { … }
void PrivateAggregationInternalsHandlerImpl::ClearStorage(
private_aggregation_internals::mojom::Handler::ClearStorageCallback
callback) { … }
void PrivateAggregationInternalsHandlerImpl::OnRequestStorageModified() { … }
void PrivateAggregationInternalsHandlerImpl::OnReportHandled(
const AggregatableReportRequest& request,
std::optional<AggregationServiceStorage::RequestId> id,
const std::optional<AggregatableReport>& report,
base::Time actual_report_time,
AggregationServiceObserver::ReportStatus status) { … }
void PrivateAggregationInternalsHandlerImpl::OnObserverDisconnected() { … }
}