2022-10-04 13:21:05 +08:00
|
|
|
|
//----------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Copyright © yanghy. All Rights Reserved.
|
|
|
|
|
//
|
2022-10-04 16:38:43 +08:00
|
|
|
|
// Licensed under GNU General Public License v3.0
|
2022-10-04 13:21:05 +08:00
|
|
|
|
//
|
|
|
|
|
//----------------------------------------
|
|
|
|
|
|
|
|
|
|
package cef
|
|
|
|
|
|
|
|
|
|
import (
|
2022-11-02 12:47:47 +08:00
|
|
|
|
. "github.com/energye/energy/common"
|
2022-10-04 22:34:57 +08:00
|
|
|
|
. "github.com/energye/energy/consts"
|
|
|
|
|
"github.com/energye/energy/ipc"
|
2022-10-04 13:21:05 +08:00
|
|
|
|
"github.com/energye/golcl/lcl"
|
|
|
|
|
"github.com/energye/golcl/lcl/api"
|
2022-12-07 22:19:43 +08:00
|
|
|
|
"github.com/energye/golcl/lcl/types"
|
2022-10-04 13:21:05 +08:00
|
|
|
|
"strings"
|
|
|
|
|
"time"
|
|
|
|
|
"unsafe"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type IChromiumProc interface {
|
|
|
|
|
lcl.IObject
|
2022-10-04 22:34:57 +08:00
|
|
|
|
On(name string, eventCallback ipc.EventCallback)
|
2022-10-05 17:20:20 +08:00
|
|
|
|
ExecuteJavaScript(code, scriptURL string, startLine int32) //单纯的执行js,没有返回值
|
2022-10-24 22:52:08 +08:00
|
|
|
|
Emit(eventName string, args ipc.IArgumentList, target IEmitTarget) ProcessMessageError
|
|
|
|
|
EmitAndCallback(eventName string, args ipc.IArgumentList, target IEmitTarget, callback ipc.IPCCallback) ProcessMessageError
|
|
|
|
|
EmitAndReturn(eventName string, args ipc.IArgumentList, target IEmitTarget) (ipc.IIPCContext, ProcessMessageError)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
SetDefaultURL(defaultURL string)
|
|
|
|
|
SetEnableMultiBrowserMode(enableMultiBrowserMode bool)
|
|
|
|
|
LoadUrl(url string)
|
|
|
|
|
LoadHtml(html string)
|
|
|
|
|
StartDownload(url string)
|
|
|
|
|
DownloadImage(imageUrl string, isFavicon bool, maxImageSize int32, bypassCache bool)
|
|
|
|
|
Reload()
|
|
|
|
|
StopLoad()
|
|
|
|
|
ResetZoomLevel()
|
|
|
|
|
CloseAllBrowsers()
|
|
|
|
|
CreateBrowser(window ITCefWindow) bool
|
|
|
|
|
Initialized() bool
|
|
|
|
|
BrowserId() int32
|
|
|
|
|
IsSameBrowser(browser *ICefBrowser) bool
|
|
|
|
|
PrintToPDF(saveFilePath string)
|
|
|
|
|
Print()
|
|
|
|
|
BrowserDownloadCancel(browseId, downloadId int32)
|
|
|
|
|
BrowserDownloadPause(browseId, downloadId int32)
|
|
|
|
|
BrowserZoom(zoom ZOOM)
|
|
|
|
|
GoBack()
|
|
|
|
|
GoForward()
|
|
|
|
|
NotifyMoveOrResizeStarted()
|
|
|
|
|
CloseBrowser(forceClose bool)
|
|
|
|
|
ShowDevTools(window ITCefWindow)
|
|
|
|
|
CloseDevTools(window ITCefWindow)
|
|
|
|
|
VisitAllCookies(id int32)
|
|
|
|
|
VisitURLCookies(url string, includeHttpOnly bool, id int32)
|
|
|
|
|
DeleteCookies(url, cookieName string, deleteImmediately bool)
|
|
|
|
|
SetCookie(url, name, value, domain, path string,
|
|
|
|
|
secure, httponly, hasExpires bool,
|
|
|
|
|
creation, lastAccess, expires time.Time,
|
|
|
|
|
sameSite TCefCookieSameSite, priority TCefCookiePriority, aSetImmediately bool, aID int32)
|
|
|
|
|
SetProxy(cefProxy *TCefProxy)
|
|
|
|
|
UpdatePreferences()
|
|
|
|
|
ExecuteDevToolsMethod(messageId int32, method string, dictionaryValue *ICefDictionaryValue)
|
2022-10-04 22:34:57 +08:00
|
|
|
|
SendProcessMessage(targetProcess CefProcessId, processMessage *ipc.ICefProcessMessage) int
|
2022-10-04 13:21:05 +08:00
|
|
|
|
CreateClientHandler(client *ICefClient, alsOSR bool) bool
|
|
|
|
|
SetFocus(value bool)
|
|
|
|
|
SendCaptureLostEvent()
|
|
|
|
|
FrameIsFocused() bool
|
|
|
|
|
}
|
|
|
|
|
|
2022-12-07 22:19:43 +08:00
|
|
|
|
func (m *TCEFChromium) IsValid() bool {
|
|
|
|
|
return m.instance != nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) UnsafeAddr() unsafe.Pointer {
|
|
|
|
|
return m.instance
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ClassName() string {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_ClassName).Call()
|
|
|
|
|
return api.GoStr(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Free() {
|
|
|
|
|
Proc(internale_CEFChromium_Free).Call()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) GetHashCode() int32 {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_GetHashCode).Call()
|
|
|
|
|
return int32(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Equals(object lcl.IObject) bool {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_Equals).Call(lcl.CheckPtr(object))
|
|
|
|
|
return api.GoBool(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ClassType() types.TClass {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_ClassType).Call()
|
|
|
|
|
return types.TClass(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) InstanceSize() int32 {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_InstanceSize).Call()
|
|
|
|
|
return int32(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) InheritsFrom(class types.TClass) bool {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_InheritsFrom).Call(uintptr(class))
|
|
|
|
|
return api.GoBool(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ToString() string {
|
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_ToString).Call()
|
|
|
|
|
return api.GoStr(r1)
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
|
func (m *TCEFChromium) SetDefaultURL(defaultURL string) {
|
|
|
|
|
if IsLinux() || IsDarwin() {
|
|
|
|
|
httpIdx := strings.Index(defaultURL, "http")
|
|
|
|
|
if httpIdx != 0 {
|
|
|
|
|
if strings.Index(defaultURL, "file://") != 0 {
|
|
|
|
|
defaultURL = "file://" + defaultURL
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SetDefaultURL(m.Instance(), defaultURL)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) SetEnableMultiBrowserMode(enableMultiBrowserMode bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SetMultiBrowserMode(m.Instance(), enableMultiBrowserMode)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) LoadUrl(url string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_LoadURL(m.Instance(), url)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) LoadHtml(html string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_LoadString(m.Instance(), html)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) StartDownload(url string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_StartDownload(m.Instance(), url)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) DownloadImage(imageUrl string, isFavicon bool, maxImageSize int32, bypassCache bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_DownloadImage(m.Instance(), imageUrl, isFavicon, maxImageSize, bypassCache)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Reload() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_Reload(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) StopLoad() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_StopLoad(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ResetZoomLevel() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_ResetZoomLevel(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) CloseAllBrowsers() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_CloseAllBrowses(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) CreateBrowser(window ITCefWindow) bool {
|
|
|
|
|
if window.Type() == Wht_WindowParent {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return _CEFChromium_CreateBrowseByWindow(m.Instance(), window.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
} else if window.Type() == Wht_LinkedWindowParent {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return _CEFChromium_CreateBrowseByLinkedWindow(m.Instance(), window.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
return false
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Initialized() bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return _CEFChromium_Initialized(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) BrowserId() int32 {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return _CEFChromium_GetBrowserId(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Browser() *ICefBrowser {
|
|
|
|
|
return &ICefBrowser{
|
|
|
|
|
browseId: m.BrowserId(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) IsSameBrowser(browser *ICefBrowser) bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return _CEFChromium_IsSameBrowser(m.Instance(), uintptr(browser.browseId))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) PrintToPDF(saveFilePath string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_PrintToPDF(m.Instance(), saveFilePath)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) Print() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_Print(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 下载取消
|
|
|
|
|
func (m *TCEFChromium) BrowserDownloadCancel(browseId, downloadId int32) {
|
|
|
|
|
_CEFChromium_BrowserDownloadCancel(uintptr(browseId), uintptr(downloadId))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 下载暂停
|
|
|
|
|
func (m *TCEFChromium) BrowserDownloadPause(browseId, downloadId int32) {
|
|
|
|
|
_CEFChromium_BrowserDownloadPause(uintptr(browseId), uintptr(downloadId))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) BrowserZoom(zoom ZOOM) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_BrowserZoom(m.Instance(), zoom)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) GoBack() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_GoBackForward(m.Instance(), BF_GOBACK)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) GoForward() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_GoBackForward(m.Instance(), BF_GOFORWARD)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) NotifyMoveOrResizeStarted() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_NotifyMoveOrResizeStarted(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) CloseBrowser(forceClose bool) {
|
2022-12-07 22:19:43 +08:00
|
|
|
|
_CEFChromium_CloseBrowser(m.Instance(), api.PascalBool(forceClose))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ShowDevTools(window ITCefWindow) {
|
|
|
|
|
if window == nil {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_ShowDevTools(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
} else {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_ShowDevToolsByWindowParent(m.Instance(), window.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) CloseDevTools(window ITCefWindow) {
|
|
|
|
|
if window == nil {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_CloseDevTools(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
} else {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_CloseDevToolsByWindowParent(m.Instance(), window.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查看所有cookie,该函数触发 OnCookiesVisited 事件返回结果
|
|
|
|
|
func (m *TCEFChromium) VisitAllCookies(id int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_VisitAllCookies(m.Instance(), id)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 查看指针URL cookie,该函数触发 OnCookiesVisited 事件返回结果
|
|
|
|
|
// url https://www.demo.com
|
|
|
|
|
func (m *TCEFChromium) VisitURLCookies(url string, includeHttpOnly bool, id int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_VisitURLCookies(m.Instance(), url, includeHttpOnly, id)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 删除所有cookie
|
|
|
|
|
func (m *TCEFChromium) DeleteCookies(url, cookieName string, deleteImmediately bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_DeleteCookies(m.Instance(), url, cookieName, deleteImmediately)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) SetCookie(url, name, value, domain, path string,
|
|
|
|
|
secure, httponly, hasExpires bool,
|
|
|
|
|
creation, lastAccess, expires time.Time,
|
|
|
|
|
sameSite TCefCookieSameSite, priority TCefCookiePriority, aSetImmediately bool, aID int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SetCookie(m.Instance(), url, name, value, domain, path, secure, httponly, hasExpires, creation, lastAccess, expires, sameSite, priority, aSetImmediately, aID)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) SetProxy(cefProxy *TCefProxy) {
|
|
|
|
|
proxy := &tCefProxy{
|
|
|
|
|
ProxyType: uintptr(cefProxy.ProxyType),
|
|
|
|
|
ProxyScheme: uintptr(cefProxy.ProxyScheme),
|
2022-12-03 21:56:51 +08:00
|
|
|
|
ProxyServer: api.PascalStr(cefProxy.ProxyServer),
|
2022-10-04 13:21:05 +08:00
|
|
|
|
ProxyPort: uintptr(cefProxy.ProxyPort),
|
2022-12-03 21:56:51 +08:00
|
|
|
|
ProxyUsername: api.PascalStr(cefProxy.ProxyUsername),
|
|
|
|
|
ProxyPassword: api.PascalStr(cefProxy.ProxyPassword),
|
|
|
|
|
ProxyScriptURL: api.PascalStr(cefProxy.ProxyScriptURL),
|
|
|
|
|
ProxyByPassList: api.PascalStr(cefProxy.ProxyByPassList),
|
2022-10-04 13:21:05 +08:00
|
|
|
|
MaxConnectionsPerProxy: uintptr(cefProxy.MaxConnectionsPerProxy),
|
2022-12-03 21:56:51 +08:00
|
|
|
|
CustomHeaderName: api.PascalStr(cefProxy.CustomHeaderName),
|
|
|
|
|
CustomHeaderValue: api.PascalStr(cefProxy.CustomHeaderValue),
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SetProxy(m.Instance(), proxy)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) UpdatePreferences() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_UpdatePreferences(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) ExecuteDevToolsMethod(messageId int32, method string, dictionaryValue *ICefDictionaryValue) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_ExecuteDevToolsMethod(m.Instance(), messageId, method, dictionaryValue)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 发送进程消息 默认主browser 和 主frame
|
2022-10-04 22:34:57 +08:00
|
|
|
|
func (m *TCEFChromium) SendProcessMessage(targetProcess CefProcessId, processMessage *ipc.ICefProcessMessage) int {
|
|
|
|
|
if processMessage == nil || processMessage.Name == "" || processMessage.ArgumentList == nil || ipc.InternalIPCNameCheck(processMessage.Name) {
|
2022-10-04 13:21:05 +08:00
|
|
|
|
return -3
|
|
|
|
|
}
|
|
|
|
|
//var browser = Browsers.MainBrowser()
|
|
|
|
|
var browser = BrowserWindow.GetBrowser(1)
|
|
|
|
|
data := processMessage.ArgumentList.Package()
|
|
|
|
|
|
|
|
|
|
r1 := _CEFFrame_SendProcessMessage(1, browser.MainFrame().Id, processMessage.Name, targetProcess, int32(processMessage.ArgumentList.Size()), uintptr(unsafe.Pointer(&data[0])), uintptr(len(data)))
|
|
|
|
|
return int(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func (m *TCEFChromium) CreateClientHandler(client *ICefClient, alsOSR bool) bool {
|
2022-12-12 17:34:57 +08:00
|
|
|
|
return api.GoBool(_CEFChromium_CreateClientHandler(m.Instance(), uintptr(client.instance), api.PascalBool(alsOSR)))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
2022-12-12 17:34:57 +08:00
|
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
|
func (m *TCEFChromium) SetFocus(value bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SetFocus(m.Instance(), api.PascalBool(value))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
2022-12-12 17:34:57 +08:00
|
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
|
func (m *TCEFChromium) SendCaptureLostEvent() {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
_CEFChromium_SendCaptureLostEvent(m.Instance())
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
2022-12-12 17:34:57 +08:00
|
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
|
func (m *TCEFChromium) FrameIsFocused() bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
return api.GoBool(_CEFChromium_FrameIsFocused(m.Instance()))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------TCEFChromium proc begin--------
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_Create
|
|
|
|
|
func _CEFChromium_Create(owner, config uintptr) uintptr {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_Create).Call(owner, config)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
return r1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_SetDefaultURL
|
|
|
|
|
func _CEFChromium_SetDefaultURL(instance uintptr, url string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SetDefaultURL).Call(instance, api.PascalStr(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_SetDefaultURL
|
|
|
|
|
func _CEFChromium_SetMultiBrowserMode(instance uintptr, url bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SetMultiBrowserMode).Call(instance, api.PascalBool(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_LoadURL
|
|
|
|
|
func _CEFChromium_LoadURL(instance uintptr, url string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_LoadURL).Call(instance, api.PascalStr(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_LoadString
|
|
|
|
|
func _CEFChromium_LoadString(instance uintptr, html string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_LoadString).Call(instance, api.PascalStr(html))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_StartDownload
|
|
|
|
|
func _CEFChromium_StartDownload(instance uintptr, url string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_StartDownload).Call(instance, api.PascalStr(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_DownloadImage
|
|
|
|
|
func _CEFChromium_DownloadImage(instance uintptr, imageUrl string, isFavicon bool, maxImageSize int32, bypassCache bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_DownloadImage).Call(instance, api.PascalStr(imageUrl), api.PascalBool(isFavicon), uintptr(maxImageSize), api.PascalBool(bypassCache))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_Reload
|
|
|
|
|
func _CEFChromium_Reload(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_Reload).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_StopLoad
|
|
|
|
|
func _CEFChromium_StopLoad(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_StopLoad).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_ResetZoomLevel
|
|
|
|
|
func _CEFChromium_ResetZoomLevel(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_ResetZoomLevel).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CloseAllBrowses
|
|
|
|
|
func _CEFChromium_CloseAllBrowses(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_CloseAllBrowsers).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CreateBrowseByWindow
|
|
|
|
|
func _CEFChromium_CreateBrowseByWindow(instance, window uintptr) bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_CreateBrowserByWindow).Call(instance, window)
|
2022-12-03 21:56:51 +08:00
|
|
|
|
return api.GoBool(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CreateBrowseByLinkedWindow
|
|
|
|
|
func _CEFChromium_CreateBrowseByLinkedWindow(instance, window uintptr) bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_CreateBrowserByLinkedWindow).Call(instance, window)
|
2022-12-03 21:56:51 +08:00
|
|
|
|
return api.GoBool(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_Initialized
|
|
|
|
|
func _CEFChromium_Initialized(instance uintptr) bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_Initialized).Call(instance)
|
2022-12-03 21:56:51 +08:00
|
|
|
|
return api.GoBool(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_GetBrowserId
|
|
|
|
|
func _CEFChromium_GetBrowserId(instance uintptr) int32 {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_GetBrowserId).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
return int32(r1)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_IsSameBrowser
|
|
|
|
|
func _CEFChromium_IsSameBrowser(instance, browser uintptr) bool {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_IsSameBrowser).Call(instance, browser)
|
2022-12-03 21:56:51 +08:00
|
|
|
|
return api.GoBool(r1)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_PrintToPDF
|
|
|
|
|
func _CEFChromium_PrintToPDF(instance uintptr, saveFilePath string) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_PrintToPDF).Call(instance, api.PascalStr(saveFilePath))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_Print
|
|
|
|
|
func _CEFChromium_Print(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_Print).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_BrowserDownloadCancel
|
|
|
|
|
func _CEFChromium_BrowserDownloadCancel(browseId, downloadId uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_BrowserDownloadCancel).Call(browseId, downloadId)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_BrowserDownloadPause
|
|
|
|
|
func _CEFChromium_BrowserDownloadPause(browseId, downloadId uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_BrowserDownloadPause).Call(browseId, downloadId)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_DownloadResume
|
|
|
|
|
func _CEFChromium_DownloadResume(browseId, downloadId uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_DownloadResume).Call(browseId, downloadId)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_BrowserZoom
|
|
|
|
|
func _CEFChromium_BrowserZoom(instance uintptr, zoom ZOOM) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_BrowserZoom).Call(instance, uintptr(zoom))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_GoBackForward
|
|
|
|
|
func _CEFChromium_GoBackForward(instance uintptr, bf BF) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_GoBackForward).Call(instance, uintptr(bf))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_NotifyMoveOrResizeStarted
|
|
|
|
|
func _CEFChromium_NotifyMoveOrResizeStarted(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_NotifyMoveOrResizeStarted).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CloseBrowser
|
|
|
|
|
func _CEFChromium_CloseBrowser(instance, forceClose uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_CloseBrowser).Call(instance, forceClose)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_ExecuteJavaScript
|
|
|
|
|
func _CEFChromium_ExecuteJavaScript(instance uintptr, code, scriptURL string, startLine int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_ExecuteJavaScript).Call(instance, api.PascalStr(code), api.PascalStr(scriptURL), uintptr(startLine))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_ShowDevTools
|
|
|
|
|
func _CEFChromium_ShowDevTools(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_ShowDevTools).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
func _CEFChromium_ShowDevToolsByWindowParent(instance, windowParent uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_ShowDevToolsByWindowParent).Call(instance, windowParent)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CloseDevTools
|
|
|
|
|
func _CEFChromium_CloseDevTools(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_CloseDevTools).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
func _CEFChromium_CloseDevToolsByWindowParent(instance, windowParent uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_CloseDevToolsByWindowParent).Call(instance, windowParent)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_VisitAllCookies
|
|
|
|
|
func _CEFChromium_VisitAllCookies(instance uintptr, id int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_VisitAllCookies).Call(instance, uintptr(id))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_VisitURLCookies
|
|
|
|
|
func _CEFChromium_VisitURLCookies(instance uintptr, url string, includeHttpOnly bool, id int32) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_VisitURLCookies).Call(instance, api.PascalStr(url), api.PascalBool(includeHttpOnly), uintptr(id))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_DeleteCookies
|
|
|
|
|
func _CEFChromium_DeleteCookies(instance uintptr, url, cookieName string, deleteImmediately bool) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_DeleteCookies).Call(instance, api.PascalStr(url), api.PascalStr(cookieName), api.PascalBool(deleteImmediately))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_SetCookie
|
|
|
|
|
func _CEFChromium_SetCookie(instance uintptr, url, name, value, domain, path string,
|
|
|
|
|
secure, httponly, hasExpires bool,
|
|
|
|
|
creation, lastAccess, expires time.Time,
|
|
|
|
|
sameSite TCefCookieSameSite, priority TCefCookiePriority, aSetImmediately bool, aID int32) {
|
|
|
|
|
creationPtr := GoDateTimeToDDateTime(creation)
|
|
|
|
|
lastAccessPtr := GoDateTimeToDDateTime(lastAccess)
|
|
|
|
|
expiresPtr := GoDateTimeToDDateTime(expires)
|
|
|
|
|
cCookie := &cefCookie{
|
2022-12-03 21:56:51 +08:00
|
|
|
|
url: api.PascalStr(url),
|
|
|
|
|
name: api.PascalStr(name),
|
|
|
|
|
value: api.PascalStr(value),
|
|
|
|
|
domain: api.PascalStr(domain),
|
|
|
|
|
path: api.PascalStr(path),
|
|
|
|
|
secure: api.PascalBool(secure),
|
|
|
|
|
httponly: api.PascalBool(httponly),
|
|
|
|
|
hasExpires: api.PascalBool(hasExpires),
|
2022-10-04 13:21:05 +08:00
|
|
|
|
creation: uintptr(unsafe.Pointer(&creationPtr)),
|
|
|
|
|
lastAccess: uintptr(unsafe.Pointer(&lastAccessPtr)),
|
|
|
|
|
expires: uintptr(unsafe.Pointer(&expiresPtr)),
|
|
|
|
|
sameSite: uintptr(sameSite),
|
|
|
|
|
priority: uintptr(priority),
|
2022-12-03 21:56:51 +08:00
|
|
|
|
aSetImmediately: api.PascalBool(aSetImmediately),
|
2022-10-04 13:21:05 +08:00
|
|
|
|
aID: uintptr(aID),
|
|
|
|
|
aDeleteCookie: uintptr(0),
|
|
|
|
|
aResult: uintptr(0),
|
|
|
|
|
count: uintptr(0),
|
|
|
|
|
total: uintptr(0),
|
|
|
|
|
}
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SetCookie).Call(instance, uintptr(unsafe.Pointer(cCookie)))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
cCookie = nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_SetProxy
|
|
|
|
|
func _CEFChromium_SetProxy(instance uintptr, proxy *tCefProxy) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SetProxy).Call(instance, uintptr(unsafe.Pointer(proxy)))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_UpdatePreferences
|
|
|
|
|
func _CEFChromium_UpdatePreferences(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_UpdatePreferences).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_ExecuteDevToolsMethod
|
|
|
|
|
func _CEFChromium_ExecuteDevToolsMethod(instance uintptr, messageId int32, method string, dictionaryValue *ICefDictionaryValue) {
|
|
|
|
|
var data = []byte{}
|
|
|
|
|
var dataPtr unsafe.Pointer
|
2022-10-20 14:16:38 +08:00
|
|
|
|
var dataLen int32 = 0
|
|
|
|
|
var argsLen int32 = 0
|
2022-10-04 13:21:05 +08:00
|
|
|
|
if dictionaryValue != nil && dictionaryValue.dataLen > 0 {
|
|
|
|
|
defer func() {
|
|
|
|
|
dictionaryValue.Clear()
|
|
|
|
|
dictionaryValue = nil
|
|
|
|
|
data = nil
|
|
|
|
|
dataPtr = nil
|
|
|
|
|
}()
|
|
|
|
|
data = dictionaryValue.Package()
|
2022-10-20 14:16:38 +08:00
|
|
|
|
argsLen = int32(dictionaryValue.dataLen)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
dataPtr = unsafe.Pointer(&data[0])
|
2022-10-20 14:16:38 +08:00
|
|
|
|
dataLen = int32(len(data) - 1)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
} else {
|
|
|
|
|
dataPtr = unsafe.Pointer(&data)
|
|
|
|
|
}
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_ExecuteDevToolsMethod).Call(instance, uintptr(messageId), api.PascalStr(method), uintptr(argsLen), uintptr(dataPtr), uintptr(dataLen))
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// TCEFChromium _CEFChromium_CreateClientHandler
|
|
|
|
|
func _CEFChromium_CreateClientHandler(instance, client, alsOSR uintptr) uintptr {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_CreateClientHandler).Call(instance, client, alsOSR)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
return r1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func _CEFChromium_SetFocus(instance, value uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SetFocus).Call(instance, value)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func _CEFChromium_SendCaptureLostEvent(instance uintptr) {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
Proc(internale_CEFChromium_SendCaptureLostEvent).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func _CEFChromium_FrameIsFocused(instance uintptr) uintptr {
|
2022-12-05 12:07:58 +08:00
|
|
|
|
r1, _, _ := Proc(internale_CEFChromium_FrameIsFocused).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
|
return r1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------TCEFChromium proc end--------
|