Support disappearance behavior of DPWA download bubble on Mac and Remote Cocoa event monitoring

Commit: c2e2051b | 2025-03-13 16:37:34+00:00

← Back to List

Support disappearance behavior of DPWA download bubble on Mac and Remote Cocoa event monitoring

Minor
Commit Hash: c2e2051b4796c27327c12de95ad49be9140ae684
Commit Time: 2025-03-13 16:37:34+00:00
Impact Level: Minor
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission primarily implements support for the disappearance behavior of the download bubble in Progressive Web App (PWA) scenarios on Mac. To achieve this, views::EventMonitorMac has been extended to support event monitoring in remote_cocoa scenarios via NativeWidgetMacEventMonitor. Specifically: 1) In remote_cocoa/app_shim/native_widget_ns_window_bridge.h/.mm, the original key_down_event_monitor_ field has been renamed to local_event_monitor_, with proper lifecycle management ensured; 2) In views/event_monitor_mac.h/.mm, EventMonitorMac now implements the NativeWidgetMacEventMonitor::Client interface, and when the target window is detected as remote_cocoa (i.e., PWA scenario), it uses NativeWidgetMacEventMonitor for event monitoring instead of the traditional NSEvent block approach. These changes provide the foundational capability for window event handling and automatic disappearance of the download bubble in Mac PWA scenarios.

🎯 Impact Analysis

The impact of this change on WebView2Mac is mainly reflected in the enhancement of the remote_cocoa event monitoring mechanism. As a downstream implementation of remote_cocoa, if WebView2Mac’s window event monitoring relies on the local event monitoring capabilities of EventMonitorMac or NativeWidgetNSWindowBridge, then the renaming and adjustment of the event monitoring path in this update must ensure compatibility. Since this submission does not modify the Mojo interface of remote_cocoa, the core virtual function signatures, or the main process of window lifecycle management, and only enhances the naming of event monitoring fields and the event dispatch mechanism, the direct impact on WebView2Mac is minimal. The only point to note is that if downstream WebView2Mac code directly accesses the key_down_event_monitor_ field, the field name should be updated to local_event_monitor_ accordingly. In addition, the enhancement of the event monitoring mechanism will help support more complex event handling in future PWA/Remote Cocoa scenarios, which is a positive improvement for downstream.

Impacted Classes:

remote_cocoa::NativeWidgetNSWindowBridge views::EventMonitorMac views::NativeWidgetMacEventMonitor views::NativeWidgetMacNSWindowHost