Support disappearance behavior of DPWA download bubble on Mac and optimization of event monitoring mechanism

Commit: dbb2c0ab | 2025-03-25 03:12:48+00:00

← Back to List

Support disappearance behavior of DPWA download bubble on Mac and optimization of event monitoring mechanism

Moderate
Commit Hash: dbb2c0ab53680121837502c6331d375cdbc047cd
Commit Time: 2025-03-25 03:12:48+00:00
Impact Level: Moderate
Generated By: webview2-upstream-sentry
Upstream Review: View Upstream Review 🔗

📋 Summary

This submission relands the feature "Support for DPWA (Desktop Progressive Web App) download bubble dismissal behavior on Mac." The main changes include: renaming key_down_event_monitor_ to local_event_monitor_ in remote_cocoa's NativeWidgetNSWindowBridge, and improving the enable/disable logic for event monitoring; implementing PWA window event monitoring in views::EventMonitorMac via the NativeWidgetMacEventMonitor mechanism, ensuring that event monitoring does not interfere with the normal event propagation chain; and adding special handling for focus changes in related UI components such as DownloadBubblePartialView. This reland also fixes the previous issue where keyboard input failed in PWA fullscreen mode due to event interception, adopting the observer pattern to ensure decoupling between event monitoring and the normal event flow.

🎯 Impact Analysis

1. The impact on WebView2Mac is mainly reflected in the adjustment of the event monitoring mechanism in remote_cocoa::NativeWidgetNSWindowBridge. Since downstream WebView2Mac code is highly dependent on this class, variable renaming (key_down_event_monitor_ → local_event_monitor_) and changes in the implementation details of event monitoring may affect downstream calls to or inheritance of event monitoring-related interfaces. Attention should be paid to whether downstream code directly accesses or overrides relevant members.
2. The new event monitoring mechanism (EventMonitorMac collaborates with remote_cocoa via the NativeWidgetMacEventMonitor::Client interface) enhances the robustness of event handling and reduces interference with the event stream, which helps improve the compatibility and stability of WebView2Mac in PWA scenarios.
3. If downstream code has hardcoded dependencies on the key_down_event_monitor_ name, it should be adapted to local_event_monitor_. In addition, behavioral changes in event monitoring may affect downstream custom event handling logic. It is recommended to focus testing on WebView2Mac’s performance in window events, keyboard input, focus switching, and other scenarios.
4. This change does not involve modifications to remote_cocoa’s Mojo interfaces, core virtual function signatures, or data structures, so the interface compatibility risk for WebView2Mac is low. However, attention should be paid to risks related to implementation detail dependencies.

Impacted Classes:

remote_cocoa::NativeWidgetNSWindowBridge views::EventMonitorMac views::NativeWidgetMacEventMonitor::Client