1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129

content / services / auction_worklet / public / mojom / private_aggregation_request.mojom [blame]

// 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.
// Warning: this is used for UMA histograms, so values should not be
// renumbered.
// LINT.IfChange(BaseValue)
enum BaseValue {
  kWinningBid = 0,
  kHighestScoringOtherBid = 1,
  kScriptRunTime = 2,
  kSignalsFetchTime = 3,
  kBidRejectReason = 4,
  // Values after this point require the feature
  // kPrivateAggregationApiProtectedAudienceAdditionalExtensions to be on.
  kParticipatingInterestGroupCount = 5,
  kAverageCodeFetchTime = 6,
  kPercentScriptsTimeout = 7,
  kPercentInterestGroupsCumulativeTimeout = 8,
  kCumulativeBuyerTime = 9,
  kRegularInterestGroupsUsed = 10,
  kPercentRegularInterestGroupQuotaUsed = 11,
  kNegativeInterestGroupsUsed = 12,
  kPercentNegativeInterestGroupQuotaUsed = 13,
  kInterestGroupStorageUsed = 14,
  kPercentInterestGroupStorageQuotaUsed = 15,
};
// LINT.ThenChange(//tools/metrics/histograms/enums.xml:AdAuctionPABaseValue)

// 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,
  kReservedOnce,
};

// 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;
};