From fae603dd30891888f0ec5538a045fcfc6fbc2375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E7=BA=A2=E5=B2=A9?= Date: Wed, 25 Oct 2023 21:28:50 +0800 Subject: [PATCH] CEF 117 --- cef/events-def.go | 2 ++ cef/internal/def/proc-def-index.go | 2 ++ cef/internal/def/proc-def.go | 2 ++ cef/types-window-component.go | 17 +++++++++++++++ cef/types.go | 9 ++++---- consts/consts.go | 35 ++++++++++++++++++++++++++++++ 6 files changed, 63 insertions(+), 4 deletions(-) diff --git a/cef/events-def.go b/cef/events-def.go index 9256c905..23aafa4a 100644 --- a/cef/events-def.go +++ b/cef/events-def.go @@ -215,6 +215,8 @@ type WindowComponentOnGetParentWindow func(sender lcl.IObject, window *ICefWindo type WindowComponentOnGetInitialBounds func(sender lcl.IObject, window *ICefWindow, aResult *TCefRect) type WindowComponentOnGetInitialShowState func(sender lcl.IObject, window *ICefWindow, aResult *consts.TCefShowState) type WindowComponentOnIsFrameless func(sender lcl.IObject, window *ICefWindow, aResult *bool) +type WindowComponentOnWithStandardWindowButtons func(sender lcl.IObject, window *ICefWindow, aResult *bool) +type WindowComponentOnGetTitleBarHeight func(sender lcl.IObject, window *ICefWindow, titleBarHeight float32, aResult *bool) type WindowComponentOnCanResize func(sender lcl.IObject, window *ICefWindow, aResult *bool) type WindowComponentOnCanMaximize func(sender lcl.IObject, window *ICefWindow, aResult *bool) type WindowComponentOnCanMinimize func(sender lcl.IObject, window *ICefWindow, aResult *bool) diff --git a/cef/internal/def/proc-def-index.go b/cef/internal/def/proc-def-index.go index 0ce26c49..745e05c7 100644 --- a/cef/internal/def/proc-def-index.go +++ b/cef/internal/def/proc-def-index.go @@ -1189,6 +1189,8 @@ const ( CEFWindowComponent_SetOnGetInitialBounds CEFWindowComponent_SetOnGetInitialShowState CEFWindowComponent_SetOnIsFrameless + CEFWindowComponent_SetOnWithStandardWindowButtons + CEFWindowComponent_SetOnGetTitlebarHeight CEFWindowComponent_SetOnCanResize CEFWindowComponent_SetOnCanMaximize CEFWindowComponent_SetOnCanMinimize diff --git a/cef/internal/def/proc-def.go b/cef/internal/def/proc-def.go index 8df4cd06..528085e7 100644 --- a/cef/internal/def/proc-def.go +++ b/cef/internal/def/proc-def.go @@ -1189,6 +1189,8 @@ func init() { dllimports.NewEnergyImport("CEFWindowComponent_SetOnGetInitialBounds", 0), dllimports.NewEnergyImport("CEFWindowComponent_SetOnGetInitialShowState", 0), dllimports.NewEnergyImport("CEFWindowComponent_SetOnIsFrameless", 0), + dllimports.NewEnergyImport("CEFWindowComponent_SetOnWithStandardWindowButtons", 0), + dllimports.NewEnergyImport("CEFWindowComponent_SetOnGetTitlebarHeight", 0), dllimports.NewEnergyImport("CEFWindowComponent_SetOnCanResize", 0), dllimports.NewEnergyImport("CEFWindowComponent_SetOnCanMaximize", 0), dllimports.NewEnergyImport("CEFWindowComponent_SetOnCanMinimize", 0), diff --git a/cef/types-window-component.go b/cef/types-window-component.go index 32bbe9f6..d872dae1 100644 --- a/cef/types-window-component.go +++ b/cef/types-window-component.go @@ -571,6 +571,14 @@ func (m *TCEFWindowComponent) SetOnIsFrameless(fn WindowComponentOnIsFrameless) imports.Proc(def.CEFWindowComponent_SetOnIsFrameless).Call(m.Instance(), api.MakeEventDataPtr(fn)) } +func (m *TCEFWindowComponent) SetOnWithStandardWindowButtons(fn WindowComponentOnWithStandardWindowButtons) { + imports.Proc(def.CEFWindowComponent_SetOnWithStandardWindowButtons).Call(m.Instance(), api.MakeEventDataPtr(fn)) +} + +func (m *TCEFWindowComponent) SetOnGetTitleBarHeight(fn WindowComponentOnGetTitleBarHeight) { + imports.Proc(def.CEFWindowComponent_SetOnGetTitlebarHeight).Call(m.Instance(), api.MakeEventDataPtr(fn)) +} + // SetOnCanResize 设置窗口是否允许调整大小回调事件 func (m *TCEFWindowComponent) SetOnCanResize(fn WindowComponentOnCanResize) { imports.Proc(def.CEFWindowComponent_SetOnCanResize).Call(m.Instance(), api.MakeEventDataPtr(fn)) @@ -646,6 +654,15 @@ func init() { sender := getPtr(0) window := getPtr(1) fn.(WindowComponentOnIsFrameless)(lcl.AsObject(sender), &ICefWindow{instance: window}, (*bool)(getPtr(2))) + case WindowComponentOnWithStandardWindowButtons: + sender := getPtr(0) + window := getPtr(1) + fn.(WindowComponentOnWithStandardWindowButtons)(lcl.AsObject(sender), &ICefWindow{instance: window}, (*bool)(getPtr(2))) + case WindowComponentOnGetTitleBarHeight: + sender := getPtr(0) + window := getPtr(1) + titleBarHeight := *(*float32)(getPtr(2)) + fn.(WindowComponentOnGetTitleBarHeight)(lcl.AsObject(sender), &ICefWindow{instance: window}, titleBarHeight, (*bool)(getPtr(3))) case WindowComponentOnCanResize: sender := getPtr(0) window := getPtr(1) diff --git a/cef/types.go b/cef/types.go index 7657a414..e5a125af 100644 --- a/cef/types.go +++ b/cef/types.go @@ -1186,10 +1186,11 @@ type TCefPopupFeatures struct { WidthSet int32 Height int32 HeightSet int32 - MenuBarVisible int32 - StatusBarVisible int32 - ToolBarVisible int32 - ScrollbarsVisible int32 + MenuBarVisible int32 // ~ CEF 109 + StatusBarVisible int32 // ~ CEF 109 + ToolBarVisible int32 // ~ CEF 109 + ScrollbarsVisible int32 // ~ CEF 109 + IsPopup int32 // CEF 110 ~ Current :True (1) if browser interface elements should be hidden. } // /include/internal/cef_types.h (cef_composition_underline_t) diff --git a/consts/consts.go b/consts/consts.go index 4e0b36b5..f72f406a 100644 --- a/consts/consts.go +++ b/consts/consts.go @@ -1683,3 +1683,38 @@ const ( LpsHttps // https //LpsTcp // tcp ) + +/// +/// Permission types used with OnShowPermissionPrompt. Some types are +/// platform-specific or only supported with the Chrome runtime. Should be kept +/// in sync with Chromium's permissions::RequestType type. +/// +/// +/// TCefPermissionRequestTypes values. +/// CEF source file: /include/internal/cef_types.h (cef_permission_request_types_t) +/// +type TCefPermissionRequestTypes = int32 + +const ( + CEF_PERMISSION_TYPE_NONE TCefPermissionRequestTypes = 0 + CEF_PERMISSION_TYPE_ACCESSIBILITY_EVENTS TCefPermissionRequestTypes = 1 << 0 + CEF_PERMISSION_TYPE_AR_SESSION TCefPermissionRequestTypes = 1 << 1 + CEF_PERMISSION_TYPE_CAMERA_PAN_TILT_ZOOM TCefPermissionRequestTypes = 1 << 2 + CEF_PERMISSION_TYPE_CAMERA_STREAM TCefPermissionRequestTypes = 1 << 3 + CEF_PERMISSION_TYPE_CLIPBOARD TCefPermissionRequestTypes = 1 << 4 + CEF_PERMISSION_TYPE_TOP_LEVEL_STORAGE_ACCESS TCefPermissionRequestTypes = 1 << 5 + CEF_PERMISSION_TYPE_DISK_QUOTA TCefPermissionRequestTypes = 1 << 6 + CEF_PERMISSION_TYPE_LOCAL_FONTS TCefPermissionRequestTypes = 1 << 7 + CEF_PERMISSION_TYPE_GEOLOCATION TCefPermissionRequestTypes = 1 << 8 + CEF_PERMISSION_TYPE_IDLE_DETECTION TCefPermissionRequestTypes = 1 << 9 + CEF_PERMISSION_TYPE_MIC_STREAM TCefPermissionRequestTypes = 1 << 10 + CEF_PERMISSION_TYPE_MIDI TCefPermissionRequestTypes = 1 << 11 + CEF_PERMISSION_TYPE_MIDI_SYSEX TCefPermissionRequestTypes = 1 << 12 + CEF_PERMISSION_TYPE_MULTIPLE_DOWNLOADS TCefPermissionRequestTypes = 1 << 13 + CEF_PERMISSION_TYPE_NOTIFICATIONS TCefPermissionRequestTypes = 1 << 14 + CEF_PERMISSION_TYPE_PROTECTED_MEDIA_IDENTIFIER TCefPermissionRequestTypes = 1 << 15 + CEF_PERMISSION_TYPE_REGISTER_PROTOCOL_HANDLER TCefPermissionRequestTypes = 1 << 16 + CEF_PERMISSION_TYPE_STORAGE_ACCESS TCefPermissionRequestTypes = 1 << 17 + CEF_PERMISSION_TYPE_VR_SESSION TCefPermissionRequestTypes = 1 << 18 + CEF_PERMISSION_TYPE_WINDOW_MANAGEMENT TCefPermissionRequestTypes = 1 << 19 +)