feat: add multi BrowserView support to BrowserWindow (#16148)
* feat: add multi BrowserView support to BrowserWindow Add functions addBrowserView, removeBroserView, getBrowserViews to BrowserWindow class. Existing API as setBrowserView and getBrowserView code replaced to use new api inside. * fix: for lint and osx compile errors * fix: lint error in test code * feat: add multi BrowserView support to BrowserWindow Add functions addBrowserView, removeBroserView, getBrowserViews to BrowserWindow class. Existing API as setBrowserView and getBrowserView code replaced to use new api inside. * fix: for lint and osx compile errors * fix: lint error in test code * fix: method to be accessible on mac api impl * fix: missed function declarations for mac impl * fix: use base class reset function
This commit is contained in:
parent
18ca4b6a3a
commit
5ae3d1a1b2
12 changed files with 244 additions and 74 deletions
|
@ -1069,22 +1069,16 @@ void NativeWindowMac::SetContentProtection(bool enable) {
|
|||
setSharingType:enable ? NSWindowSharingNone : NSWindowSharingReadOnly];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetBrowserView(NativeBrowserView* view) {
|
||||
void NativeWindowMac::AddBrowserView(NativeBrowserView* view) {
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
if (browser_view()) {
|
||||
[browser_view()->GetInspectableWebContentsView()->GetNativeView()
|
||||
removeFromSuperview];
|
||||
set_browser_view(nullptr);
|
||||
}
|
||||
|
||||
if (!view) {
|
||||
[CATransaction commit];
|
||||
return;
|
||||
}
|
||||
|
||||
set_browser_view(view);
|
||||
add_browser_view(view);
|
||||
auto* native_view = view->GetInspectableWebContentsView()->GetNativeView();
|
||||
[[window_ contentView] addSubview:native_view
|
||||
positioned:NSWindowAbove
|
||||
|
@ -1094,6 +1088,21 @@ void NativeWindowMac::SetBrowserView(NativeBrowserView* view) {
|
|||
[CATransaction commit];
|
||||
}
|
||||
|
||||
void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
|
||||
[CATransaction begin];
|
||||
[CATransaction setDisableActions:YES];
|
||||
|
||||
if (!view) {
|
||||
[CATransaction commit];
|
||||
return;
|
||||
}
|
||||
|
||||
[view->GetInspectableWebContentsView()->GetNativeView() removeFromSuperview];
|
||||
remove_browser_view(view);
|
||||
|
||||
[CATransaction commit];
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
|
||||
InternalSetParentWindow(parent, IsVisible());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue