1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129
|
// 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 {
string web_bundle_id;
};
union InstallIsolatedWebAppResult {
InstallIsolatedWebAppSuccess success;
string error;
};
// Describes how a manifest-installed app should perform update checks.
struct UpdateInfo {
url.mojom.Url update_manifest_url;
string update_channel;
string? pinned_version;
bool allow_downgrades = false;
};
// Dev mode IWAs are either installed from a proxy origin, or from a Web Bundle
// file, or via an update manifest url (the latter case is indicated by the
// presence of `update_info` in IwaDevModeInfo).
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;
UpdateInfo? update_info;
};
// Mimics web_app::UpdateManifest::VersionEntry.
struct VersionEntry {
string version;
url.mojom.Url web_bundle_url;
};
// Mimics web_app::UpdateManifest.
struct UpdateManifest {
array<VersionEntry> versions;
};
union ParseUpdateManifestFromUrlResult {
UpdateManifest update_manifest;
string error;
};
// Parameters necessary for InstallIsolatedWebAppFromBundleUrl().
struct InstallFromBundleUrlParams {
url.mojom.Url web_bundle_url;
UpdateInfo update_info;
};
// 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 installation succeeded.
InstallIsolatedWebAppFromDevProxy(url.mojom.Url url)
=> (InstallIsolatedWebAppResult result);
// Returns whether the installation succeeded.
SelectFileAndInstallIsolatedWebAppFromDevBundle()
=> (InstallIsolatedWebAppResult result);
// Attempts to fetch & parse an IWA update manifest from the provided url.
ParseUpdateManifestFromUrl(url.mojom.Url update_manifest_url)
=> (ParseUpdateManifestFromUrlResult result);
// Attempts to download a web bundle & install an IWA in dev mode with the
// provided `params`.
InstallIsolatedWebAppFromBundleUrl(InstallFromBundleUrlParams params)
=> (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 an update for a manifest-installed dev mode app.
// Returns a string containing a success or error message.
UpdateManifestInstalledIsolatedWebApp(string app_id) => (string result);
// Sets `web_app.isolation_data.update_channel` to `update_channel` for this
// `app_id`.
SetUpdateChannelForIsolatedWebApp(string app_id, string update_channel)
=> (bool success);
// Sets `pinned_version` value for given `app_id`.
SetPinnedVersionForIsolatedWebApp(string app_id, string pinned_version)
=> (bool success);
// Unpins the IWA by setting `pinned_version` to null.
ResetPinnedVersionForIsolatedWebApp(string app_id);
// Sets the `allow_downgrades` value for a given `app_id`.
SetAllowDowngradesForIsolatedWebApp(bool allow_downgrades, string app_id);
// 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);
};
|