File: web_app_internals.mojom

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (129 lines) | stat: -rw-r--r-- 4,331 bytes parent folder | download | duplicates (6)
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);
};