chromium/ui/webui/resources/js/metrics_reporter/metrics_reporter.mojom

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module metrics_reporter.mojom;

import "mojo/public/mojom/base/time.mojom";

// Browser-side handler for requests from WebUI page.
interface PageMetricsHost {
  // The WebUI calls this method when the MetricsReporter is first initialized.
  OnPageRemoteCreated(
      pending_remote<PageMetrics> page);

  // Request a mark from the browser.
  OnGetMark(string name) => (mojo_base.mojom.TimeDelta? marked_time);

  // Clear a mark in the browser.
  OnClearMark(string name);

  // Record a time in UMA histogram.
  OnUmaReportTime(string name, mojo_base.mojom.TimeDelta time);
};

// WebUI-side handler for requests from the browser.
interface PageMetrics {
  // Request a mark from the WebUI.
  OnGetMark(string name) => (mojo_base.mojom.TimeDelta? marked_time);

  // Clear a mark in the WebUI.
  OnClearMark(string name);
};