chromium/third_party/blink/public/mojom/conversions/conversions.mojom

// Copyright 2020 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 "components/attribution_reporting/data_host.mojom";
import "components/attribution_reporting/registration_eligibility.mojom";
import "third_party/blink/public/mojom/tokens/tokens.mojom";
import "services/network/public/mojom/attribution.mojom";

// Mojo struct to represent blink::Impression native struct.
struct Impression {
  // Indicates the attributionsrc request associated with `this`.
  // API parameters will be used from the the `AttributionDataHost`
  // that is associated with `attribution_src_token`.
  AttributionSrcToken attribution_src_token;
};

// Sent from renderer to browser process when a resource request matching the
// .well-known conversion registration path is intercepted.
interface AttributionHost {
  // Registers a new data host which can register a source or trigger.
  // Called when an attributionsrc attribute is registered, e.g. via an img
  // element. Information will be passed at a later point when the renderer
  // is done fetching the config. `is_for_background_requests` indicates if the
  // host will be used to register registrations from background requests.
  RegisterDataHost(pending_receiver<attribution_reporting.mojom.DataHost> data_host,
                   attribution_reporting.mojom.RegistrationEligibility registration_eligibility,
                   bool is_for_background_requests
                   );

  // Registers a new data host which can register a source associated with a
  // navigation. Called when attributionsrc is registered on a navigation API.
  // Information will be passed at a later point when the renderer has finished
  // processing the attribution source config returned from the request.
  // `attribution_src_token` can be used to associate `data_host` with an
  // `Impression` object in the browser process.
  RegisterNavigationDataHost(pending_receiver<attribution_reporting.mojom.DataHost> data_host,
                             AttributionSrcToken attribution_src_token
                             );

  // Called when attributionsrc are registered on a navigation API.
  // `expected_registrations` is the number of background registrations requests
  // sent which are associated to the navigation tied to
  // `attribution_src_token`.
  NotifyNavigationWithBackgroundRegistrationsWillStart(
    AttributionSrcToken attribution_src_token,
    uint32 expected_registrations
    );
};