chromium/chromeos/crosapi/mojom/web_app_types.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 crosapi.mojom;

import "mojo/public/mojom/base/string16.mojom";
import "skia/public/mojom/skcolor.mojom";
import "ui/gfx/image/mojom/image.mojom";
import "url/mojom/url.mojom";

// See |webapps::InstallResultCode|.
[Stable, Extensible]
enum WebAppInstallResultCode {
  kSuccessNewInstall,
  kSuccessAlreadyInstalled,
  kGetWebAppInstallInfoFailed,
  kPreviouslyUninstalled,
  kWebContentsDestroyed,
  kWriteDataFailed,
  kUserInstallDeclined,
  kNotValidManifestForWebApp,
  kIntentToPlayStore,
  kWebAppDisabled,
  kInstallURLRedirected,
  kInstallURLLoadFailed,
  kExpectedAppIdCheckFailed,
  kInstallURLLoadTimeOut,
  kFailedPlaceholderUninstall,
  kNotInstallable,
  kApkWebAppInstallFailed,
  kCancelledOnWebAppProviderShuttingDown,
  kWebAppProviderNotReady,
  kSuccessOfflineOnlyInstall,
  kSuccessOfflineFallbackInstall,
  kInstallTaskDestroyed,
  kUpdateTaskFailed,
  [MinVersion=1] kAppNotInRegistrarAfterCommit,
  [MinVersion=2] kHaltedBySyncUninstall,
  [MinVersion=3] kInstallURLInvalid,
  [MinVersion=4] kIconDownloadingFailed,
  [MinVersion=5] kCancelledDueToMainFrameNavigation,
  [MinVersion=6] kNoValidIconsInManifest,
};

// See |webapps::UninstallResultCode|.
[Stable, Extensible]
enum WebAppUninstallResultCode {
  kAppRemoved,
  kNoAppToUninstall,
  kCancelled,
  [Default] kError,
  [MinVersion=1] kShutdown,
  [MinVersion=2] kInstallSourceRemoved,
  [MinVersion=2] kInstallUrlRemoved,
};

// A subset of |WebAppInstallInfo| necessary to install a web app originated in
// ARC. See |web_app::WebAppInstallManager::InstallWebAppFromInfo|.
[Stable]
struct ArcWebAppInstallInfo {
  mojo_base.mojom.String16 title@0;
  url.mojom.Url start_url@1;
  url.mojom.Url scope@2;
  skia.mojom.SkColor? theme_color@3;
  gfx.mojom.ImageSkia icon@4;
  [MinVersion=1] array<string>? additional_policy_ids@5;
};

// Next version: 3
[Stable, Extensible, RenamedFrom="crosapi.mojom.PreloadWebAppInstallSource"]
enum WebAppInstallSource {
  // The app is preloaded by the device OEM.
  [Default] kOemPreload,
  // The app is preloaded by Google by default.
  kDefaultPreload,
  // The app was installed via an almanac://install-app URI navigation.
  [MinVersion=1] kAlmanacInstallAppUri,
  // The app was installed from the recommended apps screen in OOBE.
  [MinVersion=2] kOobeAppRecommendations,
};

// The set of information necessary to install a web app in Lacros using
// verified manifest data.
[Stable, RenamedFrom="crosapi.mojom.PreloadWebAppInstallInfo"]
struct WebAppVerifiedManifestInstallInfo {
  // The url from which the web app is installed.
  url.mojom.Url document_url@0;

  // The url from which the manifest is fetched.
  // Must be verified as being a rel="manifest" link of `document_url`.
  url.mojom.Url verified_manifest_url@1;

  // The expected app id for the installed web app.
  string expected_app_id@2;

  // The standard web app manifest, encoded as a JSON string.
  // Must be verified as representative of the contents of `manifest_url`.
  string verified_manifest_contents@3;

  // The source of this app installation.
  [MinVersion=1] WebAppInstallSource install_source@4;
};