Skip to content

Commit

Permalink
[windows] support permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
leaanthony committed Oct 23, 2023
1 parent ff08a5c commit e661052
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions v3/pkg/application/options_webview_window_win.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions v3/pkg/application/webview_window_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e661052

Please sign in to comment.