diff --git a/v3/pkg/application/options_webview_window_win.go b/v3/pkg/application/options_webview_window_win.go index 4478cd7c3d2..3eab5fa0c97 100644 --- a/v3/pkg/application/options_webview_window_win.go +++ b/v3/pkg/application/options_webview_window_win.go @@ -95,6 +95,9 @@ type WindowsWindow struct { // Drag Cursor Effects OnEnterEffect DragEffect OnOverEffect DragEffect + + // Permissions map for WebView2. If empty, default permissions will be granted. + Permissions map[edge.CoreWebView2PermissionKind]edge.CoreWebView2PermissionState } type Theme int diff --git a/v3/pkg/application/webview_window_windows.go b/v3/pkg/application/webview_window_windows.go index 0195f3db1a1..ca55e53fc04 100644 --- a/v3/pkg/application/webview_window_windows.go +++ b/v3/pkg/application/webview_window_windows.go @@ -1306,6 +1306,12 @@ func (w *windowsWebviewWindow) setupChromium() { chromium.AdditionalBrowserArgs = append(chromium.AdditionalBrowserArgs, arg) } + if opts.Permissions != nil { + for permission, state := range opts.Permissions { + chromium.SetPermission(permission, state) + } + } + chromium.MessageCallback = w.processMessage chromium.MessageWithAdditionalObjectsCallback = w.processMessageWithAdditionalObjects chromium.WebResourceRequestedCallback = w.processRequest