Updating latest protocol.json and adding some minor comment updates

This commit is contained in:
Kenneth Shaw 2017-02-07 20:07:16 +07:00
parent 4145d8367d
commit 80235c270b
7 changed files with 228 additions and 60 deletions

View File

@ -121,6 +121,7 @@ const (
CommandEmulationSetCPUThrottlingRate MethodType = "Emulation.setCPUThrottlingRate" CommandEmulationSetCPUThrottlingRate MethodType = "Emulation.setCPUThrottlingRate"
CommandEmulationCanEmulate MethodType = "Emulation.canEmulate" CommandEmulationCanEmulate MethodType = "Emulation.canEmulate"
CommandEmulationSetVirtualTimePolicy MethodType = "Emulation.setVirtualTimePolicy" CommandEmulationSetVirtualTimePolicy MethodType = "Emulation.setVirtualTimePolicy"
CommandEmulationSetDefaultBackgroundColorOverride MethodType = "Emulation.setDefaultBackgroundColorOverride"
EventSecuritySecurityStateChanged MethodType = "Security.securityStateChanged" EventSecuritySecurityStateChanged MethodType = "Security.securityStateChanged"
CommandSecurityEnable MethodType = "Security.enable" CommandSecurityEnable MethodType = "Security.enable"
CommandSecurityDisable MethodType = "Security.disable" CommandSecurityDisable MethodType = "Security.disable"
@ -609,6 +610,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) {
*t = CommandEmulationCanEmulate *t = CommandEmulationCanEmulate
case CommandEmulationSetVirtualTimePolicy: case CommandEmulationSetVirtualTimePolicy:
*t = CommandEmulationSetVirtualTimePolicy *t = CommandEmulationSetVirtualTimePolicy
case CommandEmulationSetDefaultBackgroundColorOverride:
*t = CommandEmulationSetDefaultBackgroundColorOverride
case EventSecuritySecurityStateChanged: case EventSecuritySecurityStateChanged:
*t = EventSecuritySecurityStateChanged *t = EventSecuritySecurityStateChanged
case CommandSecurityEnable: case CommandSecurityEnable:

View File

@ -4,6 +4,7 @@ package emulation
import ( import (
json "encoding/json" json "encoding/json"
cdp "github.com/knq/chromedp/cdp"
easyjson "github.com/mailru/easyjson" easyjson "github.com/mailru/easyjson"
jlexer "github.com/mailru/easyjson/jlexer" jlexer "github.com/mailru/easyjson/jlexer"
jwriter "github.com/mailru/easyjson/jwriter" jwriter "github.com/mailru/easyjson/jwriter"
@ -707,7 +708,88 @@ func (v *SetDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error {
func (v *SetDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *SetDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation7(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, out *SetCPUThrottlingRateParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, out *SetDefaultBackgroundColorOverrideParams) {
isTopLevel := in.IsStart()
if in.IsNull() {
if isTopLevel {
in.Consumed()
}
in.Skip()
return
}
in.Delim('{')
for !in.IsDelim('}') {
key := in.UnsafeString()
in.WantColon()
if in.IsNull() {
in.Skip()
in.WantComma()
continue
}
switch key {
case "color":
if in.IsNull() {
in.Skip()
out.Color = nil
} else {
if out.Color == nil {
out.Color = new(cdp.RGBA)
}
(*out.Color).UnmarshalEasyJSON(in)
}
default:
in.SkipRecursive()
}
in.WantComma()
}
in.Delim('}')
if isTopLevel {
in.Consumed()
}
}
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer, in SetDefaultBackgroundColorOverrideParams) {
out.RawByte('{')
first := true
_ = first
if in.Color != nil {
if !first {
out.RawByte(',')
}
first = false
out.RawString("\"color\":")
if in.Color == nil {
out.RawString("null")
} else {
(*in.Color).MarshalEasyJSON(out)
}
}
out.RawByte('}')
}
// MarshalJSON supports json.Marshaler interface
func (v SetDefaultBackgroundColorOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(&w, v)
return w.Buffer.BuildBytes(), w.Error
}
// MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetDefaultBackgroundColorOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(w, v)
}
// UnmarshalJSON supports json.Unmarshaler interface
func (v *SetDefaultBackgroundColorOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(&r, v)
return r.Error()
}
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetDefaultBackgroundColorOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(l, v)
}
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, out *SetCPUThrottlingRateParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -738,7 +820,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, o
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer, in SetCPUThrottlingRateParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in SetCPUThrottlingRateParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -754,27 +836,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v SetCPUThrottlingRateParams) MarshalJSON() ([]byte, error) { func (v SetCPUThrottlingRateParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v SetCPUThrottlingRateParams) MarshalEasyJSON(w *jwriter.Writer) { func (v SetCPUThrottlingRateParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *SetCPUThrottlingRateParams) UnmarshalJSON(data []byte) error { func (v *SetCPUThrottlingRateParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *SetCPUThrottlingRateParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *SetCPUThrottlingRateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, out *ScreenOrientation) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer, out *ScreenOrientation) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -807,7 +889,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, o
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in ScreenOrientation) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ScreenOrientation) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -833,27 +915,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ScreenOrientation) MarshalJSON() ([]byte, error) { func (v ScreenOrientation) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ScreenOrientation) MarshalEasyJSON(w *jwriter.Writer) { func (v ScreenOrientation) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ScreenOrientation) UnmarshalJSON(data []byte) error { func (v *ScreenOrientation) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ScreenOrientation) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ScreenOrientation) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer, out *ResetViewportParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer, out *ResetViewportParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -882,7 +964,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ResetViewportParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in ResetViewportParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -892,27 +974,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ResetViewportParams) MarshalJSON() ([]byte, error) { func (v ResetViewportParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResetViewportParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ResetViewportParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ResetViewportParams) UnmarshalJSON(data []byte) error { func (v *ResetViewportParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResetViewportParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ResetViewportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer, out *ResetPageScaleFactorParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *ResetPageScaleFactorParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -941,7 +1023,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in ResetPageScaleFactorParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in ResetPageScaleFactorParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -951,27 +1033,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ResetPageScaleFactorParams) MarshalJSON() ([]byte, error) { func (v ResetPageScaleFactorParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ResetPageScaleFactorParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ResetPageScaleFactorParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ResetPageScaleFactorParams) UnmarshalJSON(data []byte) error { func (v *ResetPageScaleFactorParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ResetPageScaleFactorParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ResetPageScaleFactorParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, out *ForceViewportParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *ForceViewportParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1006,7 +1088,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in ForceViewportParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in ForceViewportParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1034,27 +1116,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ForceViewportParams) MarshalJSON() ([]byte, error) { func (v ForceViewportParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ForceViewportParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ForceViewportParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ForceViewportParams) UnmarshalJSON(data []byte) error { func (v *ForceViewportParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ForceViewportParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ForceViewportParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *EventVirtualTimeBudgetExpired) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1083,7 +1165,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1093,27 +1175,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalJSON() ([]byte, error) { func (v EventVirtualTimeBudgetExpired) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v EventVirtualTimeBudgetExpired) MarshalEasyJSON(w *jwriter.Writer) { func (v EventVirtualTimeBudgetExpired) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalJSON(data []byte) error { func (v *EventVirtualTimeBudgetExpired) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *EventVirtualTimeBudgetExpired) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *EventVirtualTimeBudgetExpired) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *ClearGeolocationOverrideParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1142,7 +1224,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in ClearGeolocationOverrideParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in ClearGeolocationOverrideParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1152,27 +1234,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) { func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error { func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ClearGeolocationOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, out *ClearDeviceMetricsOverrideParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1201,7 +1283,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1211,27 +1293,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) { func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error { func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *ClearDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, out *CanEmulateReturns) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(in *jlexer.Lexer, out *CanEmulateReturns) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1262,7 +1344,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in CanEmulateReturns) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Writer, in CanEmulateReturns) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1280,27 +1362,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v CanEmulateReturns) MarshalJSON() ([]byte, error) { func (v CanEmulateReturns) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) { func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error { func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CanEmulateReturns) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(l, v)
} }
func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(in *jlexer.Lexer, out *CanEmulateParams) { func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation18(in *jlexer.Lexer, out *CanEmulateParams) {
isTopLevel := in.IsStart() isTopLevel := in.IsStart()
if in.IsNull() { if in.IsNull() {
if isTopLevel { if isTopLevel {
@ -1329,7 +1411,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(in *jlexer.Lexer,
in.Consumed() in.Consumed()
} }
} }
func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Writer, in CanEmulateParams) { func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(out *jwriter.Writer, in CanEmulateParams) {
out.RawByte('{') out.RawByte('{')
first := true first := true
_ = first _ = first
@ -1339,23 +1421,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Write
// MarshalJSON supports json.Marshaler interface // MarshalJSON supports json.Marshaler interface
func (v CanEmulateParams) MarshalJSON() ([]byte, error) { func (v CanEmulateParams) MarshalJSON() ([]byte, error) {
w := jwriter.Writer{} w := jwriter.Writer{}
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(&w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(&w, v)
return w.Buffer.BuildBytes(), w.Error return w.Buffer.BuildBytes(), w.Error
} }
// MarshalEasyJSON supports easyjson.Marshaler interface // MarshalEasyJSON supports easyjson.Marshaler interface
func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) { func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) {
easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(w, v) easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(w, v)
} }
// UnmarshalJSON supports json.Unmarshaler interface // UnmarshalJSON supports json.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalJSON(data []byte) error { func (v *CanEmulateParams) UnmarshalJSON(data []byte) error {
r := jlexer.Lexer{Data: data} r := jlexer.Lexer{Data: data}
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(&r, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation18(&r, v)
return r.Error() return r.Error()
} }
// UnmarshalEasyJSON supports easyjson.Unmarshaler interface // UnmarshalEasyJSON supports easyjson.Unmarshaler interface
func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) { func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) {
easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(l, v) easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation18(l, v)
} }

View File

@ -874,3 +874,63 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.FrameHandler
return cdp.ErrUnknownResult return cdp.ErrUnknownResult
} }
// SetDefaultBackgroundColorOverrideParams sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
type SetDefaultBackgroundColorOverrideParams struct {
Color *cdp.RGBA `json:"color,omitempty"` // RGBA of the default background color. If not specified, any existing override will be cleared.
}
// SetDefaultBackgroundColorOverride sets or clears an override of the
// default background color of the frame. This override is used if the content
// does not specify one.
//
// parameters:
func SetDefaultBackgroundColorOverride() *SetDefaultBackgroundColorOverrideParams {
return &SetDefaultBackgroundColorOverrideParams{}
}
// WithColor rGBA of the default background color. If not specified, any
// existing override will be cleared.
func (p SetDefaultBackgroundColorOverrideParams) WithColor(color *cdp.RGBA) *SetDefaultBackgroundColorOverrideParams {
p.Color = color
return &p
}
// Do executes Emulation.setDefaultBackgroundColorOverride.
func (p *SetDefaultBackgroundColorOverrideParams) Do(ctxt context.Context, h cdp.FrameHandler) (err error) {
if ctxt == nil {
ctxt = context.Background()
}
// marshal
buf, err := easyjson.Marshal(p)
if err != nil {
return err
}
// execute
ch := h.Execute(ctxt, cdp.CommandEmulationSetDefaultBackgroundColorOverride, easyjson.RawMessage(buf))
// read response
select {
case res := <-ch:
if res == nil {
return cdp.ErrChannelClosed
}
switch v := res.(type) {
case easyjson.RawMessage:
return nil
case error:
return v
}
case <-ctxt.Done():
return cdp.ErrContextDone
}
return cdp.ErrUnknownResult
}

View File

@ -259,6 +259,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) {
case cdp.CommandEmulationSetVirtualTimePolicy: case cdp.CommandEmulationSetVirtualTimePolicy:
return emptyVal, nil return emptyVal, nil
case cdp.CommandEmulationSetDefaultBackgroundColorOverride:
return emptyVal, nil
case cdp.EventEmulationVirtualTimeBudgetExpired: case cdp.EventEmulationVirtualTimeBudgetExpired:
v = new(emulation.EventVirtualTimeBudgetExpired) v = new(emulation.EventVirtualTimeBudgetExpired)

View File

@ -1,3 +1,5 @@
// Package client provides the low level Chrome Debugging Protocol JSON types
// and related funcs.
package client package client
import ( import (

View File

@ -1371,6 +1371,9 @@
{ {
"domain": "Emulation", "domain": "Emulation",
"description": "This domain emulates different environments for the page.", "description": "This domain emulates different environments for the page.",
"dependencies": [
"DOM"
],
"types": [ "types": [
{ {
"id": "ScreenOrientation", "id": "ScreenOrientation",
@ -1675,6 +1678,19 @@
} }
], ],
"experimental": true "experimental": true
},
{
"name": "setDefaultBackgroundColorOverride",
"description": "Sets or clears an override of the default background color of the frame. This override is used if the content does not specify one.",
"parameters": [
{
"name": "color",
"$ref": "DOM.RGBA",
"optional": true,
"description": "RGBA of the default background color. If not specified, any existing override will be cleared."
}
],
"experimental": true
} }
], ],
"events": [ "events": [

View File

@ -1,3 +1,5 @@
// Package kb provides keyboard mappings for Chrome DOM Keys for use with input
// events.
package kb package kb
//go:generate go run gen.go -out keys.go -pkg kb //go:generate go run gen.go -out keys.go -pkg kb