From 22b98cf390dc324eb190bb9c746d239f5f8e374f Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 19 Aug 2021 10:39:13 +0900 Subject: [PATCH] fix: handle nullish WebContentsView in UpdateDraggableRegions (#30559) * fix: handle nullish WebContentsView in UpdateDraggableRegions * build: nogncheck on webcontentsimpl include Co-authored-by: Samuel Attard --- shell/browser/api/electron_api_browser_window_views.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/browser/api/electron_api_browser_window_views.cc b/shell/browser/api/electron_api_browser_window_views.cc index a43b42814f236..fb96705ee32a7 100644 --- a/shell/browser/api/electron_api_browser_window_views.cc +++ b/shell/browser/api/electron_api_browser_window_views.cc @@ -4,6 +4,7 @@ #include "shell/browser/api/electron_api_browser_window.h" +#include "content/browser/web_contents/web_contents_impl.h" // nogncheck #include "shell/browser/native_window_views.h" #include "ui/aura/window.h" @@ -17,8 +18,10 @@ void BrowserWindow::UpdateDraggableRegions( return; if (&draggable_regions_ != ®ions) { - auto* nv = web_contents()->GetNativeView(); - if (nv) { + auto* view = + static_cast(web_contents())->GetView(); + if (view) { + const gfx::NativeView nv = view->GetNativeView(); auto const offset = nv->GetBoundsInRootWindow(); auto snapped_regions = mojo::Clone(regions); for (auto& snapped_region : snapped_regions) {