chromium/third_party/blink/public/mojom/web_install/web_install.mojom

// Copyright 2024 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 "url/mojom/url.mojom";

// The result of an installation request.
enum WebInstallServiceResult {
  kSuccess,
  kAbortError,
  // TODO(crbug.com/333795265): Follow up later when implementation is complete
  // and add appropriate error codes.
};

// Allows installation of web apps via JS. This mojo interface is only bound on
// the main frame in browser contexts that support web app installation.
interface WebInstallService {
  // Installs the current document as a web app, verifying that it has the
  // given resolved `manifest_id`. Returns a success/failure result. If success,
  // populates the absolute computed manifest id for the installed app. This can
  // only be used for same-origin app installation.
  InstallCurrentDocument(url.mojom.Url manifest_id)
      => (WebInstallServiceResult result, url.mojom.Url manifest_id);

  // Installs the web content at `install_url`, verifying that it has the
  // given resolved `manifest_id`. Returns a success/failure result. If success,
  // populates the absolute computed manifest id for the installed app. This can
  // be used for either same-origin or cross-origin app installation.
  InstallBackgroundDocument(url.mojom.Url manifest_id,
                            url.mojom.Url install_url)
      => (WebInstallServiceResult result, url.mojom.Url manifest_id);
};