Skip to content

Commit

Permalink
refactor: rename managed_web_contents to inspectable_web_contents (#2…
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Nov 17, 2020
1 parent 29211a5 commit b8372fd
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 83 deletions.
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_browser_view.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ BrowserView::BrowserView(gin::Arguments* args,
Observe(web_contents->web_contents());

view_.reset(
NativeBrowserView::Create(api_web_contents_->managed_web_contents()));
NativeBrowserView::Create(api_web_contents_->inspectable_web_contents()));
}

BrowserView::~BrowserView() {
Expand Down
3 changes: 2 additions & 1 deletion shell/browser/api/electron_api_browser_window.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ BrowserWindow::BrowserWindow(gin::Arguments* args,
SetContentView(gin::CreateHandle<View>(isolate, web_contents_view.get()));

#if defined(OS_MAC)
OverrideNSWindowContentView(web_contents->managed_web_contents());
OverrideNSWindowContentView(
web_contents->inspectable_web_contents()->GetView());
#endif

// Init window after everything has been setup.
Expand Down
2 changes: 1 addition & 1 deletion shell/browser/api/electron_api_browser_window.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class BrowserWindow : public BaseWindow,

private:
#if defined(OS_MAC)
void OverrideNSWindowContentView(InspectableWebContents* iwc);
void OverrideNSWindowContentView(InspectableWebContentsView* webView);
#endif

// Helpers.
Expand Down
5 changes: 3 additions & 2 deletions shell/browser/api/electron_api_browser_window_mac.mm
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@

namespace api {

void BrowserWindow::OverrideNSWindowContentView(InspectableWebContents* iwc) {
void BrowserWindow::OverrideNSWindowContentView(
InspectableWebContentsView* view) {
// Make NativeWindow use a NSView as content view.
static_cast<NativeWindowMac*>(window())->OverrideNSWindowContentView();
// Add webview to contentView.
NSView* webView = iwc->GetView()->GetNativeView().GetNativeNSView();
NSView* webView = view->GetNativeView().GetNativeNSView();
NSView* contentView =
[window()->GetNativeWindow().GetNativeNSWindow() contentView];
[webView setFrame:[contentView bounds]];
Expand Down

0 comments on commit b8372fd

Please sign in to comment.