-
Notifications
You must be signed in to change notification settings - Fork 28
/
chromium_options.go
222 lines (185 loc) · 7.42 KB
/
chromium_options.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
//----------------------------------------
//
// Copyright © yanghy. All Rights Reserved.
//
// Licensed under Apache License Version 2.0, January 2004
//
// https://www.apache.org/licenses/LICENSE-2.0
//
//----------------------------------------
package cef
import (
"github.com/energye/energy/v2/cef/internal/def"
"github.com/energye/energy/v2/common/imports"
"github.com/energye/energy/v2/consts"
"github.com/energye/energy/v2/types"
)
type IChromiumOptions interface {
Javascript() consts.TCefState
JavascriptCloseWindows() consts.TCefState
JavascriptAccessClipboard() consts.TCefState
JavascriptDomPaste() consts.TCefState
ImageLoading() consts.TCefState
ImageShrinkStandaloneToFit() consts.TCefState
TextAreaResize() consts.TCefState
TabToLinks() consts.TCefState
LocalStorage() consts.TCefState
Databases() consts.TCefState
Webgl() consts.TCefState
BackgroundColor() types.TCefColor
AcceptLanguageList() types.String // Remove CEF 118
WindowlessFrameRate() types.Integer
ChromeStatusBubble() consts.TCefState
SetJavascript(value consts.TCefState)
SetJavascriptCloseWindows(value consts.TCefState)
SetJavascriptAccessClipboard(value consts.TCefState)
SetJavascriptDomPaste(value consts.TCefState)
SetImageLoading(value consts.TCefState)
SetImageShrinkStandaloneToFit(value consts.TCefState)
SetTextAreaResize(value consts.TCefState)
SetTabToLinks(value consts.TCefState)
SetLocalStorage(value consts.TCefState)
SetDatabases(value consts.TCefState)
SetWebgl(value consts.TCefState)
SetBackgroundColor(value types.TCefColor)
SetAcceptLanguageList(value types.String) // Remove CEF 118
SetWindowlessFrameRate(value types.Integer)
SetChromeStatusBubble(value consts.TCefState)
ChromeZoomBubble() consts.TCefState
SetChromeZoomBubble(value consts.TCefState)
}
func NewChromiumOptions(chromium IChromium) IChromiumOptions {
return &TChromiumOptions{
javascript: consts.STATE_DEFAULT,
javascriptCloseWindows: consts.STATE_DEFAULT,
javascriptAccessClipboard: consts.STATE_DEFAULT,
javascriptDomPaste: consts.STATE_DEFAULT,
imageLoading: consts.STATE_DEFAULT,
imageShrinkStandaloneToFit: consts.STATE_DEFAULT,
textAreaResize: consts.STATE_DEFAULT,
tabToLinks: consts.STATE_DEFAULT,
localStorage: consts.STATE_DEFAULT,
databases: consts.STATE_DEFAULT,
webgl: consts.STATE_DEFAULT,
backgroundColor: 0,
acceptLanguageList: "", // Remove CEF 118
windowlessFrameRate: consts.CEF_OSR_FRAMERATE_DEFAULT,
chromeStatusBubble: consts.STATE_DEFAULT,
Chromium: chromium,
}
}
func (m *TChromiumOptions) Javascript() consts.TCefState {
return m.javascript
}
func (m *TChromiumOptions) JavascriptCloseWindows() consts.TCefState {
return m.javascriptCloseWindows
}
func (m *TChromiumOptions) JavascriptAccessClipboard() consts.TCefState {
return m.javascriptAccessClipboard
}
func (m *TChromiumOptions) JavascriptDomPaste() consts.TCefState {
return m.javascriptDomPaste
}
func (m *TChromiumOptions) ImageLoading() consts.TCefState {
return m.imageLoading
}
func (m *TChromiumOptions) ImageShrinkStandaloneToFit() consts.TCefState {
return m.imageShrinkStandaloneToFit
}
func (m *TChromiumOptions) TextAreaResize() consts.TCefState {
return m.textAreaResize
}
func (m *TChromiumOptions) TabToLinks() consts.TCefState {
return m.tabToLinks
}
func (m *TChromiumOptions) LocalStorage() consts.TCefState {
return m.localStorage
}
func (m *TChromiumOptions) Databases() consts.TCefState {
return m.databases
}
func (m *TChromiumOptions) Webgl() consts.TCefState {
return m.webgl
}
func (m *TChromiumOptions) BackgroundColor() types.TCefColor {
return m.backgroundColor
}
// AcceptLanguageList Remove CEF 118
func (m *TChromiumOptions) AcceptLanguageList() types.String {
return m.acceptLanguageList
}
func (m *TChromiumOptions) WindowlessFrameRate() types.Integer {
return m.windowlessFrameRate
}
func (m *TChromiumOptions) ChromeStatusBubble() consts.TCefState {
return m.chromeStatusBubble
}
// setting
func (m *TChromiumOptions) SetJavascript(value consts.TCefState) {
m.javascript = value
imports.Proc(def.ChromiumOptions_SetJavascript).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetJavascriptCloseWindows(value consts.TCefState) {
m.javascriptCloseWindows = value
imports.Proc(def.ChromiumOptions_SetJavascriptCloseWindows).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetJavascriptAccessClipboard(value consts.TCefState) {
m.javascriptAccessClipboard = value
imports.Proc(def.ChromiumOptions_SetJavascriptAccessClipboard).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetJavascriptDomPaste(value consts.TCefState) {
m.javascriptDomPaste = value
imports.Proc(def.ChromiumOptions_SetJavascriptDomPaste).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetImageLoading(value consts.TCefState) {
m.imageLoading = value
imports.Proc(def.ChromiumOptions_SetImageLoading).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetImageShrinkStandaloneToFit(value consts.TCefState) {
m.imageShrinkStandaloneToFit = value
imports.Proc(def.ChromiumOptions_SetImageShrinkStandaloneToFit).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetTextAreaResize(value consts.TCefState) {
m.textAreaResize = value
imports.Proc(def.ChromiumOptions_SetTextAreaResize).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetTabToLinks(value consts.TCefState) {
m.tabToLinks = value
imports.Proc(def.ChromiumOptions_SetTabToLinks).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetLocalStorage(value consts.TCefState) {
m.localStorage = value
imports.Proc(def.ChromiumOptions_SetLocalStorage).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetDatabases(value consts.TCefState) {
m.databases = value
imports.Proc(def.ChromiumOptions_SetDatabases).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetWebgl(value consts.TCefState) {
m.webgl = value
imports.Proc(def.ChromiumOptions_SetWebgl).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetBackgroundColor(value types.TCefColor) {
m.backgroundColor = value
imports.Proc(def.ChromiumOptions_SetBackgroundColor).Call(m.Chromium.Instance(), value.ToPtr())
}
// SetAcceptLanguageList Remove CEF 118
func (m *TChromiumOptions) SetAcceptLanguageList(value types.String) {
m.acceptLanguageList = value
imports.Proc(def.ChromiumOptions_SetAcceptLanguageList).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetWindowlessFrameRate(value types.Integer) {
m.windowlessFrameRate = value
imports.Proc(def.ChromiumOptions_SetWindowlessFrameRate).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) SetChromeStatusBubble(value consts.TCefState) {
m.chromeStatusBubble = value
imports.Proc(def.ChromiumOptions_SetChromeStatusBubble).Call(m.Chromium.Instance(), value.ToPtr())
}
func (m *TChromiumOptions) ChromeZoomBubble() consts.TCefState {
r1, _, _ := imports.Proc(def.ChromiumOptions_ChromeZoomBubble).Call(consts.GetValue, m.Chromium.Instance(), 0)
return consts.TCefState(r1)
}
func (m *TChromiumOptions) SetChromeZoomBubble(value consts.TCefState) {
imports.Proc(def.ChromiumOptions_ChromeZoomBubble).Call(consts.SetValue, m.Chromium.Instance(), uintptr(value))
}