fix: handle nullish WebContentsView in UpdateDraggableRegions (#30556)

* fix: handle nullish WebContentsView in UpdateDraggableRegions

* build: nogncheck on webcontentsimpl include
This commit is contained in:
Samuel Attard 2021-08-16 23:29:49 -07:00 committed by GitHub
parent 93d7968d64
commit 7cdd132d18
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@
#include "shell/browser/api/electron_api_browser_window.h" #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 "shell/browser/native_window_views.h"
#include "ui/aura/window.h" #include "ui/aura/window.h"
@ -17,8 +18,10 @@ void BrowserWindow::UpdateDraggableRegions(
return; return;
if (&draggable_regions_ != &regions) { if (&draggable_regions_ != &regions) {
auto* nv = web_contents()->GetNativeView(); auto* view =
if (nv) { static_cast<content::WebContentsImpl*>(web_contents())->GetView();
if (view) {
const gfx::NativeView nv = view->GetNativeView();
auto const offset = nv->GetBoundsInRootWindow(); auto const offset = nv->GetBoundsInRootWindow();
auto snapped_regions = mojo::Clone(regions); auto snapped_regions = mojo::Clone(regions);
for (auto& snapped_region : snapped_regions) { for (auto& snapped_region : snapped_regions) {