summaryrefslogtreecommitdiff
path: root/chromium/content/browser/conversions/conversion_internals.mojom
blob: 8bfdeca562c2eceefbe802f7914756a5bc1dec0f (plain)
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
// Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module mojom;

import "url/mojom/origin.mojom";

// Struct containing stored data that will be sent in a future conversion
// report.
struct WebUIConversionReport {
  string impression_data;
  string conversion_data;
  url.mojom.Origin conversion_origin;
  url.mojom.Origin reporting_origin;
  double report_time;
  int32 attribution_credit;
};

// Struct representing a stored impression that will be displayed by WebUI.
struct WebUIImpression {
  string impression_data;
  url.mojom.Origin impression_origin;
  url.mojom.Origin conversion_destination;
  url.mojom.Origin reporting_origin;
  double impression_time;
  double expiry_time;
};

// Mojo interface used for communication between a WebUI and the storage layer
// for conversion measurement.
interface ConversionInternalsHandler {
  // Returns whether conversion measurement is enabled in the browisng context
  // the WebUI is in.
  IsMeasurementEnabled() => (bool enabled);

  // Returns all active impressions that are persisted in storage. This does
  // not include expired impressions, or impressions that can no longer convert
  // due to reaching policy limits.
  GetActiveImpressions() => (array<WebUIImpression> impressions);

  // Returns all reports contained in storage, including those that are actively
  // being sent.
  GetPendingReports() => (array<WebUIConversionReport> reports);

  // Sends all stored reports, ignoring delay, returning when the
  // operation has been completed and all reports have been cleared from
  // storage.
  SendPendingReports() => ();

  // Deletes all persisted data for the Conversion API, returning when the
  // operation has been completed.
  ClearStorage() => ();
};