chromedp/cdp/security/security.go
2017-01-24 22:09:23 +07:00

155 lines
2.7 KiB
Go

// Package security provides the Chrome Debugging Protocol
// commands, types, and events for the Chrome Security domain.
//
// Security.
//
// Generated by the chromedp-gen command.
package security
// AUTOGENERATED. DO NOT EDIT.
import (
"context"
. "github.com/knq/chromedp/cdp"
"github.com/mailru/easyjson"
)
var (
_ BackendNode
_ BackendNodeID
_ ComputedProperty
_ ErrorType
_ Frame
_ FrameID
_ LoaderID
_ Message
_ MessageError
_ MethodType
_ Node
_ NodeID
_ NodeType
_ PseudoType
_ RGBA
_ ShadowRootType
_ Timestamp
)
// EnableParams enables tracking security state changes.
type EnableParams struct{}
// Enable enables tracking security state changes.
func Enable() *EnableParams {
return &EnableParams{}
}
// Do executes Security.enable.
func (p *EnableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// execute
ch := h.Execute(ctxt, CommandSecurityEnable, Empty)
// read response
select {
case res := <-ch:
if res == nil {
return ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return ErrContextDone
}
return ErrUnknownResult
}
// DisableParams disables tracking security state changes.
type DisableParams struct{}
// Disable disables tracking security state changes.
func Disable() *DisableParams {
return &DisableParams{}
}
// Do executes Security.disable.
func (p *DisableParams) Do(ctxt context.Context, h FrameHandler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// execute
ch := h.Execute(ctxt, CommandSecurityDisable, Empty)
// read response
select {
case res := <-ch:
if res == nil {
return ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return ErrContextDone
}
return ErrUnknownResult
}
// ShowCertificateViewerParams displays native dialog with the certificate
// details.
type ShowCertificateViewerParams struct{}
// ShowCertificateViewer displays native dialog with the certificate details.
func ShowCertificateViewer() *ShowCertificateViewerParams {
return &ShowCertificateViewerParams{}
}
// Do executes Security.showCertificateViewer.
func (p *ShowCertificateViewerParams) Do(ctxt context.Context, h FrameHandler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// execute
ch := h.Execute(ctxt, CommandSecurityShowCertificateViewer, Empty)
// read response
select {
case res := <-ch:
if res == nil {
return ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return ErrContextDone
}
return ErrUnknownResult
}