From 4a7c85f43e171a80a31d5ce65285c72015ea00fc Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Mon, 16 Jul 2018 10:20:35 +0900 Subject: [PATCH] fix: use InspectableWebContentsView as content view --- atom/browser/api/atom_api_browser_window.cc | 2 +- atom/browser/api/atom_api_browser_window.h | 2 +- atom/browser/api/atom_api_browser_window_mac.mm | 6 ++++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index 0e71c040066e..0c1ba8cbc098 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -87,7 +87,7 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate, #if defined(OS_MACOSX) if (!window()->has_frame()) - OverrideNSWindowContentView(); + OverrideNSWindowContentView(web_contents->managed_web_contents()); #endif // Init window after everything has been setup. diff --git a/atom/browser/api/atom_api_browser_window.h b/atom/browser/api/atom_api_browser_window.h index e07cd3987dd0..f1cbf4733b81 100644 --- a/atom/browser/api/atom_api_browser_window.h +++ b/atom/browser/api/atom_api_browser_window.h @@ -81,7 +81,7 @@ class BrowserWindow : public TopLevelWindow, private: #if defined(OS_MACOSX) - void OverrideNSWindowContentView(); + void OverrideNSWindowContentView(brightray::InspectableWebContents* iwc); #endif // Helpers. diff --git a/atom/browser/api/atom_api_browser_window_mac.mm b/atom/browser/api/atom_api_browser_window_mac.mm index dfcbfafea7f2..f6238ee8167e 100644 --- a/atom/browser/api/atom_api_browser_window_mac.mm +++ b/atom/browser/api/atom_api_browser_window_mac.mm @@ -10,6 +10,7 @@ #include "atom/browser/native_window_mac.h" #include "atom/common/draggable_region.h" #include "base/mac/scoped_nsobject.h" +#include "brightray/browser/inspectable_web_contents_view.h" @interface NSView (WebContentsView) - (void)setMouseDownCanMoveWindow:(BOOL)can_move; @@ -54,11 +55,12 @@ std::vector CalculateNonDraggableRegions( } // namespace -void BrowserWindow::OverrideNSWindowContentView() { +void BrowserWindow::OverrideNSWindowContentView( + brightray::InspectableWebContents* iwc) { // Make NativeWindow use a NSView as content view. static_cast(window())->OverrideNSWindowContentView(); // Add webview to contentView. - NSView* webView = web_contents()->GetNativeView(); + NSView* webView = iwc->GetView()->GetNativeView(); NSView* contentView = [window()->GetNativeWindow() contentView]; [webView setFrame:[contentView bounds]]; [contentView addSubview:webView];