// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module mojom;
import "mojo/public/mojom/base/file_path.mojom";
import "url/mojom/origin.mojom";
import "url/mojom/url.mojom";
struct InstallIsolatedWebAppSuccess {};
union InstallIsolatedWebAppResult {
InstallIsolatedWebAppSuccess success;
string error;
};
// Dev mode IWAs are either installed from a proxy origin, or from a Web Bundle
// file.
union IwaDevModeLocation {
url.mojom.Origin proxy_origin;
mojo_base.mojom.FilePath bundle_path;
};
struct IwaDevModeAppInfo {
string app_id;
string name;
IwaDevModeLocation location;
string installed_version;
};
// Handles requests from chrome://web-app-internals.
// This is expected to be hosted in the browser process.
interface WebAppInternalsHandler {
// Returns Web App related debug information as a JSON string.
GetDebugInfoAsJsonString() => (string result);
// Returns whether the clearing is successful.
[EnableIf=is_chromeos_lacros]
ClearExperimentalWebAppIsolationData() => (bool success);
// Returns whether the installation succeeded.
InstallIsolatedWebAppFromDevProxy(url.mojom.Url url) =>
(InstallIsolatedWebAppResult result);
// Returns whether the installation succeeded.
SelectFileAndInstallIsolatedWebAppFromDevBundle() =>
(InstallIsolatedWebAppResult result);
// Triggers an update for a dev mode proxy app. Returns a string containing a
// success or error message.
UpdateDevProxyIsolatedWebApp(string app_id) => (string result);
// Triggers an update for a dev mode bundle app by opening a file picker to
// let the user choose a Signed Web Bundle. Returns a string containing a
// success or error message.
SelectFileAndUpdateIsolatedWebAppFromDevBundle(string app_id) =>
(string result);
// Triggers update discovery for installed non-dev-mode Isolated Web Apps.
// Returns a string containing a success or error message.
SearchForIsolatedWebAppUpdates() => (string result);
// Returns information about installed dev mode IWAs.
GetIsolatedWebAppDevModeAppInfo() => (array<IwaDevModeAppInfo> apps);
// Rotates the key for `web_bundle_id` to `rotated_key` and informs all
// observers that a key rotation has taken place.
RotateKey(string web_bundle_id, array<uint8>? rotated_key);
};