chromium/ash/components/arc/mojom/webapk.mojom

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

// Next MinVersion: 3

module arc.mojom;

// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
[Extensible]
enum WebApkInstallResult {
  kSuccess = 0,
  kErrorUnknown = 1,
  // Errors while communicating with PlayInstallService.
  kErrorServiceCommunication = 2,
  kErrorServiceTimeout = 3,
  // Errors returned from PlayInstallService directly.
  kErrorCallerVerificationFailed = 4,
  kErrorPolicyViolation = 5,
  kErrorApiDisabled = 6,
  kErrorUnknownAccount = 7,
  kErrorResolveNetworkError = 8,
  kErrorResolveError = 9,
  kErrorNotGoogleSigned = 10,
  // Errors while installing the WebAPK through Play.
  [MinVersion=1] kErrorDownloadCancelled = 11,
  [MinVersion=1] kErrorDownloadError = 12,
  [MinVersion=1] kErrorInstallError = 13,
};

struct WebShareTargetInfo {
  string? action;
  string? method;
  string? enctype;

  string? param_title;
  string? param_text;
  string? param_url;

  array<string> file_names;
  array<array<string>> file_accepts;
};

// Information which can be read from the APK.
struct WebApkInfo {
  string package_name;
  // The version of the currently installed APK, as generated by the minter.
  string apk_version;
  // The version of the common shell apk used to provide a template.
  string shell_apk_version;

  // Core metadata used to generate the APK:
  string manifest_url;
  string name;
  string start_url;
  string scope;
  string icon_hash;

  WebShareTargetInfo? share_info;
};

// Allows Chrome to install and manage WebAPKs inside ARC.
// Next method ID: 2
interface WebApkInstance {

  // Install or update a WebAPK with the given |package_name|.
  InstallWebApk@0(string package_name,
                  uint32 version,
                  string app_name,
                  string token) =>
                      (WebApkInstallResult result);

  // Gets the metadata stored within a WebAPK, defined by |pacakge_name|.
  // Result is empty if no web apk was found with that |package name|.
  [MinVersion=2] GetWebApkInfo@1(string package_name) => (WebApkInfo? result);
};