extensions

package
v0.157.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

Package extensions provides the Chrome DevTools Protocol commands, types, and events for the Extensions domain.

Defines commands and events for browser extensions.

Generated by the cdproto-gen command.

Index

Constants

View Source
const (
	CommandTriggerAction      = "Extensions.triggerAction"
	CommandLoadUnpacked       = "Extensions.loadUnpacked"
	CommandGetExtensions      = "Extensions.getExtensions"
	CommandUninstall          = "Extensions.uninstall"
	CommandGetStorageItems    = "Extensions.getStorageItems"
	CommandRemoveStorageItems = "Extensions.removeStorageItems"
	CommandClearStorageItems  = "Extensions.clearStorageItems"
	CommandSetStorageItems    = "Extensions.setStorageItems"
)

Command names.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClearStorageItemsParams

type ClearStorageItemsParams struct {
	ID          string      `json:"id"`          // ID of extension.
	StorageArea StorageArea `json:"storageArea"` // StorageArea to remove data from.
}

ClearStorageItemsParams clears extension storage in the given storageArea.

func ClearStorageItems

func ClearStorageItems(id string, storageArea StorageArea) *ClearStorageItemsParams

ClearStorageItems clears extension storage in the given storageArea.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-clearStorageItems

parameters:

id - ID of extension.
storageArea - StorageArea to remove data from.

func (*ClearStorageItemsParams) Do

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

Do executes Extensions.clearStorageItems against the provided context.

type ExtensionInfo

type ExtensionInfo struct {
	ID      string `json:"id"`      // Extension id.
	Name    string `json:"name"`    // Extension name.
	Version string `json:"version"` // Extension version.
	Path    string `json:"path"`    // The path from which the extension was loaded.
	Enabled bool   `json:"enabled"` // Extension enabled status.
}

ExtensionInfo detailed information about an extension.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#type-ExtensionInfo

type GetExtensionsParams

type GetExtensionsParams struct{}

GetExtensionsParams gets a list of all unpacked extensions.

func GetExtensions

func GetExtensions() *GetExtensionsParams

GetExtensions gets a list of all unpacked extensions.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-getExtensions

func (*GetExtensionsParams) Do

func (p *GetExtensionsParams) Do(ctx context.Context) (extensions []*ExtensionInfo, err error)

Do executes Extensions.getExtensions against the provided context.

returns:

extensions

type GetExtensionsReturns

type GetExtensionsReturns struct {
	Extensions []*ExtensionInfo `json:"extensions,omitempty,omitzero"`
}

GetExtensionsReturns return values.

type GetStorageItemsParams

type GetStorageItemsParams struct {
	ID          string      `json:"id"`                      // ID of extension.
	StorageArea StorageArea `json:"storageArea"`             // StorageArea to retrieve data from.
	Keys        []string    `json:"keys,omitempty,omitzero"` // Keys to retrieve.
}

GetStorageItemsParams gets data from extension storage in the given storageArea. If keys is specified, these are used to filter the result.

func GetStorageItems

func GetStorageItems(id string, storageArea StorageArea) *GetStorageItemsParams

GetStorageItems gets data from extension storage in the given storageArea. If keys is specified, these are used to filter the result.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-getStorageItems

parameters:

id - ID of extension.
storageArea - StorageArea to retrieve data from.

func (*GetStorageItemsParams) Do

func (p *GetStorageItemsParams) Do(ctx context.Context) (data jsontext.Value, err error)

Do executes Extensions.getStorageItems against the provided context.

returns:

data

func (GetStorageItemsParams) WithKeys

WithKeys keys to retrieve.

type GetStorageItemsReturns

type GetStorageItemsReturns struct {
	Data jsontext.Value `json:"data,omitempty,omitzero"`
}

GetStorageItemsReturns return values.

type LoadUnpackedParams

type LoadUnpackedParams struct {
	Path              string `json:"path"`              // Absolute file path.
	EnableInIncognito bool   `json:"enableInIncognito"` // Enable the extension in incognito
}

LoadUnpackedParams installs an unpacked extension from the filesystem similar to --load-extension CLI flags. Returns extension ID once the extension has been installed.

func LoadUnpacked

func LoadUnpacked(path string) *LoadUnpackedParams

LoadUnpacked installs an unpacked extension from the filesystem similar to --load-extension CLI flags. Returns extension ID once the extension has been installed.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-loadUnpacked

parameters:

path - Absolute file path.

func (*LoadUnpackedParams) Do

func (p *LoadUnpackedParams) Do(ctx context.Context) (id string, err error)

Do executes Extensions.loadUnpacked against the provided context.

returns:

id - Extension id.

func (LoadUnpackedParams) WithEnableInIncognito

func (p LoadUnpackedParams) WithEnableInIncognito(enableInIncognito bool) *LoadUnpackedParams

WithEnableInIncognito enable the extension in incognito.

type LoadUnpackedReturns

type LoadUnpackedReturns struct {
	ID string `json:"id,omitempty,omitzero"` // Extension id.
}

LoadUnpackedReturns return values.

type RemoveStorageItemsParams

type RemoveStorageItemsParams struct {
	ID          string      `json:"id"`          // ID of extension.
	StorageArea StorageArea `json:"storageArea"` // StorageArea to remove data from.
	Keys        []string    `json:"keys"`        // Keys to remove.
}

RemoveStorageItemsParams removes keys from extension storage in the given storageArea.

func RemoveStorageItems

func RemoveStorageItems(id string, storageArea StorageArea, keys []string) *RemoveStorageItemsParams

RemoveStorageItems removes keys from extension storage in the given storageArea.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-removeStorageItems

parameters:

id - ID of extension.
storageArea - StorageArea to remove data from.
keys - Keys to remove.

func (*RemoveStorageItemsParams) Do

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

Do executes Extensions.removeStorageItems against the provided context.

type SetStorageItemsParams

type SetStorageItemsParams struct {
	ID          string         `json:"id"`          // ID of extension.
	StorageArea StorageArea    `json:"storageArea"` // StorageArea to set data in.
	Values      jsontext.Value `json:"values"`
}

SetStorageItemsParams sets values in extension storage in the given storageArea. The provided values will be merged with existing values in the storage area.

func SetStorageItems

func SetStorageItems(id string, storageArea StorageArea, values jsontext.Value) *SetStorageItemsParams

SetStorageItems sets values in extension storage in the given storageArea. The provided values will be merged with existing values in the storage area.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-setStorageItems

parameters:

id - ID of extension.
storageArea - StorageArea to set data in.
values - Values to set.

func (*SetStorageItemsParams) Do

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

Do executes Extensions.setStorageItems against the provided context.

type StorageArea

type StorageArea string

StorageArea storage areas.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#type-StorageArea

const (
	StorageAreaSession StorageArea = "session"
	StorageAreaLocal   StorageArea = "local"
	StorageAreaSync    StorageArea = "sync"
	StorageAreaManaged StorageArea = "managed"
)

StorageArea values.

func (StorageArea) String

func (t StorageArea) String() string

String returns the StorageArea as string value.

func (*StorageArea) UnmarshalJSON

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

UnmarshalJSON satisfies [json.Unmarshaler].

type TriggerActionParams

type TriggerActionParams struct {
	ID       string `json:"id"`       // Extension id.
	TargetID string `json:"targetId"` // A tab target ID to trigger the default extension action on.
}

TriggerActionParams runs an extension default action.

func TriggerAction

func TriggerAction(id string, targetID string) *TriggerActionParams

TriggerAction runs an extension default action.

See: https://chromedevtools.github.io/devtools-protocol/tot/Extensions#method-triggerAction

parameters:

id - Extension id.
targetID - A tab target ID to trigger the default extension action on.

func (*TriggerActionParams) Do

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

Do executes Extensions.triggerAction against the provided context.

type UninstallParams

type UninstallParams struct {
	ID string `json:"id"` // Extension id.
}

UninstallParams uninstalls an unpacked extension (others not supported) from the profile.

func Uninstall

func Uninstall(id string) *UninstallParams

Uninstall uninstalls an unpacked extension (others not supported) from the profile.

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

parameters:

id - Extension id.

func (*UninstallParams) Do

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

Do executes Extensions.uninstall against the provided context.

Jump to

Keyboard shortcuts

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