diff --git a/cdp/cdp.go b/cdp/cdp.go index 72be204..534988f 100644 --- a/cdp/cdp.go +++ b/cdp/cdp.go @@ -121,6 +121,7 @@ const ( CommandEmulationSetCPUThrottlingRate MethodType = "Emulation.setCPUThrottlingRate" CommandEmulationCanEmulate MethodType = "Emulation.canEmulate" CommandEmulationSetVirtualTimePolicy MethodType = "Emulation.setVirtualTimePolicy" + CommandEmulationSetDefaultBackgroundColorOverride MethodType = "Emulation.setDefaultBackgroundColorOverride" EventSecuritySecurityStateChanged MethodType = "Security.securityStateChanged" CommandSecurityEnable MethodType = "Security.enable" CommandSecurityDisable MethodType = "Security.disable" @@ -609,6 +610,8 @@ func (t *MethodType) UnmarshalEasyJSON(in *jlexer.Lexer) { *t = CommandEmulationCanEmulate case CommandEmulationSetVirtualTimePolicy: *t = CommandEmulationSetVirtualTimePolicy + case CommandEmulationSetDefaultBackgroundColorOverride: + *t = CommandEmulationSetDefaultBackgroundColorOverride case EventSecuritySecurityStateChanged: *t = EventSecuritySecurityStateChanged case CommandSecurityEnable: diff --git a/cdp/emulation/easyjson.go b/cdp/emulation/easyjson.go index 057bf6a..38ba90c 100644 --- a/cdp/emulation/easyjson.go +++ b/cdp/emulation/easyjson.go @@ -4,6 +4,7 @@ package emulation import ( json "encoding/json" + cdp "github.com/knq/chromedp/cdp" easyjson "github.com/mailru/easyjson" jlexer "github.com/mailru/easyjson/jlexer" jwriter "github.com/mailru/easyjson/jwriter" @@ -707,7 +708,88 @@ func (v *SetDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error { func (v *SetDeviceMetricsOverrideParams) UnmarshalEasyJSON(l *jlexer.Lexer) { 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() if in.IsNull() { if isTopLevel { @@ -738,7 +820,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(in *jlexer.Lexer, o in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer, in SetCPUThrottlingRateParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in SetCPUThrottlingRateParams) { out.RawByte('{') first := true _ = first @@ -754,27 +836,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(out *jwriter.Writer // MarshalJSON supports json.Marshaler interface func (v SetCPUThrottlingRateParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v SetCPUThrottlingRateParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation8(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *SetCPUThrottlingRateParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation8(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -807,7 +889,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(in *jlexer.Lexer, o in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer, in ScreenOrientation) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ScreenOrientation) { out.RawByte('{') first := true _ = first @@ -833,27 +915,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(out *jwriter.Writer // MarshalJSON supports json.Marshaler interface func (v ScreenOrientation) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ScreenOrientation) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation9(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ScreenOrientation) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation9(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -882,7 +964,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Writer, in ResetViewportParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in ResetViewportParams) { out.RawByte('{') first := true _ = first @@ -892,27 +974,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v ResetViewportParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ResetViewportParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation10(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ResetViewportParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation10(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -941,7 +1023,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Writer, in ResetPageScaleFactorParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in ResetPageScaleFactorParams) { out.RawByte('{') first := true _ = first @@ -951,27 +1033,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v ResetPageScaleFactorParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ResetPageScaleFactorParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation11(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ResetPageScaleFactorParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation11(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1006,7 +1088,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Writer, in ForceViewportParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in ForceViewportParams) { out.RawByte('{') first := true _ = first @@ -1034,27 +1116,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v ForceViewportParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ForceViewportParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation12(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ForceViewportParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation12(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1083,7 +1165,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in EventVirtualTimeBudgetExpired) { out.RawByte('{') first := true _ = first @@ -1093,27 +1175,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v EventVirtualTimeBudgetExpired) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v EventVirtualTimeBudgetExpired) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation13(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *EventVirtualTimeBudgetExpired) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation13(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1142,7 +1224,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Writer, in ClearGeolocationOverrideParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in ClearGeolocationOverrideParams) { out.RawByte('{') first := true _ = first @@ -1152,27 +1234,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v ClearGeolocationOverrideParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ClearGeolocationOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation14(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ClearGeolocationOverrideParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation14(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1201,7 +1283,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in ClearDeviceMetricsOverrideParams) { out.RawByte('{') first := true _ = first @@ -1211,27 +1293,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v ClearDeviceMetricsOverrideParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v ClearDeviceMetricsOverrideParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation15(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *ClearDeviceMetricsOverrideParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation15(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1262,7 +1344,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Writer, in CanEmulateReturns) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Writer, in CanEmulateReturns) { out.RawByte('{') first := true _ = first @@ -1280,27 +1362,27 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v CanEmulateReturns) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CanEmulateReturns) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation16(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CanEmulateReturns) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation16(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface 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() if in.IsNull() { if isTopLevel { @@ -1329,7 +1411,7 @@ func easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(in *jlexer.Lexer, in.Consumed() } } -func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Writer, in CanEmulateParams) { +func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(out *jwriter.Writer, in CanEmulateParams) { out.RawByte('{') first := true _ = first @@ -1339,23 +1421,23 @@ func easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(out *jwriter.Write // MarshalJSON supports json.Marshaler interface func (v CanEmulateParams) MarshalJSON() ([]byte, error) { w := jwriter.Writer{} - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(&w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(&w, v) return w.Buffer.BuildBytes(), w.Error } // MarshalEasyJSON supports easyjson.Marshaler interface func (v CanEmulateParams) MarshalEasyJSON(w *jwriter.Writer) { - easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation17(w, v) + easyjsonC5a4559bEncodeGithubComKnqChromedpCdpEmulation18(w, v) } // UnmarshalJSON supports json.Unmarshaler interface func (v *CanEmulateParams) UnmarshalJSON(data []byte) error { r := jlexer.Lexer{Data: data} - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(&r, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation18(&r, v) return r.Error() } // UnmarshalEasyJSON supports easyjson.Unmarshaler interface func (v *CanEmulateParams) UnmarshalEasyJSON(l *jlexer.Lexer) { - easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation17(l, v) + easyjsonC5a4559bDecodeGithubComKnqChromedpCdpEmulation18(l, v) } diff --git a/cdp/emulation/emulation.go b/cdp/emulation/emulation.go index a0a9fb8..f0672db 100644 --- a/cdp/emulation/emulation.go +++ b/cdp/emulation/emulation.go @@ -874,3 +874,63 @@ func (p *SetVirtualTimePolicyParams) Do(ctxt context.Context, h cdp.FrameHandler 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 +} diff --git a/cdp/util/util.go b/cdp/util/util.go index 38be0da..790b9ea 100644 --- a/cdp/util/util.go +++ b/cdp/util/util.go @@ -259,6 +259,9 @@ func UnmarshalMessage(msg *cdp.Message) (interface{}, error) { case cdp.CommandEmulationSetVirtualTimePolicy: return emptyVal, nil + case cdp.CommandEmulationSetDefaultBackgroundColorOverride: + return emptyVal, nil + case cdp.EventEmulationVirtualTimeBudgetExpired: v = new(emulation.EventVirtualTimeBudgetExpired) diff --git a/client/client.go b/client/client.go index d091c39..5a3239a 100644 --- a/client/client.go +++ b/client/client.go @@ -1,3 +1,5 @@ +// Package client provides the low level Chrome Debugging Protocol JSON types +// and related funcs. package client import ( diff --git a/cmd/chromedp-gen/protocol.json b/cmd/chromedp-gen/protocol.json index 2d91ced..8b54d6e 100644 --- a/cmd/chromedp-gen/protocol.json +++ b/cmd/chromedp-gen/protocol.json @@ -1371,6 +1371,9 @@ { "domain": "Emulation", "description": "This domain emulates different environments for the page.", + "dependencies": [ + "DOM" + ], "types": [ { "id": "ScreenOrientation", @@ -1675,6 +1678,19 @@ } ], "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": [ diff --git a/kb/kb.go b/kb/kb.go index f372b32..3709879 100644 --- a/kb/kb.go +++ b/kb/kb.go @@ -1,3 +1,5 @@ +// Package kb provides keyboard mappings for Chrome DOM Keys for use with input +// events. package kb //go:generate go run gen.go -out keys.go -pkg kb