Introduce ui::ClipboardUrlInfo struct to support multi-URL drag-and-drop functionality
Moderate
Commit Hash:
b92640e203e6e4eb90257d87c9fa2d55ae326e8c
Commit Time: 2025-10-24 23:58:15+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review:
View Upstream Review 🔗
📋 Summary
This submission introduces a new ui::ClipboardUrlInfo struct to support the functionality of dragging multiple URLs. The main changes include: 1) Addition of the ui::ClipboardUrlInfo struct, which contains url and title fields; 2) Replacement of the original single url and url_title fields in content::DropData with a url_infos vector; 3) Updating all related code to adapt to the new data structure, including the remote_cocoa-related web_drag_source_mac.mm and web_drag_dest_mac.mm files; 4) During data transfer, multiple URLs are merged into a single string conforming to the text/uri-list MIME type format (using CRLF as the separator); 5) For backward compatibility, most existing code still uses the first URL (front()) to maintain consistent behavior.
🎯 Impact Analysis
This change has a moderate impact on WebView2Mac. The main impacts include: 1) **Data Structure Change**: The core fields of DropData are changed from a single url/url_title to a url_infos vector, which is a structural change; 2) **Remote Cocoa Interface Impact**: The drag source logic in web_drag_source_mac.mm needs to adapt to the new structure, changing from _dropData.url.is_valid() to !_dropData.url_infos.empty(), and from _dropData.url to _dropData.url_infos.front().url; 3) **IPC Serialization Change**: The IPC structure trait definitions in common_param_traits_macros.h are changed, which may affect inter-process communication; 4) **Drag-and-Drop Functionality Compatibility**: Although the existing code maintains compatibility by using the first URL, if WebView2Mac has custom drag-and-drop handling logic, corresponding updates may be required; 5) **Potential Compilation Risks**: If downstream WebView2Mac code directly accesses the DropData::url or DropData::url_title fields, compilation errors will occur. Overall, this is a significant structural change and requires careful assessment of the compatibility of related WebView2Mac code.
Impacted Classes:
content::DropData
ui::ClipboardUrlInfo
WebDragSource (web_drag_source_mac.mm)
content::PopulateDropDataFromPasteboard
content::DropContext