WebShare: Improve behavior when sharing URLs on Mac

Commit: 501230de | 2025-08-04 21:37:51+00:00

← Back to List

WebShare: Improve behavior when sharing URLs on Mac

Moderate
Commit Hash: 501230de9edf46814f9030d5f35ee3c6b3bc9d0b
Commit Time: 2025-08-04 21:37:51+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission mainly improves the WebShare functionality on the macOS platform by changing the URL parameter type from string to GURL. The main changes include: 1) Modifying the ShowSharingServicePicker interface and related implementations, changing the URL parameter from const std::string& to const GURL&; 2) In the Mojo interface definition, changing the URL type from string to url.mojom.Url; 3) In the actual implementation, improving the handling of URLs by no longer simply passing the URL as an NSString to the macOS sharing picker, but instead adopting a WebKit-like approach to handle metadata internally, thereby avoiding the macOS sharing picker from immediately fetching URL metadata upon opening; 4) Optimizing the sharing code to avoid including empty data items.

🎯 Impact Analysis

This change has a moderate impact on WebView2Mac. As a core impact, the method signature of ShowSharingServicePicker in the RenderWidgetHostNSViewBridge class has been modified, which is one of the key interfaces in remote_cocoa. Specific impacts include: 1) Interface signature change: the URL parameter type of the ShowSharingServicePicker method has changed from const std::string& to const GURL&, which will affect all code that calls this method; 2) Mojo interface change: the interface definition in render_widget_host_ns_view.mojom has changed, requiring regeneration of the Mojo binding code; 3) If WebView2Mac has any custom implementations of RenderWidgetHostNSViewBridge or inherits from this class, the corresponding method signatures need to be updated; 4) If WebView2Mac calls ShowSharePicker-related functionality, it must ensure that a GURL object is passed instead of a string. Overall, this is an interface-level change that mainly affects build compatibility, but does not alter core functional logic.

Impacted Classes:

remote_cocoa::RenderWidgetHostNSViewBridge remote_cocoa::mojom::RenderWidgetHostNSView content::RenderWidgetHostView content::RenderWidgetHostViewMac content::RenderWidgetHostViewChildFrame