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 (
|
2023-02-13 21:25:35 +08:00
|
|
|
"github.com/energye/energy/common/imports"
|
2022-10-04 22:34:57 +08:00
|
|
|
. "github.com/energye/energy/consts"
|
2022-10-04 13:21:05 +08:00
|
|
|
"github.com/energye/golcl/lcl/api"
|
|
|
|
"unsafe"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ICefRequest struct {
|
2022-12-13 23:02:40 +08:00
|
|
|
instance unsafe.Pointer
|
2022-10-04 13:21:05 +08:00
|
|
|
Url string
|
|
|
|
Method string
|
|
|
|
ReferrerUrl string
|
|
|
|
ReferrerPolicy TCefReferrerPolicy
|
|
|
|
Flags TCefUrlRequestFlags
|
|
|
|
FirstPartyForCookies string
|
|
|
|
ResourceType TCefResourceType
|
|
|
|
TransitionType TCefTransitionType
|
|
|
|
Identifier uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
type rICefRequest struct {
|
|
|
|
Instance uintptr
|
|
|
|
Url uintptr //string
|
|
|
|
Method uintptr //string
|
|
|
|
ReferrerUrl uintptr //string
|
|
|
|
ReferrerPolicy uintptr //int32
|
|
|
|
Flags uintptr //int32
|
|
|
|
FirstPartyForCookies uintptr //string
|
|
|
|
ResourceType uintptr //int32
|
|
|
|
TransitionType uintptr //int32
|
|
|
|
Identifier uintptr //uint64
|
|
|
|
}
|
|
|
|
|
2023-02-13 21:25:35 +08:00
|
|
|
// request
|
2022-10-04 13:21:05 +08:00
|
|
|
func (m *ICefRequest) IsReadOnly() bool {
|
2022-12-13 23:02:40 +08:00
|
|
|
return api.GoBool(cefRequest_IsReadOnly(uintptr(m.instance)))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefRequest) SetUrl(url string) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetUrl(uintptr(m.instance), url)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefRequest) SetMethod(method string) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetMethod(uintptr(m.instance), method)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefRequest) SetReferrer(referrerUrl string, policy TCefReferrerPolicy) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetReferrer(uintptr(m.instance), referrerUrl, policy)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefRequest) SetFlags(flags TCefUrlRequestFlags) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetFlags(uintptr(m.instance), flags)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (m *ICefRequest) SetFirstPartyForCookies(url string) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetFirstPartyForCookies(uintptr(m.instance), url)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2022-11-02 14:08:04 +08:00
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
func (m *ICefRequest) GetHeaderByName(name string) string {
|
2022-12-13 23:02:40 +08:00
|
|
|
return api.GoStr(cefRequest_GetHeaderByName(uintptr(m.instance), name))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2022-11-02 14:08:04 +08:00
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
func (m *ICefRequest) SetHeaderByName(name, value string, overwrite bool) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetHeaderByName(uintptr(m.instance), name, value, overwrite)
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
2022-11-02 14:08:04 +08:00
|
|
|
|
2022-10-04 13:21:05 +08:00
|
|
|
func (m *ICefRequest) GetHeaderMap() *ICefStringMultiMap {
|
|
|
|
headerMap := &ICefStringMultiMap{}
|
2022-12-13 23:02:40 +08:00
|
|
|
headerMap.instance = cefRequest_GetHeaderMap(uintptr(m.instance))
|
2022-10-04 13:21:05 +08:00
|
|
|
headerMap.ptr = unsafe.Pointer(headerMap.instance)
|
|
|
|
return headerMap
|
|
|
|
}
|
|
|
|
|
2022-11-02 14:08:04 +08:00
|
|
|
func (m *ICefRequest) SetHeaderMap(headerMap *ICefStringMultiMap) {
|
2022-12-13 23:02:40 +08:00
|
|
|
cefRequest_SetHeaderMap(uintptr(m.instance), headerMap.instance)
|
2022-11-02 14:08:04 +08:00
|
|
|
}
|
|
|
|
|
2023-02-13 21:25:35 +08:00
|
|
|
// request
|
2022-10-04 13:21:05 +08:00
|
|
|
func cefRequest_IsReadOnly(instance uintptr) uintptr {
|
2023-02-13 21:25:35 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_cefRequest_IsReadOnly).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetUrl(instance uintptr, url string) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetUrl).Call(instance, api.PascalStr(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetMethod(instance uintptr, method string) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetMethod).Call(instance, api.PascalStr(method))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetReferrer(instance uintptr, referrerUrl string, policy TCefReferrerPolicy) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetReferrer).Call(instance, api.PascalStr(referrerUrl), uintptr(policy))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetFlags(instance uintptr, flags TCefUrlRequestFlags) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetFlags).Call(instance, uintptr(flags))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetFirstPartyForCookies(instance uintptr, url string) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetFirstPartyForCookies).Call(instance, api.PascalStr(url))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_GetHeaderByName(instance uintptr, name string) uintptr {
|
2023-02-13 21:25:35 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_cefRequest_GetHeaderByName).Call(instance, api.PascalStr(name))
|
2022-10-04 13:21:05 +08:00
|
|
|
return r1
|
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_SetHeaderByName(instance uintptr, url, value string, overwrite bool) {
|
2023-02-13 21:25:35 +08:00
|
|
|
imports.Proc(internale_cefRequest_SetHeaderByName).Call(instance, api.PascalStr(url), api.PascalStr(value), api.PascalBool(overwrite))
|
2022-10-04 13:21:05 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func cefRequest_GetHeaderMap(instance uintptr) uintptr {
|
2023-02-13 21:25:35 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_cefRequest_GetHeaderMap).Call(instance)
|
2022-10-04 13:21:05 +08:00
|
|
|
return r1
|
|
|
|
}
|
2022-11-02 14:08:04 +08:00
|
|
|
|
|
|
|
func cefRequest_SetHeaderMap(instance, headerMap uintptr) uintptr {
|
2023-02-13 21:25:35 +08:00
|
|
|
r1, _, _ := imports.Proc(internale_cefRequest_SetHeaderMap).Call(instance, headerMap)
|
2022-11-02 14:08:04 +08:00
|
|
|
return r1
|
|
|
|
}
|