forked from chromedp/chromedp
/
types.go
76 lines (62 loc) · 2.12 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package browser
import (
"errors"
"github.com/mailru/easyjson"
"github.com/mailru/easyjson/jlexer"
"github.com/mailru/easyjson/jwriter"
)
// AUTOGENERATED. DO NOT EDIT.
// WindowID [no description].
type WindowID int64
// Int64 returns the WindowID as int64 value.
func (t WindowID) Int64() int64 {
return int64(t)
}
// WindowState the state of the browser window.
type WindowState string
// String returns the WindowState as string value.
func (t WindowState) String() string {
return string(t)
}
// WindowState values.
const (
WindowStateNormal WindowState = "normal"
WindowStateMinimized WindowState = "minimized"
WindowStateMaximized WindowState = "maximized"
WindowStateFullscreen WindowState = "fullscreen"
)
// MarshalEasyJSON satisfies easyjson.Marshaler.
func (t WindowState) MarshalEasyJSON(out *jwriter.Writer) {
out.String(string(t))
}
// MarshalJSON satisfies json.Marshaler.
func (t WindowState) MarshalJSON() ([]byte, error) {
return easyjson.Marshal(t)
}
// UnmarshalEasyJSON satisfies easyjson.Unmarshaler.
func (t *WindowState) UnmarshalEasyJSON(in *jlexer.Lexer) {
switch WindowState(in.String()) {
case WindowStateNormal:
*t = WindowStateNormal
case WindowStateMinimized:
*t = WindowStateMinimized
case WindowStateMaximized:
*t = WindowStateMaximized
case WindowStateFullscreen:
*t = WindowStateFullscreen
default:
in.AddError(errors.New("unknown WindowState value"))
}
}
// UnmarshalJSON satisfies json.Unmarshaler.
func (t *WindowState) UnmarshalJSON(buf []byte) error {
return easyjson.Unmarshal(buf, t)
}
// Bounds browser window bounds information.
type Bounds struct {
Left int64 `json:"left,omitempty"` // The offset from the left edge of the screen to the window in pixels.
Top int64 `json:"top,omitempty"` // The offset from the top edge of the screen to the window in pixels.
Width int64 `json:"width,omitempty"` // The window width in pixels.
Height int64 `json:"height,omitempty"` // The window height in pixels.
WindowState WindowState `json:"windowState,omitempty"` // The window state. Default to normal.
}