Update browser_view.cc

This commit is contained in:
Alexander David Frick 2022-08-03 16:44:17 -05:00 committed by GitHub
parent 070b8849c8
commit 0b2e2e3e59
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3126,6 +3126,9 @@ BrowserView::GetNativeViewHostsForTopControlsSlide() const {
}
void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
overlay_view_->SetVisible(false);
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
@ -3343,16 +3346,12 @@ views::View* BrowserView::CreateOverlayView() {
#if BUILDFLAG(IS_MAC)
views::View* BrowserView::CreateMacOverlayView() {
views::Widget::InitParams params;
// Keep around overlay_widget_ and overlay_view_ until this
// BrowserView is deconstructed. overlay_view_ is used during BrowserView
// deconstruction.
// TODO(bur): Refactor usage of WIDGET_OWNS_NATIVE_WIDGET.
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
params.type = views::Widget::InitParams::TYPE_POPUP;
params.child = true;
params.parent = GetWidget()->GetNativeView();
overlay_widget_ = std::make_unique<ThemeCopyingWidget>(GetWidget());
overlay_widget_ = new ThemeCopyingWidget(GetWidget());
overlay_widget_->Init(std::move(params));
overlay_widget_->SetNativeWindowProperty(kBrowserViewKey, this);
std::unique_ptr<TopContainerOverlayView> overlay_view =
std::make_unique<TopContainerOverlayView>(weak_ptr_factory_.GetWeakPtr());