Fix download drag and drop for PWA by adding BeginFileDrag Mojo interface for cross-process drag initiation

Commit: f36a3d19 | 2026-02-05 00:21:30

← Back to List

Fix download drag and drop for PWA by adding BeginFileDrag Mojo interface for cross-process drag initiation

Minor
Commit Hash: f36a3d19aa90f050b6b8a94ad7e1e00d94ce7fad
Commit Time: 2026-02-05 00:21:30
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This commit fixes download file drag-and-drop failing in PWA windows on macOS. The issue was that PWA windows run in a separate app shim process, and the previous DragDownloadItem() called beginDraggingSessionWithItems directly on the local NSView, which doesn't work for remote windows. Changes include: a new FileDragData struct and BeginFileDrag() Mojo interface in NativeWidgetNSWindow.mojom; BeginFileDrag() implementation in NativeWidgetNSWindowBridge that performs the actual drag via bridged_view_ in the app shim process; DragDownloadItem() refactored to use NativeWidgetMacNSWindowHost::GetNSWindowMojo() for drag initiation, working for both in-process and out-of-process scenarios. The old DragDownloadItemSource ObjC class is removed.

🎯 Impact Analysis

This change has minor direct impact on WebView2Mac. The new BeginFileDrag Mojo interface is added to NativeWidgetNSWindow.mojom, and Edge downstream's HostingNSWindowBridge inherits from NativeWidgetNSWindowBridge which implements this Mojo interface. Since BeginFileDrag is a newly added method with no downstream override, WebView2Mac will directly inherit the upstream base class implementation. However, as an embedded WebView control, WebView2Mac typically does not involve browser download shelf drag operations (DragDownloadItem resides in chrome/browser/download/, which is the Chrome browser layer rather than the content layer), so this code path is unlikely to be triggered in WebView2Mac scenarios. The Mojo interface change affects the IPC protocol but is purely additive (backward compatible). No downstream patch is needed.

Impacted Classes:

remote_cocoa::NativeWidgetNSWindowBridge remote_cocoa::mojom::NativeWidgetNSWindow remote_cocoa::mojom::FileDragData embedded_browser_webview::HostingNSWindowBridge