Centralization of Service Compatibility Patches and Refactoring of UTType Compatibility Handling

Commit: 5fe46dfa | 2025-02-11 01:38:22+00:00

← Back to List

Centralization of Service Compatibility Patches and Refactoring of UTType Compatibility Handling

Minor
Commit Hash: 5fe46dfa3dd64487e02d1fa2b26d42bd815d6dfd
Commit Time: 2025-02-11 01:38:22+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission consolidates the macOS service compatibility handling logic, previously scattered across Views and Web (primarily the clipboard/service type determination related to the NSServicesMenuRequestor protocol), into the ui::UTTypeForServicesType utility function, and unifies the compatibility handling between legacy NSPasteboardType strings and modern UTType. Relevant call sites (such as bridged_content_view.mm and render_widget_host_view_cocoa.mm) have been updated to use UTTypeForServicesType for type determination, improving code consistency and future maintainability. Additionally, new UTType-related utility functions and unit tests have been added, and BUILD.gn now includes a dependency on the UniformTypeIdentifiers.framework.

🎯 Impact Analysis

The impact of this change on WebView2Mac is mainly reflected in the modification of the underlying implementation of macOS service (such as clipboard, text services, etc.) type determination logic. Since WebView2Mac directly or indirectly inherits and reuses code related to remote_cocoa’s BridgedContentView and RenderWidgetHostViewCocoa, all service type determinations related to the NSServicesMenuRequestor protocol (such as validRequestorForSendType:returnType:) will now use the new UTType compatibility utility functions. In theory, this enhances compatibility with future macOS versions and reduces the risk of service failures caused by changes in type strings. The actual functional behavior should remain consistent with previous versions, but if downstream code depends on the details of the old type determination implementation, adaptation may be required. Overall, this change is an improvement in underlying compatibility and robustness, and will not affect the main workflow or performance of WebView2Mac, but it is recommended to pay close attention to regression testing of service-related features across both new and old macOS versions.

Impacted Classes:

BridgedContentView RenderWidgetHostViewCocoa NSServicesMenuRequestor(协议实现相关) ui::UTTypeForServicesType(工具函数)