pwa

package
v0.0.0-...-d1c7de7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package pwa provides the Chrome DevTools Protocol commands, types, and events for the PWA domain.

This domain allows interacting with the browser to control PWAs.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandGetOsAppState         = "PWA.getOsAppState"
	CommandInstall               = "PWA.install"
	CommandUninstall             = "PWA.uninstall"
	CommandLaunch                = "PWA.launch"
	CommandLaunchFilesInApp      = "PWA.launchFilesInApp"
	CommandOpenCurrentPageInApp  = "PWA.openCurrentPageInApp"
	CommandChangeAppUserSettings = "PWA.changeAppUserSettings"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChangeAppUserSettingsParams

type ChangeAppUserSettingsParams struct {
	ManifestID    string      `json:"manifestId"`
	LinkCapturing bool        `json:"linkCapturing,omitempty"` // If user allows the links clicked on by the user in the app's scope, or extended scope if the manifest has scope extensions and the flags DesktopPWAsLinkCapturingWithScopeExtensions and WebAppEnableScopeExtensions are enabled.  Note, the API does not support resetting the linkCapturing to the initial value, uninstalling and installing the web app again will reset it.  TODO(crbug.com/339453269): Setting this value on ChromeOS is not supported yet.
	DisplayMode   DisplayMode `json:"displayMode,omitempty"`
}

ChangeAppUserSettingsParams changes user settings of the web app identified by its manifestId. If the app was not installed, this command returns an error. Unset parameters will be ignored; unrecognized values will cause an error. Unlike the ones defined in the manifest files of the web apps, these settings are provided by the browser and controlled by the users, they impact the way the browser handling the web apps. See the comment of each parameter.

func ChangeAppUserSettings

func ChangeAppUserSettings(manifestID string) *ChangeAppUserSettingsParams

ChangeAppUserSettings changes user settings of the web app identified by its manifestId. If the app was not installed, this command returns an error. Unset parameters will be ignored; unrecognized values will cause an error. Unlike the ones defined in the manifest files of the web apps, these settings are provided by the browser and controlled by the users, they impact the way the browser handling the web apps. See the comment of each parameter.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-changeAppUserSettings

parameters:

manifestID

func (*ChangeAppUserSettingsParams) Do

Do executes PWA.changeAppUserSettings against the provided context.

func (ChangeAppUserSettingsParams) MarshalEasyJSON

func (v ChangeAppUserSettingsParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ChangeAppUserSettingsParams) MarshalJSON

func (v ChangeAppUserSettingsParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ChangeAppUserSettingsParams) UnmarshalEasyJSON

func (v *ChangeAppUserSettingsParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ChangeAppUserSettingsParams) UnmarshalJSON

func (v *ChangeAppUserSettingsParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (ChangeAppUserSettingsParams) WithDisplayMode

WithDisplayMode [no description].

func (ChangeAppUserSettingsParams) WithLinkCapturing

func (p ChangeAppUserSettingsParams) WithLinkCapturing(linkCapturing bool) *ChangeAppUserSettingsParams

WithLinkCapturing if user allows the links clicked on by the user in the app's scope, or extended scope if the manifest has scope extensions and the flags DesktopPWAsLinkCapturingWithScopeExtensions and WebAppEnableScopeExtensions are enabled. Note, the API does not support resetting the linkCapturing to the initial value, uninstalling and installing the web app again will reset it. TODO(crbug.com/339453269): Setting this value on ChromeOS is not supported yet.

type DisplayMode

type DisplayMode string

DisplayMode if user prefers opening the app in browser or an app window.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#type-DisplayMode

const (
	DisplayModeStandalone DisplayMode = "standalone"
	DisplayModeBrowser    DisplayMode = "browser"
)

DisplayMode values.

func (DisplayMode) MarshalEasyJSON

func (t DisplayMode) MarshalEasyJSON(out *jwriter.Writer)

MarshalEasyJSON satisfies easyjson.Marshaler.

func (DisplayMode) MarshalJSON

func (t DisplayMode) MarshalJSON() ([]byte, error)

MarshalJSON satisfies json.Marshaler.

func (DisplayMode) String

func (t DisplayMode) String() string

String returns the DisplayMode as string value.

func (*DisplayMode) UnmarshalEasyJSON

func (t *DisplayMode) UnmarshalEasyJSON(in *jlexer.Lexer)

UnmarshalEasyJSON satisfies easyjson.Unmarshaler.

func (*DisplayMode) UnmarshalJSON

func (t *DisplayMode) UnmarshalJSON(buf []byte) error

UnmarshalJSON satisfies json.Unmarshaler.

type FileHandler

type FileHandler struct {
	Action      string               `json:"action"`
	Accepts     []*FileHandlerAccept `json:"accepts"`
	DisplayName string               `json:"displayName"`
}

FileHandler [no description].

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#type-FileHandler

func (FileHandler) MarshalEasyJSON

func (v FileHandler) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FileHandler) MarshalJSON

func (v FileHandler) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FileHandler) UnmarshalEasyJSON

func (v *FileHandler) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FileHandler) UnmarshalJSON

func (v *FileHandler) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type FileHandlerAccept

type FileHandlerAccept struct {
	MediaType      string   `json:"mediaType"` // New name of the mimetype according to https://www.iana.org/assignments/media-types/media-types.xhtml
	FileExtensions []string `json:"fileExtensions"`
}

FileHandlerAccept the following types are the replica of https://crsrc.org/c/chrome/browser/web_applications/proto/web_app_os_integration_state.proto;drc=9910d3be894c8f142c977ba1023f30a656bc13fc;l=67.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#type-FileHandlerAccept

func (FileHandlerAccept) MarshalEasyJSON

func (v FileHandlerAccept) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (FileHandlerAccept) MarshalJSON

func (v FileHandlerAccept) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*FileHandlerAccept) UnmarshalEasyJSON

func (v *FileHandlerAccept) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*FileHandlerAccept) UnmarshalJSON

func (v *FileHandlerAccept) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type GetOsAppStateParams

type GetOsAppStateParams struct {
	ManifestID string `json:"manifestId"` // The id from the webapp's manifest file, commonly it's the url of the site installing the webapp. See https://web.dev/learn/pwa/web-app-manifest.
}

GetOsAppStateParams returns the following OS state for the given manifest id.

func GetOsAppState

func GetOsAppState(manifestID string) *GetOsAppStateParams

GetOsAppState returns the following OS state for the given manifest id.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-getOsAppState

parameters:

manifestID - The id from the webapp's manifest file, commonly it's the url of the site installing the webapp. See https://web.dev/learn/pwa/web-app-manifest.

func (*GetOsAppStateParams) Do

func (p *GetOsAppStateParams) Do(ctx context.Context) (badgeCount int64, fileHandlers []*FileHandler, err error)

Do executes PWA.getOsAppState against the provided context.

returns:

badgeCount
fileHandlers

func (GetOsAppStateParams) MarshalEasyJSON

func (v GetOsAppStateParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GetOsAppStateParams) MarshalJSON

func (v GetOsAppStateParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GetOsAppStateParams) UnmarshalEasyJSON

func (v *GetOsAppStateParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GetOsAppStateParams) UnmarshalJSON

func (v *GetOsAppStateParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type GetOsAppStateReturns

type GetOsAppStateReturns struct {
	BadgeCount   int64          `json:"badgeCount,omitempty"`
	FileHandlers []*FileHandler `json:"fileHandlers,omitempty"`
}

GetOsAppStateReturns return values.

func (GetOsAppStateReturns) MarshalEasyJSON

func (v GetOsAppStateReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (GetOsAppStateReturns) MarshalJSON

func (v GetOsAppStateReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*GetOsAppStateReturns) UnmarshalEasyJSON

func (v *GetOsAppStateReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*GetOsAppStateReturns) UnmarshalJSON

func (v *GetOsAppStateReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type InstallParams

type InstallParams struct {
	ManifestID            string `json:"manifestId"`
	InstallURLOrBundleURL string `json:"installUrlOrBundleUrl,omitempty"` // The location of the app or bundle overriding the one derived from the manifestId.
}

InstallParams installs the given manifest identity, optionally using the given install_url or IWA bundle location. TODO(crbug.com/337872319) Support IWA to meet the following specific requirement. IWA-specific install description: If the manifest_id is isolated-app://, install_url_or_bundle_url is required, and can be either an http(s) URL or file:// URL pointing to a signed web bundle (.swbn). The .swbn file's signing key must correspond to manifest_id. If Chrome is not in IWA dev mode, the installation will fail, regardless of the state of the allowlist.

func Install

func Install(manifestID string) *InstallParams

Install installs the given manifest identity, optionally using the given install_url or IWA bundle location. TODO(crbug.com/337872319) Support IWA to meet the following specific requirement. IWA-specific install description: If the manifest_id is isolated-app://, install_url_or_bundle_url is required, and can be either an http(s) URL or file:// URL pointing to a signed web bundle (.swbn). The .swbn file's signing key must correspond to manifest_id. If Chrome is not in IWA dev mode, the installation will fail, regardless of the state of the allowlist.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-install

parameters:

manifestID

func (*InstallParams) Do

func (p *InstallParams) Do(ctx context.Context) (err error)

Do executes PWA.install against the provided context.

func (InstallParams) MarshalEasyJSON

func (v InstallParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (InstallParams) MarshalJSON

func (v InstallParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*InstallParams) UnmarshalEasyJSON

func (v *InstallParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*InstallParams) UnmarshalJSON

func (v *InstallParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (InstallParams) WithInstallURLOrBundleURL

func (p InstallParams) WithInstallURLOrBundleURL(installURLOrBundleURL string) *InstallParams

WithInstallURLOrBundleURL the location of the app or bundle overriding the one derived from the manifestId.

type LaunchFilesInAppParams

type LaunchFilesInAppParams struct {
	ManifestID string   `json:"manifestId"`
	Files      []string `json:"files"`
}

LaunchFilesInAppParams opens one or more local files from an installed web app identified by its manifestId. The web app needs to have file handlers registered to process the files. The API returns one or more page Target.TargetIDs which can be used to attach to via Target.attachToTarget or similar APIs. If some files in the parameters cannot be handled by the web app, they will be ignored. If none of the files can be handled, this API returns an error. If no files are provided as the parameter, this API also returns an error. According to the definition of the file handlers in the manifest file, one Target.TargetID may represent a page handling one or more files. The order of the returned Target.TargetIDs is not guaranteed. TODO(crbug.com/339454034): Check the existences of the input files.

func LaunchFilesInApp

func LaunchFilesInApp(manifestID string, files []string) *LaunchFilesInAppParams

LaunchFilesInApp opens one or more local files from an installed web app identified by its manifestId. The web app needs to have file handlers registered to process the files. The API returns one or more page Target.TargetIDs which can be used to attach to via Target.attachToTarget or similar APIs. If some files in the parameters cannot be handled by the web app, they will be ignored. If none of the files can be handled, this API returns an error. If no files are provided as the parameter, this API also returns an error. According to the definition of the file handlers in the manifest file, one Target.TargetID may represent a page handling one or more files. The order of the returned Target.TargetIDs is not guaranteed. TODO(crbug.com/339454034): Check the existences of the input files.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-launchFilesInApp

parameters:

manifestID
files

func (*LaunchFilesInAppParams) Do

func (p *LaunchFilesInAppParams) Do(ctx context.Context) (targetIDs []target.ID, err error)

Do executes PWA.launchFilesInApp against the provided context.

returns:

targetIDs - IDs of the tab targets created as the result.

func (LaunchFilesInAppParams) MarshalEasyJSON

func (v LaunchFilesInAppParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LaunchFilesInAppParams) MarshalJSON

func (v LaunchFilesInAppParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LaunchFilesInAppParams) UnmarshalEasyJSON

func (v *LaunchFilesInAppParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LaunchFilesInAppParams) UnmarshalJSON

func (v *LaunchFilesInAppParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LaunchFilesInAppReturns

type LaunchFilesInAppReturns struct {
	TargetIDs []target.ID `json:"targetIds,omitempty"` // IDs of the tab targets created as the result.
}

LaunchFilesInAppReturns return values.

func (LaunchFilesInAppReturns) MarshalEasyJSON

func (v LaunchFilesInAppReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LaunchFilesInAppReturns) MarshalJSON

func (v LaunchFilesInAppReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LaunchFilesInAppReturns) UnmarshalEasyJSON

func (v *LaunchFilesInAppReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LaunchFilesInAppReturns) UnmarshalJSON

func (v *LaunchFilesInAppReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type LaunchParams

type LaunchParams struct {
	ManifestID string `json:"manifestId"`
	URL        string `json:"url,omitempty"`
}

LaunchParams launches the installed web app, or an url in the same web app instead of the default start url if it is provided. Returns a page Target.TargetID which can be used to attach to via Target.attachToTarget or similar APIs.

func Launch

func Launch(manifestID string) *LaunchParams

Launch launches the installed web app, or an url in the same web app instead of the default start url if it is provided. Returns a page Target.TargetID which can be used to attach to via Target.attachToTarget or similar APIs.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-launch

parameters:

manifestID

func (*LaunchParams) Do

func (p *LaunchParams) Do(ctx context.Context) (targetID target.ID, err error)

Do executes PWA.launch against the provided context.

returns:

targetID - ID of the tab target created as a result.

func (LaunchParams) MarshalEasyJSON

func (v LaunchParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LaunchParams) MarshalJSON

func (v LaunchParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LaunchParams) UnmarshalEasyJSON

func (v *LaunchParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LaunchParams) UnmarshalJSON

func (v *LaunchParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

func (LaunchParams) WithURL

func (p LaunchParams) WithURL(url string) *LaunchParams

WithURL [no description].

type LaunchReturns

type LaunchReturns struct {
	TargetID target.ID `json:"targetId,omitempty"` // ID of the tab target created as a result.
}

LaunchReturns return values.

func (LaunchReturns) MarshalEasyJSON

func (v LaunchReturns) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (LaunchReturns) MarshalJSON

func (v LaunchReturns) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*LaunchReturns) UnmarshalEasyJSON

func (v *LaunchReturns) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*LaunchReturns) UnmarshalJSON

func (v *LaunchReturns) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OpenCurrentPageInAppParams

type OpenCurrentPageInAppParams struct {
	ManifestID string `json:"manifestId"`
}

OpenCurrentPageInAppParams opens the current page in its web app identified by the manifest id, needs to be called on a page target. This function returns immediately without waiting for the app to finish loading.

func OpenCurrentPageInApp

func OpenCurrentPageInApp(manifestID string) *OpenCurrentPageInAppParams

OpenCurrentPageInApp opens the current page in its web app identified by the manifest id, needs to be called on a page target. This function returns immediately without waiting for the app to finish loading.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-openCurrentPageInApp

parameters:

manifestID

func (*OpenCurrentPageInAppParams) Do

Do executes PWA.openCurrentPageInApp against the provided context.

func (OpenCurrentPageInAppParams) MarshalEasyJSON

func (v OpenCurrentPageInAppParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OpenCurrentPageInAppParams) MarshalJSON

func (v OpenCurrentPageInAppParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OpenCurrentPageInAppParams) UnmarshalEasyJSON

func (v *OpenCurrentPageInAppParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OpenCurrentPageInAppParams) UnmarshalJSON

func (v *OpenCurrentPageInAppParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UninstallParams

type UninstallParams struct {
	ManifestID string `json:"manifestId"`
}

UninstallParams uninstalls the given manifest_id and closes any opened app windows.

func Uninstall

func Uninstall(manifestID string) *UninstallParams

Uninstall uninstalls the given manifest_id and closes any opened app windows.

See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-uninstall

parameters:

manifestID

func (*UninstallParams) Do

func (p *UninstallParams) Do(ctx context.Context) (err error)

Do executes PWA.uninstall against the provided context.

func (UninstallParams) MarshalEasyJSON

func (v UninstallParams) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UninstallParams) MarshalJSON

func (v UninstallParams) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UninstallParams) UnmarshalEasyJSON

func (v *UninstallParams) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UninstallParams) UnmarshalJSON

func (v *UninstallParams) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL