vendor/github.com/go-rod/rod/lib/proto/pwa.go
228 lines · 7634 bytes
1// This file is generated by "./lib/proto/generate"
2
3package proto
4
5/*
6
7PWA
8
9This domain allows interacting with the browser to control PWAs.
10
11*/
12
13// PWAFileHandlerAccept The following types are the replica of
14// https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67
15type PWAFileHandlerAccept struct {
16 // MediaType New name of the mimetype according to
17 // https://www.iana.org/assignments/media-types/media-types.xhtml
18 MediaType string `json:"mediaType"`
19
20 // FileExtensions ...
21 FileExtensions []string `json:"fileExtensions"`
22}
23
24// PWAFileHandler ...
25type PWAFileHandler struct {
26 // Action ...
27 Action string `json:"action"`
28
29 // Accepts ...
30 Accepts []*PWAFileHandlerAccept `json:"accepts"`
31
32 // DisplayName ...
33 DisplayName string `json:"displayName"`
34}
35
36// PWADisplayMode If user prefers opening the app in browser or an app window.
37type PWADisplayMode string
38
39const (
40 // PWADisplayModeStandalone enum const.
41 PWADisplayModeStandalone PWADisplayMode = "standalone"
42
43 // PWADisplayModeBrowser enum const.
44 PWADisplayModeBrowser PWADisplayMode = "browser"
45)
46
47// PWAGetOsAppState Returns the following OS state for the given manifest id.
48type PWAGetOsAppState struct {
49 // ManifestID The id from the webapp's manifest file, commonly it's the url of the
50 // site installing the webapp. See
51 // https://web.dev/learn/pwa/web-app-manifest.
52 ManifestID string `json:"manifestId"`
53}
54
55// ProtoReq name.
56func (m PWAGetOsAppState) ProtoReq() string { return "PWA.getOsAppState" }
57
58// Call the request.
59func (m PWAGetOsAppState) Call(c Client) (*PWAGetOsAppStateResult, error) {
60 var res PWAGetOsAppStateResult
61 return &res, call(m.ProtoReq(), m, &res, c)
62}
63
64// PWAGetOsAppStateResult ...
65type PWAGetOsAppStateResult struct {
66 // BadgeCount ...
67 BadgeCount int `json:"badgeCount"`
68
69 // FileHandlers ...
70 FileHandlers []*PWAFileHandler `json:"fileHandlers"`
71}
72
73// PWAInstall Installs the given manifest identity, optionally using the given install_url
74// or IWA bundle location.
75//
76// TODO(crbug.com/337872319) Support IWA to meet the following specific
77// requirement.
78// IWA-specific install description: If the manifest_id is isolated-app://,
79// install_url_or_bundle_url is required, and can be either an http(s) URL or
80// file:// URL pointing to a signed web bundle (.swbn). The .swbn file's
81// signing key must correspond to manifest_id. If Chrome is not in IWA dev
82// mode, the installation will fail, regardless of the state of the allowlist.
83type PWAInstall struct {
84 // ManifestID ...
85 ManifestID string `json:"manifestId"`
86
87 // InstallURLOrBundleURL (optional) The location of the app or bundle overriding the one derived from the
88 // manifestId.
89 InstallURLOrBundleURL string `json:"installUrlOrBundleUrl,omitempty"`
90}
91
92// ProtoReq name.
93func (m PWAInstall) ProtoReq() string { return "PWA.install" }
94
95// Call sends the request.
96func (m PWAInstall) Call(c Client) error {
97 return call(m.ProtoReq(), m, nil, c)
98}
99
100// PWAUninstall Uninstalls the given manifest_id and closes any opened app windows.
101type PWAUninstall struct {
102 // ManifestID ...
103 ManifestID string `json:"manifestId"`
104}
105
106// ProtoReq name.
107func (m PWAUninstall) ProtoReq() string { return "PWA.uninstall" }
108
109// Call sends the request.
110func (m PWAUninstall) Call(c Client) error {
111 return call(m.ProtoReq(), m, nil, c)
112}
113
114// PWALaunch Launches the installed web app, or an url in the same web app instead of the
115// default start url if it is provided. Returns a page Target.TargetID which
116// can be used to attach to via Target.attachToTarget or similar APIs.
117type PWALaunch struct {
118 // ManifestID ...
119 ManifestID string `json:"manifestId"`
120
121 // URL (optional) ...
122 URL string `json:"url,omitempty"`
123}
124
125// ProtoReq name.
126func (m PWALaunch) ProtoReq() string { return "PWA.launch" }
127
128// Call the request.
129func (m PWALaunch) Call(c Client) (*PWALaunchResult, error) {
130 var res PWALaunchResult
131 return &res, call(m.ProtoReq(), m, &res, c)
132}
133
134// PWALaunchResult ...
135type PWALaunchResult struct {
136 // TargetID ID of the tab target created as a result.
137 TargetID TargetTargetID `json:"targetId"`
138}
139
140// PWALaunchFilesInApp Opens one or more local files from an installed web app identified by its
141// manifestId. The web app needs to have file handlers registered to process
142// the files. The API returns one or more page Target.TargetIDs which can be
143// used to attach to via Target.attachToTarget or similar APIs.
144// If some files in the parameters cannot be handled by the web app, they will
145// be ignored. If none of the files can be handled, this API returns an error.
146// If no files are provided as the parameter, this API also returns an error.
147//
148// According to the definition of the file handlers in the manifest file, one
149// Target.TargetID may represent a page handling one or more files. The order
150// of the returned Target.TargetIDs is not guaranteed.
151//
152// TODO(crbug.com/339454034): Check the existences of the input files.
153type PWALaunchFilesInApp struct {
154 // ManifestID ...
155 ManifestID string `json:"manifestId"`
156
157 // Files ...
158 Files []string `json:"files"`
159}
160
161// ProtoReq name.
162func (m PWALaunchFilesInApp) ProtoReq() string { return "PWA.launchFilesInApp" }
163
164// Call the request.
165func (m PWALaunchFilesInApp) Call(c Client) (*PWALaunchFilesInAppResult, error) {
166 var res PWALaunchFilesInAppResult
167 return &res, call(m.ProtoReq(), m, &res, c)
168}
169
170// PWALaunchFilesInAppResult ...
171type PWALaunchFilesInAppResult struct {
172 // TargetIDs IDs of the tab targets created as the result.
173 TargetIDs []TargetTargetID `json:"targetIds"`
174}
175
176// PWAOpenCurrentPageInApp Opens the current page in its web app identified by the manifest id, needs
177// to be called on a page target. This function returns immediately without
178// waiting for the app to finish loading.
179type PWAOpenCurrentPageInApp struct {
180 // ManifestID ...
181 ManifestID string `json:"manifestId"`
182}
183
184// ProtoReq name.
185func (m PWAOpenCurrentPageInApp) ProtoReq() string { return "PWA.openCurrentPageInApp" }
186
187// Call sends the request.
188func (m PWAOpenCurrentPageInApp) Call(c Client) error {
189 return call(m.ProtoReq(), m, nil, c)
190}
191
192// PWAChangeAppUserSettings Changes user settings of the web app identified by its manifestId. If the
193// app was not installed, this command returns an error. Unset parameters will
194// be ignored; unrecognized values will cause an error.
195//
196// Unlike the ones defined in the manifest files of the web apps, these
197// settings are provided by the browser and controlled by the users, they
198// impact the way the browser handling the web apps.
199//
200// See the comment of each parameter.
201type PWAChangeAppUserSettings struct {
202 // ManifestID ...
203 ManifestID string `json:"manifestId"`
204
205 // LinkCapturing (optional) If user allows the links clicked on by the user in the app's scope, or
206 // extended scope if the manifest has scope extensions and the flags
207 // `DesktopPWAsLinkCapturingWithScopeExtensions` and
208 // `WebAppEnableScopeExtensions` are enabled.
209 //
210 // Note, the API does not support resetting the linkCapturing to the
211 // initial value, uninstalling and installing the web app again will reset
212 // it.
213 //
214 // TODO(crbug.com/339453269): Setting this value on ChromeOS is not
215 // supported yet.
216 LinkCapturing bool `json:"linkCapturing,omitempty"`
217
218 // DisplayMode (optional) ...
219 DisplayMode PWADisplayMode `json:"displayMode,omitempty"`
220}
221
222// ProtoReq name.
223func (m PWAChangeAppUserSettings) ProtoReq() string { return "PWA.changeAppUserSettings" }
224
225// Call sends the request.
226func (m PWAChangeAppUserSettings) Call(c Client) error {
227 return call(m.ProtoReq(), m, nil, c)
228}