// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
import "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom";
// Wrapper to allow for a null debug key.
// TODO(alexmt): Remove wrapper and replace with nullable uint64.
struct DebugKey {
uint64 value;
};
// TODO(alexmt): Consider removing or moving to auction_worklet.
struct DebugModeDetails {
// Whether debug mode is enabled.
bool is_enabled = false;
// Must be null if the debug mode is disabled. Can still be null even if the
// debug mode is enabled.
DebugKey? debug_key;
};
// Interface implemented in the browser for worklets and renderers to forward
// histogram report requests. Requests a histogram report with the specified
// contributions (and debug details) be sent to the origin associated with the
// remote. Waits until the pipe disconnects before sending the report. Note that
// only a small number of fields in the eventual report are controllable by the
// worklet/renderer.
// TODO(crbug.com/1459338): Support sending a report on a timeout as well.
interface PrivateAggregationHost {
// Adds `contributions` to the list of contributions to be embedded in the
// report.
ContributeToHistogram(
array<AggregatableReportHistogramContribution> contributions);
// If a non-null report is sent from this mojo pipe, enables debug mode for
// that report. If `debug_key` is non-null, the provided debug key will also
// be used. Should only be called at most once.
// TODO(crbug.com/1466668): Consider applying to null reports too.
EnableDebugMode(DebugKey? debug_key);
};