views: mac: Fix overlay association with host CefWindow (fixes #3456)

This commit is contained in:
Marshall Greenblatt
2023-04-14 12:58:21 -04:00
parent cad2498d87
commit 17cab6d955
6 changed files with 41 additions and 26 deletions

View File

@@ -20,11 +20,6 @@
#include "ui/display/win/screen_win.h"
#endif
#if defined(USE_AURA)
#include "ui/aura/window.h"
#include "ui/views/view_constants_aura.h"
#endif
namespace view_util {
namespace {
@@ -169,17 +164,12 @@ void ResumeOwnership(CefRefPtr<CefView> view) {
CefRefPtr<CefWindow> GetWindowFor(views::Widget* widget) {
CefRefPtr<CefWindow> window;
#if defined(USE_AURA)
// Retrieve the parent Widget for an overlay.
// If |widget| is an overlay, retrieve the host Widget.
if (widget) {
// See matching logic in CefOverlayViewHost::Init.
auto widget_view =
widget->GetNativeView()->GetProperty(views::kHostViewKey);
if (widget_view) {
if (auto widget_view = GetHostView(widget)) {
widget = widget_view->GetWidget();
}
}
#endif // defined(USE_AURA)
if (widget) {
// The views::WidgetDelegate should be a CefWindowView and |content_view|