// 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 "chromeos/crosapi/mojom/web_app_types.mojom";
import "mojo/public/mojom/base/file_path.mojom";
import "url/mojom/url.mojom";
// Describes an Android package associated with a web app.
[Stable]
struct WebAppAndroidPackage {
// Android package name.
string package_name@0;
// SHA256 fingerprint of the certificate of this Android app.
string sha256_fingerprint@1;
};
// Contains the web app information used to mint an Android WebApk.
[Stable]
struct WebApkCreationParams {
// The URL of the Web App Manifest.
string manifest_url@0;
// A serialized webapk::WebAppManifest proto containing the information
// required for an Android WebApk to be minted.
array<uint8> webapk_manifest_proto_bytes@1;
};
// Implemented in lacros-chrome. Allows ash-chrome to modify web app state in
// lacros-chrome.
// Next version: 8
// Next method id: 9
[Stable, Uuid="84eb46eb-76fe-439c-9fcb-3388492e141d"]
interface WebAppProviderBridge {
// Called when a web app described by |info| is installed in ARC (Android
// package containing web app metadata) and installs this web app in the
// primary profile of Lacros.
// See |web_app::WebAppInstallManager::InstallWebAppFromInfo|.
WebAppInstalledInArc@0(ArcWebAppInstallInfo info)
=> (string app_id, WebAppInstallResultCode install_result);
// Removes ARC as an install source from the app specified by |app_id|, and
// uninstalls the app from the primary profile of Lacros if no other sources
// are left.
// See |web_app::WebAppInstallFinalizer::UninstallExternalWebApp|.
WebAppUninstalledInArc@1(string app_id)
=> (WebAppUninstallResultCode uninstall_result);
// Called when a web app defining a share target has been installed in Lacros.
// Returns the information required for an Android WebApk to be minted.
[MinVersion=1]
GetWebApkCreationParams@2(string app_id)
=> (WebApkCreationParams webapk_creation_params);
// Installs Microsoft 365 web app in Lacros.
[MinVersion=2]
InstallMicrosoft365@3() => (WebAppInstallResultCode install_result);
// Returns the ids of all the sub-apps of the given app.
[MinVersion=3]
GetSubAppIds@4(string app_id) => (array<string> sub_apps);
// Navigates to the specified install url and waits for the web app manifest
// to load. If there is an installable web app that the user has not
// installed, it will automatically trigger the install dialog in Lacros.
[MinVersion=4]
ScheduleNavigateAndTriggerInstallDialog@5(
url.mojom.Url install_url,
url.mojom.Url origin_url,
bool is_renderer_initiated);
// Returns all apps that have a parent app, and maps the apps' IDs to their
// parent app's ID. The key is the sub app's ID, the value is the parent app's
// ID.
[MinVersion=5]
GetSubAppToParentMap@6() => (map<string, string> parent_apps);
// Called when a web app described by |install_info| is installed via
// App Install Service and installs this web app in the primary profile of
// Lacros.
[MinVersion=6]
InstallWebAppFromVerifiedManifest@7(
WebAppVerifiedManifestInstallInfo install_info)
=> (string app_id, WebAppInstallResultCode install_result);
// Requests that Lacros launch the Isolated Web App installation UI for the
// bundle with the given path.
//
// Bundles come from the web so the receiving-side implementation assumes it
// can be malicious. There is no path or bundle validation done at the Mojo
// layer.
[MinVersion=7]
LaunchIsolatedWebAppInstaller@8(mojo_base.mojom.FilePath bundle_path);
};
// An interface implemented in ash-chrome. Allows lacros-chrome:
// 1) to query web-app-related information in ash-chrome,
// 2) to register its own |crosapi::mojom::WebAppProviderBridge| to let
// ash-chrome to modify or query WebAppProvider in lacros-chrome.
//
// Next version: 3
// Next method id: 3
[Stable, Uuid="dfa7b3f8-236f-4706-861b-98068aa5fc8f"]
interface WebAppService {
// Register a web app provider bridge that lets ash-chrome to update or query
// WebAppProvider in lacros-chrome.
RegisterWebAppProviderBridge@0(
pending_remote<WebAppProviderBridge> web_app_provider_bridge);
// Gets the information about an Android package matching this web app, if
// this app was installed from the Play Store. Returns null if the app was not
// installed from the Play Store.
[MinVersion=1]
GetAssociatedAndroidPackage@1(string web_app_id)
=> (WebAppAndroidPackage? package);
// Migrates launcher state, such as parent folder id, position in App Launcher
// and pin position on the shelf from one app to another app.
// Avoids migrating if the to_app_id is already pinned.
[MinVersion=2]
MigrateLauncherState@2(string from_app_id, string to_app_id) => ();
};