// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module auction_worklet.mojom;
import "mojo/public/mojom/base/int128.mojom";
import "third_party/blink/public/mojom/aggregation_service/aggregatable_report.mojom";
import "third_party/blink/public/mojom/private_aggregation/private_aggregation_host.mojom";
// Indicates which value the browser should use to calculate the resulting
// bucket or value.
enum BaseValue {
kWinningBid = 0,
kHighestScoringOtherBid = 1,
kScriptRunTime = 2,
kSignalsFetchTime = 3,
kBidRejectReason = 4,
};
// Bucket's offset to add/subtract to the auction result value. Offset's `value`
// should be Uint128. We need to support negative offset value, so adding a
// is_negative bool to indicate whether offset is negative.
struct BucketOffset {
mojo_base.mojom.Uint128 value;
bool is_negative;
};
// Bucket object of a contribution.
struct SignalBucket {
// The name of the auction result value we want to report.
BaseValue base_value;
// Scale factor by which we want to multiply the output. Default to 1.0.
double scale = 1.0;
// Optional offset to add/subtract to the auction result value.
BucketOffset? offset;
};
// Value object of a contribution.
struct SignalValue {
// The name of the auction result value we want to report.
BaseValue base_value;
// Scale factor by which we want to multiply the output. Default to 1.0.
double scale = 1.0;
// Offset to add/subtract to the auction result value. Default to 0.
int32 offset = 0;
};
// Designations of events that are automatically triggered by the browser.
enum ReservedEventType {
kReservedAlways,
kReservedWin,
kReservedLoss
};
// A bucket which is a 128bit ID or a SignalBucket which tells the browser how
// to calculate the bucket.
union ForEventSignalBucket {
// TODO(qingxinwu): Consider changing it to a more clear name.
mojo_base.mojom.Uint128 id_bucket;
SignalBucket signal_bucket;
};
// A value is an integer, or a SignalValue which tells the browser how to
// calculate the value.
union ForEventSignalValue {
int32 int_value;
SignalValue signal_value;
};
// Type of event after which to trigger a histogram contribution, either a
// reserved one automatically triggered by the browser, or a custom user-
// defined one.
union EventType {
ReservedEventType reserved;
string non_reserved;
};
// A for-event contribution contains a bucket, a value, a filtering ID, and an
// event_type.
// See https://github.com/WICG/turtledove/blob/main/FLEDGE_extended_PA_reporting.md#reporting-api-informal-specification
struct AggregatableReportForEventContribution {
ForEventSignalBucket bucket;
ForEventSignalValue value;
// Null if not explicitly specified.
uint64? filtering_id;
// Identifies the event type that triggers sending this report.
EventType event_type;
};
// `histogram_contribution` for contributeToHistogram(), and
// `for_event_contribution` for reportPrivateAggregationEvent().
union AggregatableReportContribution {
blink.mojom.AggregatableReportHistogramContribution histogram_contribution;
AggregatableReportForEventContribution for_event_contribution;
};
// Represents a request made to Private Aggregation API. It can be either
// contributeToHistogram() or reportPrivateAggregationEvent(), depending on the
// type of contribution.
struct PrivateAggregationRequest {
AggregatableReportContribution contribution;
blink.mojom.AggregationServiceMode aggregation_mode;
blink.mojom.DebugModeDetails debug_mode_details;
};