1#![allow(dead_code)]
3use super::target;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12#[allow(deprecated)]
13#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
14pub enum DisplayMode {
15 #[serde(rename = "standalone")]
16 Standalone,
17 #[serde(rename = "browser")]
18 Browser,
19}
20#[allow(deprecated)]
21#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
22#[builder(setter(into, strip_option))]
23#[serde(rename_all = "camelCase")]
24#[doc = "The following types are the replica of\n <https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67>"]
25pub struct FileHandlerAccept {
26 #[serde(default)]
27 #[doc = "New name of the mimetype according to\n <https://www.iana.org/assignments/media-types/media-types.xhtml>"]
28 pub media_type: String,
29 #[serde(default)]
30 pub file_extensions: Vec<String>,
31}
32#[allow(deprecated)]
33#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
34#[builder(setter(into, strip_option))]
35#[serde(rename_all = "camelCase")]
36pub struct FileHandler {
37 #[serde(default)]
38 pub action: String,
39 pub accepts: Vec<FileHandlerAccept>,
40 #[serde(default)]
41 pub display_name: String,
42}
43#[allow(deprecated)]
44#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
45#[builder(setter(into, strip_option))]
46#[serde(rename_all = "camelCase")]
47#[doc = "Returns the following OS state for the given manifest id."]
48pub struct GetOsAppState {
49 #[serde(default)]
50 #[doc = "The id from the webapp's manifest file, commonly it's the url of the\n site installing the webapp. See\n <https://web.dev/learn/pwa/web-app-manifest>."]
51 pub manifest_id: String,
52}
53#[allow(deprecated)]
54#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
55#[builder(setter(into, strip_option))]
56#[serde(rename_all = "camelCase")]
57#[doc = "Installs the given manifest identity, optionally using the given installUrlOrBundleUrl\n \n IWA-specific install description:\n manifestId corresponds to isolated-app:// + web_package::SignedWebBundleId\n \n File installation mode:\n The installUrlOrBundleUrl can be either file:// or http(s):// pointing\n to a signed web bundle (.swbn). In this case SignedWebBundleId must correspond to\n The .swbn file's signing key.\n \n Dev proxy installation mode:\n installUrlOrBundleUrl must be http(s):// that serves dev mode IWA.\n web_package::SignedWebBundleId must be of type dev proxy.\n \n The advantage of dev proxy mode is that all changes to IWA\n automatically will be reflected in the running app without\n reinstallation.\n \n To generate bundle id for proxy mode:\n 1. Generate 32 random bytes.\n 2. Add a specific suffix at the end following the documentation\n <https://github.com/WICG/isolated-web-apps/blob/main/Scheme.md#suffix>\n 3. Encode the entire sequence using Base32 without padding.\n \n If Chrome is not in IWA dev\n mode, the installation will fail, regardless of the state of the allowlist."]
58pub struct Install {
59 #[serde(default)]
60 pub manifest_id: String,
61 #[builder(default)]
62 #[serde(skip_serializing_if = "Option::is_none")]
63 #[serde(default)]
64 #[doc = "The location of the app or bundle overriding the one derived from the\n manifestId."]
65 pub install_url_or_bundle_url: Option<String>,
66}
67#[allow(deprecated)]
68#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
69#[builder(setter(into, strip_option))]
70#[serde(rename_all = "camelCase")]
71#[doc = "Uninstalls the given manifest_id and closes any opened app windows."]
72pub struct Uninstall {
73 #[serde(default)]
74 pub manifest_id: String,
75}
76#[allow(deprecated)]
77#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
78#[builder(setter(into, strip_option))]
79#[serde(rename_all = "camelCase")]
80#[doc = "Launches the installed web app, or an url in the same web app instead of the\n default start url if it is provided. Returns a page Target.TargetID which\n can be used to attach to via Target.attachToTarget or similar APIs."]
81pub struct Launch {
82 #[serde(default)]
83 pub manifest_id: String,
84 #[builder(default)]
85 #[serde(skip_serializing_if = "Option::is_none")]
86 #[serde(default)]
87 pub url: Option<String>,
88}
89#[allow(deprecated)]
90#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
91#[builder(setter(into, strip_option))]
92#[serde(rename_all = "camelCase")]
93#[doc = "Opens one or more local files from an installed web app identified by its\n manifestId. The web app needs to have file handlers registered to process\n the files. The API returns one or more page Target.TargetIDs which can be\n used to attach to via Target.attachToTarget or similar APIs.\n If some files in the parameters cannot be handled by the web app, they will\n be ignored. If none of the files can be handled, this API returns an error.\n If no files are provided as the parameter, this API also returns an error.\n \n According to the definition of the file handlers in the manifest file, one\n Target.TargetID may represent a page handling one or more files. The order\n of the returned Target.TargetIDs is not guaranteed.\n \n TODO(crbug.com/339454034): Check the existences of the input files."]
94pub struct LaunchFilesInApp {
95 #[serde(default)]
96 pub manifest_id: String,
97 #[serde(default)]
98 pub files: Vec<String>,
99}
100#[allow(deprecated)]
101#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
102#[builder(setter(into, strip_option))]
103#[serde(rename_all = "camelCase")]
104#[doc = "Opens the current page in its web app identified by the manifest id, needs\n to be called on a page target. This function returns immediately without\n waiting for the app to finish loading."]
105pub struct OpenCurrentPageInApp {
106 #[serde(default)]
107 pub manifest_id: String,
108}
109#[allow(deprecated)]
110#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
111#[builder(setter(into, strip_option))]
112#[serde(rename_all = "camelCase")]
113#[doc = "Changes user settings of the web app identified by its manifestId. If the\n app was not installed, this command returns an error. Unset parameters will\n be ignored; unrecognized values will cause an error.\n \n Unlike the ones defined in the manifest files of the web apps, these\n settings are provided by the browser and controlled by the users, they\n impact the way the browser handling the web apps.\n \n See the comment of each parameter."]
114pub struct ChangeAppUserSettings {
115 #[serde(default)]
116 pub manifest_id: String,
117 #[builder(default)]
118 #[serde(skip_serializing_if = "Option::is_none")]
119 #[serde(default)]
120 #[doc = "If user allows the links clicked on by the user in the app's scope, or\n extended scope if the manifest has scope extensions and the flags\n `DesktopPWAsLinkCapturingWithScopeExtensions` and\n `WebAppEnableScopeExtensions` are enabled.\n \n Note, the API does not support resetting the linkCapturing to the\n initial value, uninstalling and installing the web app again will reset\n it.\n \n TODO(crbug.com/339453269): Setting this value on ChromeOS is not\n supported yet."]
121 pub link_capturing: Option<bool>,
122 #[builder(default)]
123 #[serde(skip_serializing_if = "Option::is_none")]
124 pub display_mode: Option<DisplayMode>,
125}
126#[allow(deprecated)]
127#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
128#[serde(rename_all = "camelCase")]
129#[doc = "Returns the following OS state for the given manifest id."]
130pub struct GetOsAppStateReturnObject {
131 #[serde(default)]
132 pub badge_count: JsUInt,
133 pub file_handlers: Vec<FileHandler>,
134}
135#[allow(deprecated)]
136#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
137#[doc = "Installs the given manifest identity, optionally using the given installUrlOrBundleUrl\n \n IWA-specific install description:\n manifestId corresponds to isolated-app:// + web_package::SignedWebBundleId\n \n File installation mode:\n The installUrlOrBundleUrl can be either file:// or http(s):// pointing\n to a signed web bundle (.swbn). In this case SignedWebBundleId must correspond to\n The .swbn file's signing key.\n \n Dev proxy installation mode:\n installUrlOrBundleUrl must be http(s):// that serves dev mode IWA.\n web_package::SignedWebBundleId must be of type dev proxy.\n \n The advantage of dev proxy mode is that all changes to IWA\n automatically will be reflected in the running app without\n reinstallation.\n \n To generate bundle id for proxy mode:\n 1. Generate 32 random bytes.\n 2. Add a specific suffix at the end following the documentation\n <https://github.com/WICG/isolated-web-apps/blob/main/Scheme.md#suffix>\n 3. Encode the entire sequence using Base32 without padding.\n \n If Chrome is not in IWA dev\n mode, the installation will fail, regardless of the state of the allowlist."]
138pub struct InstallReturnObject(pub Option<Json>);
139#[allow(deprecated)]
140#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
141#[doc = "Uninstalls the given manifest_id and closes any opened app windows."]
142pub struct UninstallReturnObject(pub Option<Json>);
143#[allow(deprecated)]
144#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
145#[serde(rename_all = "camelCase")]
146#[doc = "Launches the installed web app, or an url in the same web app instead of the\n default start url if it is provided. Returns a page Target.TargetID which\n can be used to attach to via Target.attachToTarget or similar APIs."]
147pub struct LaunchReturnObject {
148 #[doc = "ID of the tab target created as a result."]
149 pub target_id: target::TargetId,
150}
151#[allow(deprecated)]
152#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
153#[serde(rename_all = "camelCase")]
154#[doc = "Opens one or more local files from an installed web app identified by its\n manifestId. The web app needs to have file handlers registered to process\n the files. The API returns one or more page Target.TargetIDs which can be\n used to attach to via Target.attachToTarget or similar APIs.\n If some files in the parameters cannot be handled by the web app, they will\n be ignored. If none of the files can be handled, this API returns an error.\n If no files are provided as the parameter, this API also returns an error.\n \n According to the definition of the file handlers in the manifest file, one\n Target.TargetID may represent a page handling one or more files. The order\n of the returned Target.TargetIDs is not guaranteed.\n \n TODO(crbug.com/339454034): Check the existences of the input files."]
155pub struct LaunchFilesInAppReturnObject {
156 #[doc = "IDs of the tab targets created as the result."]
157 pub target_ids: target::TargetId,
158}
159#[allow(deprecated)]
160#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
161#[doc = "Opens the current page in its web app identified by the manifest id, needs\n to be called on a page target. This function returns immediately without\n waiting for the app to finish loading."]
162pub struct OpenCurrentPageInAppReturnObject(pub Option<Json>);
163#[allow(deprecated)]
164#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
165#[doc = "Changes user settings of the web app identified by its manifestId. If the\n app was not installed, this command returns an error. Unset parameters will\n be ignored; unrecognized values will cause an error.\n \n Unlike the ones defined in the manifest files of the web apps, these\n settings are provided by the browser and controlled by the users, they\n impact the way the browser handling the web apps.\n \n See the comment of each parameter."]
166pub struct ChangeAppUserSettingsReturnObject(pub Option<Json>);
167#[allow(deprecated)]
168impl Method for GetOsAppState {
169 const NAME: &'static str = "PWA.getOsAppState";
170 type ReturnObject = GetOsAppStateReturnObject;
171}
172#[allow(deprecated)]
173impl Method for Install {
174 const NAME: &'static str = "PWA.install";
175 type ReturnObject = InstallReturnObject;
176}
177#[allow(deprecated)]
178impl Method for Uninstall {
179 const NAME: &'static str = "PWA.uninstall";
180 type ReturnObject = UninstallReturnObject;
181}
182#[allow(deprecated)]
183impl Method for Launch {
184 const NAME: &'static str = "PWA.launch";
185 type ReturnObject = LaunchReturnObject;
186}
187#[allow(deprecated)]
188impl Method for LaunchFilesInApp {
189 const NAME: &'static str = "PWA.launchFilesInApp";
190 type ReturnObject = LaunchFilesInAppReturnObject;
191}
192#[allow(deprecated)]
193impl Method for OpenCurrentPageInApp {
194 const NAME: &'static str = "PWA.openCurrentPageInApp";
195 type ReturnObject = OpenCurrentPageInAppReturnObject;
196}
197#[allow(deprecated)]
198impl Method for ChangeAppUserSettings {
199 const NAME: &'static str = "PWA.changeAppUserSettings";
200 type ReturnObject = ChangeAppUserSettingsReturnObject;
201}
202#[allow(dead_code)]
203pub mod events {
204 #[allow(unused_imports)]
205 use super::super::types::*;
206 #[allow(unused_imports)]
207 use derive_builder::Builder;
208 #[allow(unused_imports)]
209 use serde::{Deserialize, Serialize};
210 #[allow(unused_imports)]
211 use serde_json::Value as Json;
212}