browser

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2022 License: MIT Imports: 5 Imported by: 8

Documentation

Overview

Package browser implements the Browser domain. The Browser domain defines methods and events for browser managing.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(conn *rpcc.Conn) *domainClient

NewClient returns a client for the Browser domain with the connection set to conn.

Types

type Bounds

type Bounds struct {
	Left        *int        `json:"left,omitempty"`        // The offset from the left edge of the screen to the window in pixels.
	Top         *int        `json:"top,omitempty"`         // The offset from the top edge of the screen to the window in pixels.
	Width       *int        `json:"width,omitempty"`       // The window width in pixels.
	Height      *int        `json:"height,omitempty"`      // The window height in pixels.
	WindowState WindowState `json:"windowState,omitempty"` // The window state. Default to normal.
}

Bounds Browser window bounds information

Note: This type is experimental.

type Bucket added in v0.15.6

type Bucket struct {
	Low   int `json:"low"`   // Minimum value (inclusive).
	High  int `json:"high"`  // Maximum value (exclusive).
	Count int `json:"count"` // Number of samples.
}

Bucket Chrome histogram bucket.

Note: This type is experimental.

type CancelDownloadArgs added in v0.31.0

type CancelDownloadArgs struct {
	GUID             string     `json:"guid"`                       // Global unique identifier of the download.
	BrowserContextID *ContextID `json:"browserContextId,omitempty"` // BrowserContext to perform the action in. When omitted, default browser context is used.
}

CancelDownloadArgs represents the arguments for CancelDownload in the Browser domain.

func NewCancelDownloadArgs added in v0.31.0

func NewCancelDownloadArgs(guid string) *CancelDownloadArgs

NewCancelDownloadArgs initializes CancelDownloadArgs with the required arguments.

func (*CancelDownloadArgs) SetBrowserContextID added in v0.31.0

func (a *CancelDownloadArgs) SetBrowserContextID(browserContextID ContextID) *CancelDownloadArgs

SetBrowserContextID sets the BrowserContextID optional argument. BrowserContext to perform the action in. When omitted, default browser context is used.

type CommandID added in v0.31.0

type CommandID string

CommandID Browser command ids used by executeBrowserCommand.

Note: This type is experimental.

const (
	CommandIDNotSet         CommandID = ""
	CommandIDOpenTabSearch  CommandID = "openTabSearch"
	CommandIDCloseTabSearch CommandID = "closeTabSearch"
)

CommandID as enums.

func (CommandID) String added in v0.31.0

func (e CommandID) String() string

func (CommandID) Valid added in v0.31.0

func (e CommandID) Valid() bool

type ContextID added in v0.25.0

type ContextID = internal.BrowserContextID

ContextID

Note: This type is experimental.

type DownloadProgressClient added in v0.32.0

type DownloadProgressClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DownloadProgressReply, error)
	rpcc.Stream
}

DownloadProgressClient is a client for DownloadProgress events. Fired when download makes progress. Last call has |done| == true.

type DownloadProgressReply added in v0.32.0

type DownloadProgressReply struct {
	GUID          string  `json:"guid"`          // Global unique identifier of the download.
	TotalBytes    float64 `json:"totalBytes"`    // Total expected bytes to download.
	ReceivedBytes float64 `json:"receivedBytes"` // Total bytes received.
	// State Download status.
	//
	// Values: "inProgress", "completed", "canceled".
	State string `json:"state"`
}

DownloadProgressReply is the reply for DownloadProgress events.

type DownloadWillBeginClient added in v0.32.0

type DownloadWillBeginClient interface {
	// Recv calls RecvMsg on rpcc.Stream, blocks until the event is
	// triggered, context canceled or connection closed.
	Recv() (*DownloadWillBeginReply, error)
	rpcc.Stream
}

DownloadWillBeginClient is a client for DownloadWillBegin events. Fired when page is about to start a download.

type DownloadWillBeginReply added in v0.32.0

type DownloadWillBeginReply struct {
	FrameID           page.FrameID `json:"frameId"`           // Id of the frame that caused the download to begin.
	GUID              string       `json:"guid"`              // Global unique identifier of the download.
	URL               string       `json:"url"`               // URL of the resource being downloaded.
	SuggestedFilename string       `json:"suggestedFilename"` // Suggested file name of the resource (the actual name of the file saved on disk may differ).
}

DownloadWillBeginReply is the reply for DownloadWillBegin events.

type ExecuteBrowserCommandArgs added in v0.31.0

type ExecuteBrowserCommandArgs struct {
	CommandID CommandID `json:"commandId"` // No description.
}

ExecuteBrowserCommandArgs represents the arguments for ExecuteBrowserCommand in the Browser domain.

func NewExecuteBrowserCommandArgs added in v0.31.0

func NewExecuteBrowserCommandArgs(commandID CommandID) *ExecuteBrowserCommandArgs

NewExecuteBrowserCommandArgs initializes ExecuteBrowserCommandArgs with the required arguments.

type GetBrowserCommandLineReply added in v0.17.2

type GetBrowserCommandLineReply struct {
	Arguments []string `json:"arguments"` // Commandline parameters
}

GetBrowserCommandLineReply represents the return values for GetBrowserCommandLine in the Browser domain.

type GetHistogramArgs added in v0.15.6

type GetHistogramArgs struct {
	Name  string `json:"name"`            // Requested histogram name.
	Delta *bool  `json:"delta,omitempty"` // If true, retrieve delta since last call.
}

GetHistogramArgs represents the arguments for GetHistogram in the Browser domain.

func NewGetHistogramArgs added in v0.15.6

func NewGetHistogramArgs(name string) *GetHistogramArgs

NewGetHistogramArgs initializes GetHistogramArgs with the required arguments.

func (*GetHistogramArgs) SetDelta added in v0.18.5

func (a *GetHistogramArgs) SetDelta(delta bool) *GetHistogramArgs

SetDelta sets the Delta optional argument. If true, retrieve delta since last call.

type GetHistogramReply added in v0.15.6

type GetHistogramReply struct {
	Histogram Histogram `json:"histogram"` // Histogram.
}

GetHistogramReply represents the return values for GetHistogram in the Browser domain.

type GetHistogramsArgs added in v0.15.6

type GetHistogramsArgs struct {
	Query *string `json:"query,omitempty"` // Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.
	Delta *bool   `json:"delta,omitempty"` // If true, retrieve delta since last call.
}

GetHistogramsArgs represents the arguments for GetHistograms in the Browser domain.

func NewGetHistogramsArgs added in v0.15.6

func NewGetHistogramsArgs() *GetHistogramsArgs

NewGetHistogramsArgs initializes GetHistogramsArgs with the required arguments.

func (*GetHistogramsArgs) SetDelta added in v0.18.5

func (a *GetHistogramsArgs) SetDelta(delta bool) *GetHistogramsArgs

SetDelta sets the Delta optional argument. If true, retrieve delta since last call.

func (*GetHistogramsArgs) SetQuery added in v0.15.6

func (a *GetHistogramsArgs) SetQuery(query string) *GetHistogramsArgs

SetQuery sets the Query optional argument. Requested substring in name. Only histograms which have query as a substring in their name are extracted. An empty or absent query returns all histograms.

type GetHistogramsReply added in v0.15.6

type GetHistogramsReply struct {
	Histograms []Histogram `json:"histograms"` // Histograms.
}

GetHistogramsReply represents the return values for GetHistograms in the Browser domain.

type GetVersionReply added in v0.11.1

type GetVersionReply struct {
	ProtocolVersion string `json:"protocolVersion"` // Protocol version.
	Product         string `json:"product"`         // Product name.
	Revision        string `json:"revision"`        // Product revision.
	UserAgent       string `json:"userAgent"`       // User-Agent.
	JsVersion       string `json:"jsVersion"`       // V8 version.
}

GetVersionReply represents the return values for GetVersion in the Browser domain.

type GetWindowBoundsArgs

type GetWindowBoundsArgs struct {
	WindowID WindowID `json:"windowId"` // Browser window id.
}

GetWindowBoundsArgs represents the arguments for GetWindowBounds in the Browser domain.

func NewGetWindowBoundsArgs

func NewGetWindowBoundsArgs(windowID WindowID) *GetWindowBoundsArgs

NewGetWindowBoundsArgs initializes GetWindowBoundsArgs with the required arguments.

type GetWindowBoundsReply

type GetWindowBoundsReply struct {
	Bounds Bounds `json:"bounds"` // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}

GetWindowBoundsReply represents the return values for GetWindowBounds in the Browser domain.

type GetWindowForTargetArgs

type GetWindowForTargetArgs struct {
	TargetID *target.ID `json:"targetId,omitempty"` // Devtools agent host id. If called as a part of the session, associated targetId is used.
}

GetWindowForTargetArgs represents the arguments for GetWindowForTarget in the Browser domain.

func NewGetWindowForTargetArgs

func NewGetWindowForTargetArgs() *GetWindowForTargetArgs

NewGetWindowForTargetArgs initializes GetWindowForTargetArgs with the required arguments.

func (*GetWindowForTargetArgs) SetTargetID added in v0.21.0

func (a *GetWindowForTargetArgs) SetTargetID(targetID target.ID) *GetWindowForTargetArgs

SetTargetID sets the TargetID optional argument. Devtools agent host id. If called as a part of the session, associated targetId is used.

type GetWindowForTargetReply

type GetWindowForTargetReply struct {
	WindowID WindowID `json:"windowId"` // Browser window id.
	Bounds   Bounds   `json:"bounds"`   // Bounds information of the window. When window state is 'minimized', the restored window position and size are returned.
}

GetWindowForTargetReply represents the return values for GetWindowForTarget in the Browser domain.

type GrantPermissionsArgs added in v0.18.7

type GrantPermissionsArgs struct {
	Permissions      []PermissionType `json:"permissions"`                // No description.
	Origin           *string          `json:"origin,omitempty"`           // Origin the permission applies to, all origins if not specified.
	BrowserContextID *ContextID       `json:"browserContextId,omitempty"` // BrowserContext to override permissions. When omitted, default browser context is used.
}

GrantPermissionsArgs represents the arguments for GrantPermissions in the Browser domain.

func NewGrantPermissionsArgs added in v0.18.7

func NewGrantPermissionsArgs(permissions []PermissionType) *GrantPermissionsArgs

NewGrantPermissionsArgs initializes GrantPermissionsArgs with the required arguments.

func (*GrantPermissionsArgs) SetBrowserContextID added in v0.18.7

func (a *GrantPermissionsArgs) SetBrowserContextID(browserContextID ContextID) *GrantPermissionsArgs

SetBrowserContextID sets the BrowserContextID optional argument. BrowserContext to override permissions. When omitted, default browser context is used.

func (*GrantPermissionsArgs) SetOrigin added in v0.26.0

func (a *GrantPermissionsArgs) SetOrigin(origin string) *GrantPermissionsArgs

SetOrigin sets the Origin optional argument. Origin the permission applies to, all origins if not specified.

type Histogram added in v0.15.6

type Histogram struct {
	Name    string   `json:"name"`    // Name.
	Sum     int      `json:"sum"`     // Sum of sample values.
	Count   int      `json:"count"`   // Total number of samples.
	Buckets []Bucket `json:"buckets"` // Buckets.
}

Histogram Chrome histogram.

Note: This type is experimental.

type PermissionDescriptor added in v0.25.0

type PermissionDescriptor struct {
	Name                     string `json:"name"`                               // Name of permission. See https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/permissions/permission_descriptor.idl for valid permission names.
	Sysex                    *bool  `json:"sysex,omitempty"`                    // For "midi" permission, may also specify sysex control.
	UserVisibleOnly          *bool  `json:"userVisibleOnly,omitempty"`          // For "push" permission, may specify userVisibleOnly. Note that userVisibleOnly = true is the only currently supported type.
	AllowWithoutSanitization *bool  `json:"allowWithoutSanitization,omitempty"` // For "clipboard" permission, may specify allowWithoutSanitization.
	PanTiltZoom              *bool  `json:"panTiltZoom,omitempty"`              // For "camera" permission, may specify panTiltZoom.
}

PermissionDescriptor Definition of PermissionDescriptor defined in the Permissions API: https://w3c.github.io/permissions/#dictdef-permissiondescriptor.

Note: This type is experimental.

type PermissionSetting added in v0.25.0

type PermissionSetting string

PermissionSetting

Note: This type is experimental.

const (
	PermissionSettingNotSet  PermissionSetting = ""
	PermissionSettingGranted PermissionSetting = "granted"
	PermissionSettingDenied  PermissionSetting = "denied"
	PermissionSettingPrompt  PermissionSetting = "prompt"
)

PermissionSetting as enums.

func (PermissionSetting) String added in v0.25.0

func (e PermissionSetting) String() string

func (PermissionSetting) Valid added in v0.25.0

func (e PermissionSetting) Valid() bool

type PermissionType added in v0.18.7

type PermissionType string

PermissionType

Note: This type is experimental.

const (
	PermissionTypeNotSet                   PermissionType = ""
	PermissionTypeAccessibilityEvents      PermissionType = "accessibilityEvents"
	PermissionTypeAudioCapture             PermissionType = "audioCapture"
	PermissionTypeBackgroundSync           PermissionType = "backgroundSync"
	PermissionTypeBackgroundFetch          PermissionType = "backgroundFetch"
	PermissionTypeClipboardReadWrite       PermissionType = "clipboardReadWrite"
	PermissionTypeClipboardSanitizedWrite  PermissionType = "clipboardSanitizedWrite"
	PermissionTypeDisplayCapture           PermissionType = "displayCapture"
	PermissionTypeDurableStorage           PermissionType = "durableStorage"
	PermissionTypeFlash                    PermissionType = "flash"
	PermissionTypeGeolocation              PermissionType = "geolocation"
	PermissionTypeMidi                     PermissionType = "midi"
	PermissionTypeMidiSysex                PermissionType = "midiSysex"
	PermissionTypeNFC                      PermissionType = "nfc"
	PermissionTypeNotifications            PermissionType = "notifications"
	PermissionTypePaymentHandler           PermissionType = "paymentHandler"
	PermissionTypePeriodicBackgroundSync   PermissionType = "periodicBackgroundSync"
	PermissionTypeProtectedMediaIdentifier PermissionType = "protectedMediaIdentifier"
	PermissionTypeSensors                  PermissionType = "sensors"
	PermissionTypeVideoCapture             PermissionType = "videoCapture"
	PermissionTypeVideoCapturePanTiltZoom  PermissionType = "videoCapturePanTiltZoom"
	PermissionTypeIdleDetection            PermissionType = "idleDetection"
	PermissionTypeWakeLockScreen           PermissionType = "wakeLockScreen"
	PermissionTypeWakeLockSystem           PermissionType = "wakeLockSystem"
)

PermissionType as enums.

func (PermissionType) String added in v0.18.7

func (e PermissionType) String() string

func (PermissionType) Valid added in v0.18.7

func (e PermissionType) Valid() bool

type ResetPermissionsArgs added in v0.18.7

type ResetPermissionsArgs struct {
	BrowserContextID *ContextID `json:"browserContextId,omitempty"` // BrowserContext to reset permissions. When omitted, default browser context is used.
}

ResetPermissionsArgs represents the arguments for ResetPermissions in the Browser domain.

func NewResetPermissionsArgs added in v0.18.7

func NewResetPermissionsArgs() *ResetPermissionsArgs

NewResetPermissionsArgs initializes ResetPermissionsArgs with the required arguments.

func (*ResetPermissionsArgs) SetBrowserContextID added in v0.18.7

func (a *ResetPermissionsArgs) SetBrowserContextID(browserContextID ContextID) *ResetPermissionsArgs

SetBrowserContextID sets the BrowserContextID optional argument. BrowserContext to reset permissions. When omitted, default browser context is used.

type SetDockTileArgs added in v0.21.0

type SetDockTileArgs struct {
	BadgeLabel *string `json:"badgeLabel,omitempty"` // No description.
	Image      []byte  `json:"image,omitempty"`      // Png encoded image. (Encoded as a base64 string when passed over JSON)
}

SetDockTileArgs represents the arguments for SetDockTile in the Browser domain.

func NewSetDockTileArgs added in v0.21.0

func NewSetDockTileArgs() *SetDockTileArgs

NewSetDockTileArgs initializes SetDockTileArgs with the required arguments.

func (*SetDockTileArgs) SetBadgeLabel added in v0.21.0

func (a *SetDockTileArgs) SetBadgeLabel(badgeLabel string) *SetDockTileArgs

SetBadgeLabel sets the BadgeLabel optional argument.

func (*SetDockTileArgs) SetImage added in v0.21.0

func (a *SetDockTileArgs) SetImage(image []byte) *SetDockTileArgs

SetImage sets the Image optional argument. Png encoded image. (Encoded as a base64 string when passed over JSON)

type SetDownloadBehaviorArgs added in v0.26.0

type SetDownloadBehaviorArgs struct {
	// Behavior Whether to allow all or deny all download requests, or use
	// default Chrome behavior if available (otherwise deny).
	// |allowAndName| allows download and names files according to their
	// dowmload guids.
	//
	// Values: "deny", "allow", "allowAndName", "default".
	Behavior         string     `json:"behavior"`
	BrowserContextID *ContextID `json:"browserContextId,omitempty"` // BrowserContext to set download behavior. When omitted, default browser context is used.
	DownloadPath     *string    `json:"downloadPath,omitempty"`     // The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.
	EventsEnabled    *bool      `json:"eventsEnabled,omitempty"`    // Whether to emit download events (defaults to false).
}

SetDownloadBehaviorArgs represents the arguments for SetDownloadBehavior in the Browser domain.

func NewSetDownloadBehaviorArgs added in v0.26.0

func NewSetDownloadBehaviorArgs(behavior string) *SetDownloadBehaviorArgs

NewSetDownloadBehaviorArgs initializes SetDownloadBehaviorArgs with the required arguments.

func (*SetDownloadBehaviorArgs) SetBrowserContextID added in v0.26.0

func (a *SetDownloadBehaviorArgs) SetBrowserContextID(browserContextID ContextID) *SetDownloadBehaviorArgs

SetBrowserContextID sets the BrowserContextID optional argument. BrowserContext to set download behavior. When omitted, default browser context is used.

func (*SetDownloadBehaviorArgs) SetDownloadPath added in v0.26.0

func (a *SetDownloadBehaviorArgs) SetDownloadPath(downloadPath string) *SetDownloadBehaviorArgs

SetDownloadPath sets the DownloadPath optional argument. The default path to save downloaded files to. This is required if behavior is set to 'allow' or 'allowAndName'.

func (*SetDownloadBehaviorArgs) SetEventsEnabled added in v0.32.0

func (a *SetDownloadBehaviorArgs) SetEventsEnabled(eventsEnabled bool) *SetDownloadBehaviorArgs

SetEventsEnabled sets the EventsEnabled optional argument. Whether to emit download events (defaults to false).

type SetPermissionArgs added in v0.25.0

type SetPermissionArgs struct {
	Permission       PermissionDescriptor `json:"permission"`                 // Descriptor of permission to override.
	Setting          PermissionSetting    `json:"setting"`                    // Setting of the permission.
	Origin           *string              `json:"origin,omitempty"`           // Origin the permission applies to, all origins if not specified.
	BrowserContextID *ContextID           `json:"browserContextId,omitempty"` // Context to override. When omitted, default browser context is used.
}

SetPermissionArgs represents the arguments for SetPermission in the Browser domain.

func NewSetPermissionArgs added in v0.25.0

func NewSetPermissionArgs(permission PermissionDescriptor, setting PermissionSetting) *SetPermissionArgs

NewSetPermissionArgs initializes SetPermissionArgs with the required arguments.

func (*SetPermissionArgs) SetBrowserContextID added in v0.25.0

func (a *SetPermissionArgs) SetBrowserContextID(browserContextID ContextID) *SetPermissionArgs

SetBrowserContextID sets the BrowserContextID optional argument. Context to override. When omitted, default browser context is used.

func (*SetPermissionArgs) SetOrigin added in v0.26.0

func (a *SetPermissionArgs) SetOrigin(origin string) *SetPermissionArgs

SetOrigin sets the Origin optional argument. Origin the permission applies to, all origins if not specified.

type SetWindowBoundsArgs

type SetWindowBoundsArgs struct {
	WindowID WindowID `json:"windowId"` // Browser window id.
	Bounds   Bounds   `json:"bounds"`   // New window bounds. The 'minimized', 'maximized' and 'fullscreen' states cannot be combined with 'left', 'top', 'width' or 'height'. Leaves unspecified fields unchanged.
}

SetWindowBoundsArgs represents the arguments for SetWindowBounds in the Browser domain.

func NewSetWindowBoundsArgs

func NewSetWindowBoundsArgs(windowID WindowID, bounds Bounds) *SetWindowBoundsArgs

NewSetWindowBoundsArgs initializes SetWindowBoundsArgs with the required arguments.

type WindowID

type WindowID int

WindowID

Note: This type is experimental.

type WindowState

type WindowState string

WindowState The state of the browser window.

Note: This type is experimental.

const (
	WindowStateNotSet     WindowState = ""
	WindowStateNormal     WindowState = "normal"
	WindowStateMinimized  WindowState = "minimized"
	WindowStateMaximized  WindowState = "maximized"
	WindowStateFullscreen WindowState = "fullscreen"
)

WindowState as enums.

func (WindowState) String

func (e WindowState) String() string

func (WindowState) Valid

func (e WindowState) Valid() bool

Jump to

Keyboard shortcuts

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