Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
energye
energy
提交
8fb0dd41
energy
项目概览
energye
/
energy
通知
13
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
energy
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
8fb0dd41
编写于
12月 13, 2022
作者:
yanghye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Optimize code usage
上级
ecbecfa4
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
529 addition
and
184 deletion
+529
-184
cef/cef-application.go
cef/cef-application.go
+1
-1
cef/cef-browser-view-component.go
cef/cef-browser-view-component.go
+90
-1
cef/cef-chromium-proc.go
cef/cef-chromium-proc.go
+2
-2
cef/cef-events-callback.go
cef/cef-events-callback.go
+1
-1
cef/cef-events.go
cef/cef-events.go
+3
-3
cef/cef-proc-def.go
cef/cef-proc-def.go
+2
-0
cef/cef-types-ptr.go
cef/cef-types-ptr.go
+88
-0
cef/cef-types.go
cef/cef-types.go
+110
-48
cef/cef-window-component.go
cef/cef-window-component.go
+1
-1
consts/consts.go
consts/consts.go
+231
-127
未找到文件。
cef/cef-application.go
浏览文件 @
8fb0dd41
...
...
@@ -246,7 +246,7 @@ func init() {
}
else
{
processName
=
Args
.
ProcessType
()
}
v8ctx
:=
(
*
cefV8Context
)(
getPtr
(
2
))
v8ctx
:=
(
*
iCefV8ContextPtr
)(
getPtr
(
2
))
ctx
:=
&
ICefV8Context
{
Browser
:
browser
,
Frame
:
frame
,
...
...
cef/cef-browser-view-component.go
浏览文件 @
8fb0dd41
package
cef
import
(
.
"github.com/energye/energy/common"
"github.com/energye/energy/logger"
"github.com/energye/golcl/lcl"
"github.com/energye/golcl/lcl/api"
"unsafe"
)
...
...
@@ -9,6 +12,92 @@ type TCEFBrowserViewComponent struct {
instance
unsafe
.
Pointer
}
func
NewBrowserViewComponent
(
AOwner
lcl
.
TComponent
)
{
func
NewBrowserViewComponent
(
AOwner
lcl
.
TComponent
)
*
TCEFBrowserViewComponent
{
r1
,
_
,
_
:=
Proc
(
internale_CEFBrowserViewComponent_Create
)
.
Call
(
lcl
.
CheckPtr
(
AOwner
))
return
&
TCEFBrowserViewComponent
{
instance
:
unsafe
.
Pointer
(
r1
),
}
}
func
(
m
*
TCEFBrowserViewComponent
)
CreateBrowserView
(
client
*
ICefClient
,
url
string
,
settings
*
TCefBrowserSettings
,
extraInfo
*
ICefDictionaryValue
)
{
settingsPtr
:=
settings
.
ToPtr
()
var
data
=
[]
byte
{}
var
dataPtr
unsafe
.
Pointer
var
dataLen
int
=
0
var
argsLen
int
=
0
if
extraInfo
!=
nil
&&
extraInfo
.
dataLen
>
0
{
defer
func
()
{
extraInfo
.
Clear
()
extraInfo
=
nil
data
=
nil
dataPtr
=
nil
}()
data
=
extraInfo
.
Package
()
argsLen
=
extraInfo
.
dataLen
dataPtr
=
unsafe
.
Pointer
(
&
data
[
0
])
dataLen
=
len
(
data
)
-
1
}
else
{
dataPtr
=
unsafe
.
Pointer
(
&
data
)
}
Proc
(
internale_CEFBrowserViewComponent_CreateBrowserView
)
.
Call
(
uintptr
(
m
.
instance
),
uintptr
(
client
.
instance
),
api
.
PascalStr
(
url
),
uintptr
(
unsafe
.
Pointer
(
&
settingsPtr
)),
uintptr
(
argsLen
),
uintptr
(
dataPtr
),
uintptr
(
dataLen
))
}
func
(
m
*
TCEFBrowserViewComponent
)
GetForBrowser
(
browser
*
ICefBrowser
)
{
Proc
(
internale_CEFBrowserViewComponent_CreateBrowserView
)
.
Call
(
uintptr
(
m
.
instance
),
browser
.
Instance
())
}
func
(
m
*
TCEFBrowserViewComponent
)
SetPreferAccelerators
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
RequestFocus
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
Browser
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
BrowserView
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
SetOnBrowserCreated
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
SetOnBrowserDestroyed
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
SetOnGetDelegateForPopupBrowserView
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
SetOnPopupBrowserViewCreated
()
{
}
func
(
m
*
TCEFBrowserViewComponent
)
SetOnGetChromeToolbarType
()
{
}
func
init
()
{
lcl
.
RegisterExtEventCallback
(
func
(
fn
interface
{},
getVal
func
(
idx
int
)
uintptr
)
bool
{
defer
func
()
{
if
err
:=
recover
();
err
!=
nil
{
logger
.
Error
(
"v8event Error:"
,
err
)
}
}()
//getPtr := func(i int) unsafe.Pointer {
// return unsafe.Pointer(getVal(i))
//}
switch
fn
.
(
type
)
{
default
:
return
false
}
return
true
})
}
cef/cef-chromium-proc.go
浏览文件 @
8fb0dd41
...
...
@@ -269,7 +269,7 @@ func (m *TCEFChromium) SetCookie(url, name, value, domain, path string,
}
func
(
m
*
TCEFChromium
)
SetProxy
(
cefProxy
*
TCefProxy
)
{
proxy
:=
&
tCefProxy
{
proxy
:=
&
tCefProxy
Ptr
{
ProxyType
:
uintptr
(
cefProxy
.
ProxyType
),
ProxyScheme
:
uintptr
(
cefProxy
.
ProxyScheme
),
ProxyServer
:
api
.
PascalStr
(
cefProxy
.
ProxyServer
),
...
...
@@ -525,7 +525,7 @@ func _CEFChromium_SetCookie(instance uintptr, url, name, value, domain, path str
}
// TCEFChromium _CEFChromium_SetProxy
func
_CEFChromium_SetProxy
(
instance
uintptr
,
proxy
*
tCefProxy
)
{
func
_CEFChromium_SetProxy
(
instance
uintptr
,
proxy
*
tCefProxy
Ptr
)
{
Proc
(
internale_CEFChromium_SetProxy
)
.
Call
(
instance
,
uintptr
(
unsafe
.
Pointer
(
proxy
)))
}
...
...
cef/cef-events-callback.go
浏览文件 @
8fb0dd41
...
...
@@ -34,7 +34,7 @@ func chromiumOnBeforePopup(callback ChromiumEventOnBeforePopup, getVal func(idx
Url
:
api
.
GoStr
(
tempFrame
.
Url
),
Id
:
StrToInt64
(
api
.
GoStr
(
tempFrame
.
Identifier
)),
}
beforePInfoPtr
:=
(
*
beforePopupInfo
)(
getPtr
(
3
))
beforePInfoPtr
:=
(
*
beforePopupInfo
Ptr
)(
getPtr
(
3
))
beforePInfo
:=
&
BeforePopupInfo
{
TargetUrl
:
api
.
GoStr
(
beforePInfoPtr
.
TargetUrl
),
TargetFrameName
:
api
.
GoStr
(
beforePInfoPtr
.
TargetFrameName
),
...
...
cef/cef-events.go
浏览文件 @
8fb0dd41
...
...
@@ -86,7 +86,7 @@ func init() {
case
ChromiumEventOnFindResult
:
sender
:=
getPtr
(
0
)
browser
:=
&
ICefBrowser
{
browseId
:
int32
(
getVal
(
1
)),
chromium
:
sender
}
cefRectPtr
:=
(
*
tCefRect
)(
getPtr
(
4
))
cefRectPtr
:=
(
*
tCefRect
Ptr
)(
getPtr
(
4
))
cefRect
:=
&
TCefRect
{
X
:
int32
(
cefRectPtr
.
X
),
Y
:
int32
(
cefRectPtr
.
Y
),
...
...
@@ -124,10 +124,10 @@ func init() {
fn
.
(
ChromiumEventOnResourceLoadComplete
)(
sender
,
browse
,
frame
,
request
,
response
,
*
(
*
TCefUrlRequestStatus
)(
getPtr
(
5
)),
*
(
*
int64
)(
getPtr
(
6
)))
case
ChromiumEventOnResourceRedirect
:
sender
,
browse
,
frame
,
request
,
response
:=
resourceEventGet
(
fn
,
getVal
,
true
)
var
newStr
=
&
String
{}
var
newStr
=
new
(
String
)
var
newStrPtr
=
(
*
uintptr
)(
getPtr
(
5
))
fn
.
(
ChromiumEventOnResourceRedirect
)(
sender
,
browse
,
frame
,
request
,
response
,
newStr
)
*
newStrPtr
=
api
.
PascalStr
(
newStr
.
GetValue
()
)
*
newStrPtr
=
newStr
.
ToPtr
(
)
case
ChromiumEventOnResourceResponse
:
sender
,
browse
,
frame
,
request
,
response
:=
resourceEventGet
(
fn
,
getVal
,
true
)
fn
.
(
ChromiumEventOnResourceResponse
)(
sender
,
browse
,
frame
,
request
,
response
,
(
*
bool
)(
getPtr
(
5
)))
...
...
cef/cef-proc-def.go
浏览文件 @
8fb0dd41
...
...
@@ -399,6 +399,7 @@ func init() {
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_CreateBrowserView"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_GetForBrowser"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_SetPreferAccelerators"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_RequestFocus"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_Browser"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_BrowserView"
,
0
),
dllimports
.
NewEnergyImport
(
"CEFBrowserViewComponent_SetOnBrowserCreated"
,
0
),
...
...
@@ -799,6 +800,7 @@ const (
internale_CEFBrowserViewComponent_CreateBrowserView
internale_CEFBrowserViewComponent_GetForBrowser
internale_CEFBrowserViewComponent_SetPreferAccelerators
internale_CEFBrowserViewComponent_RequestFocus
internale_CEFBrowserViewComponent_Browser
internale_CEFBrowserViewComponent_BrowserView
internale_CEFBrowserViewComponent_SetOnBrowserCreated
...
...
cef/cef-types-ptr.go
0 → 100644
浏览文件 @
8fb0dd41
package
cef
type
iCefV8ContextPtr
struct
{
Browse
uintptr
//ptr
Frame
uintptr
//ptr
Global
uintptr
//ptr
}
type
cefCookie
struct
{
url
,
name
,
value
,
domain
,
path
uintptr
//string
secure
,
httponly
,
hasExpires
uintptr
//bool
creation
,
lastAccess
,
expires
uintptr
//float64
count
,
total
,
aID
uintptr
//int32
sameSite
uintptr
//int32 TCefCookieSameSite
priority
uintptr
//int32 TCefCookiePriority
aSetImmediately
uintptr
//bool
aDeleteCookie
uintptr
//bool
aResult
uintptr
//bool
}
type
tCefRequestContextSettingsPtr
struct
{
Size
uintptr
//uint32
CachePath
uintptr
//TCefString
PersistSessionCookies
uintptr
//int32
PersistUserPreferences
uintptr
//int32
AcceptLanguageList
uintptr
//uint32
CookieableSchemesList
uintptr
//uint32
CookieableSchemesExcludeDefaults
uintptr
//int32
}
type
TCefBrowserSettingsPtr
struct
{
Size
uintptr
//NativeUInt
WindowlessFrameRate
uintptr
//Integer
StandardFontFamily
uintptr
//TCefString
FixedFontFamily
uintptr
//TCefString
SerifFontFamily
uintptr
//TCefString
SansSerifFontFamily
uintptr
//TCefString
CursiveFontFamily
uintptr
//TCefString
FantasyFontFamily
uintptr
//TCefString
DefaultFontSize
uintptr
//Integer
DefaultFixedFontSize
uintptr
//Integer
MinimumFontSize
uintptr
//Integer
MinimumLogicalFontSize
uintptr
//Integer
DefaultEncoding
uintptr
//TCefString
RemoteFonts
uintptr
//TCefState
Javascript
uintptr
//TCefState
JavascriptCloseWindows
uintptr
//TCefState
JavascriptAccessClipboard
uintptr
//TCefState
JavascriptDomPaste
uintptr
//TCefState
ImageLoading
uintptr
//TCefState
ImageShrinkStandaLonetoFit
uintptr
//TCefState
TextAreaResize
uintptr
//TCefState
TabToLinks
uintptr
//TCefState
LocalStorage
uintptr
//TCefState
Databases
uintptr
//TCefState
Webgl
uintptr
//TCefState
BackgroundColor
uintptr
//TCefColor
AcceptLanguageList
uintptr
//TCefString
ChromeStatusBubble
uintptr
//TCefState
}
type
tCefProxyPtr
struct
{
ProxyType
uintptr
//TCefProxyType
ProxyScheme
uintptr
//TCefProxySchem
ProxyServer
uintptr
//string
ProxyPort
uintptr
//int32
ProxyUsername
uintptr
//string
ProxyPassword
uintptr
//string
ProxyScriptURL
uintptr
//string
ProxyByPassList
uintptr
//string
MaxConnectionsPerProxy
uintptr
//int32
CustomHeaderName
uintptr
//string
CustomHeaderValue
uintptr
//string
}
type
beforePopupInfoPtr
struct
{
TargetUrl
uintptr
//string
TargetFrameName
uintptr
//string
TargetDisposition
uintptr
//int32
UserGesture
uintptr
//bool
}
type
tCefRectPtr
struct
{
X
uintptr
//int32
Y
uintptr
//int32
Width
uintptr
//int32
Height
uintptr
//int32
}
cef/cef-types.go
浏览文件 @
8fb0dd41
...
...
@@ -11,24 +11,18 @@ package cef
import
(
"bytes"
.
"github.com/energye/energy/consts"
"github.com/energye/golcl/lcl/api"
"strings"
"time"
"unsafe"
)
type
TCefCloseBrowsesAction
CBS
type
TCefCloseBrowsesAction
=
CBS
type
String
struct
{
value
string
}
type
cefV8Context
struct
{
Browse
uintptr
Frame
uintptr
Global
uintptr
}
//Type ICefCookie
type
ICefCookie
struct
{
Url
,
Name
,
Value
,
Domain
,
Path
string
Secure
,
Httponly
,
HasExpires
bool
...
...
@@ -41,18 +35,6 @@ type ICefCookie struct {
Result
bool
}
type
cefCookie
struct
{
url
,
name
,
value
,
domain
,
path
uintptr
//string
secure
,
httponly
,
hasExpires
uintptr
//bool
creation
,
lastAccess
,
expires
uintptr
//float64
count
,
total
,
aID
uintptr
//int32
sameSite
uintptr
//int32 TCefCookieSameSite
priority
uintptr
//int32 TCefCookiePriority
aSetImmediately
uintptr
//bool
aDeleteCookie
uintptr
//bool
aResult
uintptr
//bool
}
type
TCefKeyEvent
struct
{
Kind
TCefKeyEventType
// called 'type' in the original CEF source code
Modifiers
TCefEventFlags
...
...
@@ -64,22 +46,82 @@ type TCefKeyEvent struct {
FocusOnEditableField
int32
}
type
TCefCommandLine
struct
{
commandLines
map
[
string
]
string
type
TCefRequestContextSettings
struct
{
Size
uint32
CachePath
TCefString
PersistSessionCookies
int32
PersistUserPreferences
int32
AcceptLanguageList
TCefString
CookieableSchemesList
TCefString
CookieableSchemesExcludeDefaults
int32
}
type
TCefBrowserSettings
struct
{
Size
NativeUInt
WindowlessFrameRate
Integer
StandardFontFamily
TCefString
FixedFontFamily
TCefString
SerifFontFamily
TCefString
SansSerifFontFamily
TCefString
CursiveFontFamily
TCefString
FantasyFontFamily
TCefString
DefaultFontSize
Integer
DefaultFixedFontSize
Integer
MinimumFontSize
Integer
MinimumLogicalFontSize
Integer
DefaultEncoding
TCefString
RemoteFonts
TCefState
Javascript
TCefState
JavascriptCloseWindows
TCefState
JavascriptAccessClipboard
TCefState
JavascriptDomPaste
TCefState
ImageLoading
TCefState
ImageShrinkStandaLonetoFit
TCefState
TextAreaResize
TCefState
TabToLinks
TCefState
LocalStorage
TCefState
Databases
TCefState
Webgl
TCefState
BackgroundColor
TCefColor
AcceptLanguageList
TCefString
ChromeStatusBubble
TCefState
}
type
tCefProxy
struct
{
ProxyType
uintptr
ProxyScheme
uintptr
ProxyServer
uintptr
ProxyPort
uintptr
ProxyUsername
uintptr
ProxyPassword
uintptr
ProxyScriptURL
uintptr
ProxyByPassList
uintptr
MaxConnectionsPerProxy
uintptr
CustomHeaderName
uintptr
CustomHeaderValue
uintptr
func
(
m
*
TCefBrowserSettings
)
ToPtr
()
*
TCefBrowserSettingsPtr
{
return
&
TCefBrowserSettingsPtr
{
Size
:
m
.
Size
.
ToPtr
(),
WindowlessFrameRate
:
m
.
WindowlessFrameRate
.
ToPtr
(),
StandardFontFamily
:
m
.
StandardFontFamily
.
ToPtr
(),
FixedFontFamily
:
m
.
FixedFontFamily
.
ToPtr
(),
SerifFontFamily
:
m
.
SerifFontFamily
.
ToPtr
(),
SansSerifFontFamily
:
m
.
SansSerifFontFamily
.
ToPtr
(),
CursiveFontFamily
:
m
.
CursiveFontFamily
.
ToPtr
(),
FantasyFontFamily
:
m
.
FantasyFontFamily
.
ToPtr
(),
DefaultFontSize
:
m
.
DefaultFontSize
.
ToPtr
(),
DefaultFixedFontSize
:
m
.
DefaultFixedFontSize
.
ToPtr
(),
MinimumFontSize
:
m
.
MinimumFontSize
.
ToPtr
(),
MinimumLogicalFontSize
:
m
.
MinimumLogicalFontSize
.
ToPtr
(),
DefaultEncoding
:
m
.
DefaultEncoding
.
ToPtr
(),
RemoteFonts
:
m
.
RemoteFonts
.
ToPtr
(),
Javascript
:
m
.
Javascript
.
ToPtr
(),
JavascriptCloseWindows
:
m
.
JavascriptCloseWindows
.
ToPtr
(),
JavascriptAccessClipboard
:
m
.
JavascriptAccessClipboard
.
ToPtr
(),
JavascriptDomPaste
:
m
.
JavascriptDomPaste
.
ToPtr
(),
ImageLoading
:
m
.
ImageLoading
.
ToPtr
(),
ImageShrinkStandaLonetoFit
:
m
.
ImageShrinkStandaLonetoFit
.
ToPtr
(),
TextAreaResize
:
m
.
TextAreaResize
.
ToPtr
(),
TabToLinks
:
m
.
TabToLinks
.
ToPtr
(),
LocalStorage
:
m
.
LocalStorage
.
ToPtr
(),
Databases
:
m
.
Databases
.
ToPtr
(),
Webgl
:
m
.
Webgl
.
ToPtr
(),
BackgroundColor
:
m
.
BackgroundColor
.
ToPtr
(),
AcceptLanguageList
:
m
.
AcceptLanguageList
.
ToPtr
(),
ChromeStatusBubble
:
m
.
ChromeStatusBubble
.
ToPtr
(),
}
}
type
TCefCommandLine
struct
{
commandLines
map
[
string
]
string
}
type
TCefProxy
struct
{
...
...
@@ -127,13 +169,6 @@ type BeforePopupInfo struct {
UserGesture
bool
}
type
beforePopupInfo
struct
{
TargetUrl
uintptr
//string
TargetFrameName
uintptr
//string
TargetDisposition
uintptr
//int32
UserGesture
uintptr
//bool
}
type
TCefRect
struct
{
X
int32
Y
int32
...
...
@@ -141,13 +176,6 @@ type TCefRect struct {
Height
int32
}
type
tCefRect
struct
{
X
uintptr
//int32
Y
uintptr
//int32
Width
uintptr
//int32
Height
uintptr
//int32
}
type
TCefPoint
struct
{
X
int32
Y
int32
...
...
@@ -223,3 +251,37 @@ func (m *String) SetValue(v string) {
func
(
m
*
String
)
GetValue
()
string
{
return
m
.
value
}
func
(
m
*
String
)
ToPtr
()
uintptr
{
return
api
.
PascalStr
(
m
.
value
)
}
type
PChar
string
func
(
m
PChar
)
ToPtr
()
uintptr
{
return
api
.
PascalStr
(
string
(
m
))
}
type
TCefColor
uint16
func
(
m
TCefColor
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
Integer
int32
func
(
m
Integer
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
NativeUInt
uint32
func
(
m
NativeUInt
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefString
string
func
(
m
TCefString
)
ToPtr
()
uintptr
{
return
api
.
PascalStr
(
string
(
m
))
}
cef/cef-window-component.go
浏览文件 @
8fb0dd41
...
...
@@ -252,7 +252,7 @@ func init() {
case
WindowComponentOnGetInitialBounds
:
sender
:=
getPtr
(
0
)
window
:=
getPtr
(
1
)
resultRectPtr
:=
(
*
tCefRect
)(
getPtr
(
2
))
resultRectPtr
:=
(
*
tCefRect
Ptr
)(
getPtr
(
2
))
resultRect
:=
&
TCefRect
{}
fn
.
(
WindowComponentOnGetInitialBounds
)(
lcl
.
AsObject
(
sender
),
&
ICefWindow
{
instance
:
window
},
resultRect
)
resultRectPtr
.
X
=
uintptr
(
resultRect
.
X
)
...
...
consts/consts.go
浏览文件 @
8fb0dd41
...
...
@@ -10,8 +10,10 @@ package consts
import
(
"github.com/energye/golcl/energy/homedir"
"github.com/energye/golcl/lcl/api"
"os"
"path/filepath"
"unsafe"
)
var
(
...
...
@@ -30,27 +32,93 @@ const (
MemoryNetwork
=
"unix"
)
type
_int8
int8
type
_int16
int16
type
_int32
int32
type
_int64
int64
type
_int
int
type
_uint8
uint8
type
_uint16
uint16
type
_uint32
uint32
type
_uint64
uint64
type
_string
string
type
_boolean
bool
type
_float32
float32
type
_float64
float64
func
(
m
_int8
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_int16
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_int32
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_int64
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_int
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_uint8
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_uint16
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_uint32
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_uint64
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
func
(
m
_string
)
ToPtr
()
uintptr
{
return
api
.
PascalStr
(
string
(
m
))
}
func
(
m
_boolean
)
ToPtr
()
uintptr
{
return
api
.
PascalBool
(
bool
(
m
))
}
func
(
m
_float32
)
ToPtr
()
uintptr
{
return
uintptr
(
unsafe
.
Pointer
(
&
m
))
}
func
(
m
_float64
)
ToPtr
()
uintptr
{
return
uintptr
(
unsafe
.
Pointer
(
&
m
))
}
//0:net 1:unix
type
IPC_TYPE
int8
type
IPC_TYPE
=
_
int8
const
(
IPCT_NET
IPC_TYPE
=
iota
IPCT_NET
=
IPC_TYPE
(
iota
)
IPCT_UNIX
)
type
ChannelType
int8
type
ChannelType
=
_
int8
const
(
Ct_Server
ChannelType
=
iota
Ct_Server
=
ChannelType
(
iota
)
Ct_Client
)
type
TriggerMode
int8
type
TriggerMode
=
_
int8
const
(
Tm_Async
TriggerMode
=
iota
//异步
Tm_Callback
//异步,带回调函数返回结果
Tm_Sync
//同步,阻塞等待结果返回值
Tm_Async
=
TriggerMode
(
iota
)
//异步
Tm_Callback
//异步,带回调函数返回结果
Tm_Sync
//同步,阻塞等待结果返回值
)
const
(
...
...
@@ -68,34 +136,34 @@ const (
)
//缩放、放大
type
ZOOM
int32
type
ZOOM
=
_
int32
const
(
ZOOM_RESET
ZOOM
=
iota
ZOOM_RESET
=
ZOOM
(
iota
)
ZOOM_INC
ZOOM_DEC
)
//进程结束的状态
type
TCefTerminationStatus
int32
type
TCefTerminationStatus
=
_
int32
const
(
TS_ABNORMAL_TERMINATION
TCefTerminationStatus
=
iota
TS_ABNORMAL_TERMINATION
=
TCefTerminationStatus
(
iota
)
TS_PROCESS_WAS_KILLED
TS_PROCESS_CRASHED
TS_PROCESS_OOM
)
//前进 & 后退
type
BF
int32
type
BF
=
_
int32
const
(
BF_GOBACK
BF
=
iota
BF_GOFORWARD
=
iota
BF_GOBACK
=
BF
(
iota
)
BF_GOFORWARD
)
//日志等级
type
LOG
uint32
type
LOG
=
_
uint32
const
(
LOGSEVERITY_DEFAULT
LOG
=
0
...
...
@@ -108,62 +176,62 @@ const (
LOGSEVERITY_DISABLE
LOG
=
99
)
type
LANGUAGE
string
type
LANGUAGE
=
_
string
const
(
LANGUAGE_zh_CN
LANGUAGE
=
"zh-CN"
LANGUAGE_zh_TW
=
"zh-TW"
LANGUAGE_am
=
"am"
LANGUAGE_ar
=
"ar"
LANGUAGE_bg
=
"bg"
LANGUAGE_bn
=
"bn"
LANGUAGE_ca
=
"ca"
LANGUAGE_cs
=
"cs"
LANGUAGE_da
=
"da"
LANGUAGE_de
=
"de"
LANGUAGE_el
=
"el"
LANGUAGE_en_GB
=
"en-GB"
LANGUAGE_en_US
=
"en-US"
LANGUAGE_es
=
"es"
LANGUAGE_es_419
=
"es-419"
LANGUAGE_et
=
"et"
LANGUAGE_fa
=
"fa"
LANGUAGE_fi
=
"fi"
LANGUAGE_fil
=
"fil"
LANGUAGE_fr
=
"fr"
LANGUAGE_gu
=
"gu"
LANGUAGE_he
=
"he"
LANGUAGE_hi
=
"hi"
LANGUAGE_hr
=
"hr"
LANGUAGE_hu
=
"hu"
LANGUAGE_id
=
"channelId"
LANGUAGE_it
=
"it"
LANGUAGE_ja
=
"ja"
LANGUAGE_kn
=
"kn"
LANGUAGE_ko
=
"ko"
LANGUAGE_lt
=
"lt"
LANGUAGE_lv
=
"lv"
LANGUAGE_ml
=
"ml"
LANGUAGE_mr
=
"mr"
LANGUAGE_ms
=
"ms"
LANGUAGE_nb
=
"nb"
LANGUAGE_nl
=
"nl"
LANGUAGE_pl
=
"pl"
LANGUAGE_pt_BR
=
"pt-BR"
LANGUAGE_pt_PT
=
"pt-PT"
LANGUAGE_ro
=
"ro"
LANGUAGE_ru
=
"ru"
LANGUAGE_sk
=
"sk"
LANGUAGE_sl
=
"sl"
LANGUAGE_sr
=
"sr"
LANGUAGE_sv
=
"sv"
LANGUAGE_sw
=
"sw"
LANGUAGE_ta
=
"ta"
LANGUAGE_te
=
"te"
LANGUAGE_th
=
"th"
LANGUAGE_tr
=
"tr"
LANGUAGE_uk
=
"uk"
LANGUAGE_vi
=
"vi"
LANGUAGE_zh_TW
LANGUAGE
=
"zh-TW"
LANGUAGE_am
LANGUAGE
=
"am"
LANGUAGE_ar
LANGUAGE
=
"ar"
LANGUAGE_bg
LANGUAGE
=
"bg"
LANGUAGE_bn
LANGUAGE
=
"bn"
LANGUAGE_ca
LANGUAGE
=
"ca"
LANGUAGE_cs
LANGUAGE
=
"cs"
LANGUAGE_da
LANGUAGE
=
"da"
LANGUAGE_de
LANGUAGE
=
"de"
LANGUAGE_el
LANGUAGE
=
"el"
LANGUAGE_en_GB
LANGUAGE
=
"en-GB"
LANGUAGE_en_US
LANGUAGE
=
"en-US"
LANGUAGE_es
LANGUAGE
=
"es"
LANGUAGE_es_419
LANGUAGE
=
"es-419"
LANGUAGE_et
LANGUAGE
=
"et"
LANGUAGE_fa
LANGUAGE
=
"fa"
LANGUAGE_fi
LANGUAGE
=
"fi"
LANGUAGE_fil
LANGUAGE
=
"fil"
LANGUAGE_fr
LANGUAGE
=
"fr"
LANGUAGE_gu
LANGUAGE
=
"gu"
LANGUAGE_he
LANGUAGE
=
"he"
LANGUAGE_hi
LANGUAGE
=
"hi"
LANGUAGE_hr
LANGUAGE
=
"hr"
LANGUAGE_hu
LANGUAGE
=
"hu"
LANGUAGE_id
LANGUAGE
=
"channelId"
LANGUAGE_it
LANGUAGE
=
"it"
LANGUAGE_ja
LANGUAGE
=
"ja"
LANGUAGE_kn
LANGUAGE
=
"kn"
LANGUAGE_ko
LANGUAGE
=
"ko"
LANGUAGE_lt
LANGUAGE
=
"lt"
LANGUAGE_lv
LANGUAGE
=
"lv"
LANGUAGE_ml
LANGUAGE
=
"ml"
LANGUAGE_mr
LANGUAGE
=
"mr"
LANGUAGE_ms
LANGUAGE
=
"ms"
LANGUAGE_nb
LANGUAGE
=
"nb"
LANGUAGE_nl
LANGUAGE
=
"nl"
LANGUAGE_pl
LANGUAGE
=
"pl"
LANGUAGE_pt_BR
LANGUAGE
=
"pt-BR"
LANGUAGE_pt_PT
LANGUAGE
=
"pt-PT"
LANGUAGE_ro
LANGUAGE
=
"ro"
LANGUAGE_ru
LANGUAGE
=
"ru"
LANGUAGE_sk
LANGUAGE
=
"sk"
LANGUAGE_sl
LANGUAGE
=
"sl"
LANGUAGE_sr
LANGUAGE
=
"sr"
LANGUAGE_sv
LANGUAGE
=
"sv"
LANGUAGE_sw
LANGUAGE
=
"sw"
LANGUAGE_ta
LANGUAGE
=
"ta"
LANGUAGE_te
LANGUAGE
=
"te"
LANGUAGE_th
LANGUAGE
=
"th"
LANGUAGE_tr
LANGUAGE
=
"tr"
LANGUAGE_uk
LANGUAGE
=
"uk"
LANGUAGE_vi
LANGUAGE
=
"vi"
)
// Chromium关闭的操作类型
...
...
@@ -173,27 +241,27 @@ const (
// cbaClose : 继续关闭浏览器
// cbaDelay : 暂时停止关闭浏览器
// : 当应用程序需要在关闭浏览器之前执行一些自定义进程时使用。在关闭浏览器之前,通常需要在主线程中销毁TCEFWindowParent。
type
CBS
int32
type
CBS
=
_
int32
const
(
CbaClose
=
iota
CbaClose
=
CBS
(
iota
)
CbaDelay
CbaCancel
)
//CEF 进程 ChannelId
type
CefProcessId
int32
type
CefProcessId
=
_
int32
const
(
PID_BROWSER
CefProcessId
=
iota
PID_BROWSER
=
CefProcessId
(
iota
)
PID_RENDER
)
//支持的JS类型
type
V8_JS_VALUE_TYPE
int32
type
V8_JS_VALUE_TYPE
=
_
int32
const
(
V8_VALUE_STRING
V8_JS_VALUE_TYPE
=
iota
V8_VALUE_STRING
=
V8_JS_VALUE_TYPE
(
iota
)
V8_VALUE_INT
V8_VALUE_DOUBLE
V8_VALUE_BOOLEAN
...
...
@@ -208,10 +276,10 @@ const (
)
//支持的GO类型
type
GO_VALUE_TYPE
int32
type
GO_VALUE_TYPE
=
_
int32
const
(
GO_VALUE_STRING
GO_VALUE_TYPE
=
iota
GO_VALUE_STRING
=
GO_VALUE_TYPE
(
iota
)
GO_VALUE_INT
GO_VALUE_INT8
GO_VALUE_INT16
...
...
@@ -238,54 +306,54 @@ const (
)
//JS属性
type
V8_PROPERTY_ATTRIBUTE
int32
type
V8_PROPERTY_ATTRIBUTE
=
_
int32
const
(
V8_PROPERTY_ATTRIBUTE_NONE
V8_PROPERTY_ATTRIBUTE
=
0
V8_PROPERTY_ATTRIBUTE_READONLY
=
1
<<
0
V8_PROPERTY_ATTRIBUTE_DONTENUM
=
1
<<
1
V8_PROPERTY_ATTRIBUTE_DONTDELETE
=
1
<<
2
V8_PROPERTY_ATTRIBUTE_READONLY
V8_PROPERTY_ATTRIBUTE
=
1
<<
0
V8_PROPERTY_ATTRIBUTE_DONTENUM
V8_PROPERTY_ATTRIBUTE
=
1
<<
1
V8_PROPERTY_ATTRIBUTE_DONTDELETE
V8_PROPERTY_ATTRIBUTE
=
1
<<
2
)
//JS交互绑定的事件类型
type
BIND_EVENT
int32
type
BIND_EVENT
=
_
int32
const
(
BE_SET
BIND_EVENT
=
0
BE_GET
=
1
BE_FUNC
=
2
BE_SET
=
BIND_EVENT
(
iota
)
BE_GET
BE_FUNC
)
//异常信息
type
CEF_V8_EXCEPTION
int32
const
(
CVE_ERROR_OK
CEF_V8_EXCEPTION
=
iota
//操作成功
CVE_ERROR_NOT_FOUND_FIELD
//未找到字段 或字段未定义
CVE_ERROR_NOT_FOUND_FUNC
//未找到函数 或函数未定义
CVE_ERROR_TYPE_NOT_SUPPORTED
//不支持的变量类型 变量类型只支持[string int double bool null undefined]
CVE_ERROR_TYPE_CANNOT_CHANGE
//字段为普通类型不能变更为 array、object、function
CVE_ERROR_TYPE_INVALID
//类型无效
CVE_ERROR_GET_STRING_FAIL
//获取string类型失败
CVE_ERROR_GET_INT_FAIL
//获取int类型失败
CVE_ERROR_GET_DOUBLE_FAIL
//获取double类型失败
CVE_ERROR_GET_BOOL_FAIL
//获取bool类型失败
CVE_ERROR_GET_NULL_FAIL
//获取null类型失败
CVE_ERROR_GET_UNDEFINED_FAIL
//获取undefined类型失败
CVE_ERROR_FUNC_INVALID_P_L_9
//该函数非法 类型不正确 或参数个数大于9个
CVE_ERROR_FUNC_IN_PAM
//入参类型不正确 只能为string int double boolean
CVE_ERROR_FUNC_OUT_PAM
//出参类型不正确 只能为EefError 或 可选的[string int double boolean]
CVE_ERROR_FUNC_GET_IN_PAM_STRING_FAIL
//入参获取string类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_INT_FAIL
//入参获取int类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_DOUBLE_FAIL
//入参获取double类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_BOOLEAN_FAIL
//入参获取boolean类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_STRING_FAIL
//出参获取string类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_INT_FAIL
//出参获取int类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_DOUBLE_FAIL
//出参获取double类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_BOOLEAN_FAIL
//出参获取boolean类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_CEFERROR_FAIL
//出参获取CefError值失败
CVE_ERROR_IPC_GET_BIND_FIELD_VALUE_FAIL
//IPC获取绑定值失败
CVE_ERROR_UNKNOWN_ERROR
//未知错误
type
CEF_V8_EXCEPTION
=
_
int32
const
(
CVE_ERROR_OK
=
CEF_V8_EXCEPTION
(
iota
)
//操作成功
CVE_ERROR_NOT_FOUND_FIELD
//未找到字段 或字段未定义
CVE_ERROR_NOT_FOUND_FUNC
//未找到函数 或函数未定义
CVE_ERROR_TYPE_NOT_SUPPORTED
//不支持的变量类型 变量类型只支持[string int double bool null undefined]
CVE_ERROR_TYPE_CANNOT_CHANGE
//字段为普通类型不能变更为 array、object、function
CVE_ERROR_TYPE_INVALID
//类型无效
CVE_ERROR_GET_STRING_FAIL
//获取string类型失败
CVE_ERROR_GET_INT_FAIL
//获取int类型失败
CVE_ERROR_GET_DOUBLE_FAIL
//获取double类型失败
CVE_ERROR_GET_BOOL_FAIL
//获取bool类型失败
CVE_ERROR_GET_NULL_FAIL
//获取null类型失败
CVE_ERROR_GET_UNDEFINED_FAIL
//获取undefined类型失败
CVE_ERROR_FUNC_INVALID_P_L_9
//该函数非法 类型不正确 或参数个数大于9个
CVE_ERROR_FUNC_IN_PAM
//入参类型不正确 只能为string int double boolean
CVE_ERROR_FUNC_OUT_PAM
//出参类型不正确 只能为EefError 或 可选的[string int double boolean]
CVE_ERROR_FUNC_GET_IN_PAM_STRING_FAIL
//入参获取string类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_INT_FAIL
//入参获取int类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_DOUBLE_FAIL
//入参获取double类型值失败
CVE_ERROR_FUNC_GET_IN_PAM_BOOLEAN_FAIL
//入参获取boolean类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_STRING_FAIL
//出参获取string类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_INT_FAIL
//出参获取int类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_DOUBLE_FAIL
//出参获取double类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_BOOLEAN_FAIL
//出参获取boolean类型值失败
CVE_ERROR_FUNC_GET_OUT_PAM_CEFERROR_FAIL
//出参获取CefError值失败
CVE_ERROR_IPC_GET_BIND_FIELD_VALUE_FAIL
//IPC获取绑定值失败
CVE_ERROR_UNKNOWN_ERROR
//未知错误
)
const
(
...
...
@@ -294,34 +362,34 @@ const (
)
//函数类型
type
FN_TYPE
int8
type
FN_TYPE
=
_
int8
const
(
FN_TYPE_COMMON
FN_TYPE
=
iota
//普通函数,直接定义的
FN_TYPE_OBJECT
//对象函数,所属对象
FN_TYPE_COMMON
=
FN_TYPE
(
iota
)
//普通函数,直接定义的
FN_TYPE_OBJECT
//对象函数,所属对象
)
//通用类型或对象类型
type
IS_CO
int8
type
IS_CO
=
_
int8
const
(
IS_COMMON
IS_CO
=
iota
IS_COMMON
=
IS_CO
(
iota
)
IS_OBJECT
)
//进程消息类型
type
PROCESS_MESSAGE_TYPE
int8
type
PROCESS_MESSAGE_TYPE
=
_
int8
const
(
PMT_JS_CODE
PROCESS_MESSAGE_TYPE
=
iota
//执行JS代码消息
PMT_TEXT
//文本传递消息
PMT_BINARY
//二进制消息
PMT_JS_CODE
=
PROCESS_MESSAGE_TYPE
(
iota
)
//执行JS代码消息
PMT_TEXT
//文本传递消息
PMT_BINARY
//二进制消息
)
type
TCefProcessType
int8
type
TCefProcessType
=
_
int8
const
(
PtBrowser
TCefProcessType
=
iota
PtBrowser
=
TCefProcessType
(
iota
)
PtRender
PtZygote
PtGPU
...
...
@@ -525,6 +593,10 @@ const (
STATE_DISABLE
)
func
(
m
TCefState
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefTouchEeventType
int32
const
(
...
...
@@ -534,6 +606,10 @@ const (
CEF_TET_CANCELLED
)
func
(
m
TCefTouchEeventType
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefPointerType
int32
const
(
...
...
@@ -544,6 +620,10 @@ const (
CEF_POINTER_TYPE_UNKNOWN
)
func
(
m
TCefPointerType
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefMouseButtonType
int32
const
(
...
...
@@ -552,6 +632,10 @@ const (
MBT_RIGHT
)
func
(
m
TCefMouseButtonType
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
//进程消息错误码
type
ProcessMessageError
int32
...
...
@@ -565,6 +649,10 @@ const (
PMErr_NAME_CANNOT_USED
=
-
6
//不能使用的消息名称
)
func
(
m
ProcessMessageError
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefWindowOpenDisposition
int32
const
(
...
...
@@ -582,6 +670,10 @@ const (
WOD_NEW_PICTURE_IN_PICTURE
)
func
(
m
TCefWindowOpenDisposition
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
// Browser Window Type
type
WINDOW_TYPE
int8
...
...
@@ -592,11 +684,15 @@ const (
WT_VIEW_SOURCE
)
func
(
m
WINDOW_TYPE
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefContextMenuTypeFlags
uint32
type
TCefContextMenuMediaStateFlags
uint32
type
TCefContextMenuEditStateFlags
uint32
type
TCefMenuAnchorPosition
=
int32
type
TCefMenuAnchorPosition
int32
const
(
CEF_MENU_ANCHOR_TOPLEFT
TCefMenuAnchorPosition
=
iota
...
...
@@ -604,4 +700,12 @@ const (
CEF_MENU_ANCHOR_BOTTOMCENTER
)
type
TCefShowState
=
int32
func
(
m
TCefMenuAnchorPosition
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
type
TCefShowState
int32
func
(
m
TCefShowState
)
ToPtr
()
uintptr
{
return
uintptr
(
m
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录