mac: chrome: Fix crash in BrowserView::ShouldHideUIForFullscreen (fixes #3527)

This commit is contained in:
Marshall Greenblatt 2023-06-06 12:03:15 +03:00
parent 6355aaf33b
commit cbdda6b03b

View File

@ -371,7 +371,7 @@ index 795f057fedc51..54b08509919af 100644
BrowserFrame(const BrowserFrame&) = delete;
BrowserFrame& operator=(const BrowserFrame&) = delete;
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
index 39a1660cae03a..f7d7965989cf7 100644
index 39a1660cae03a..0faf50eb14298 100644
--- chrome/browser/ui/views/frame/browser_view.cc
+++ chrome/browser/ui/views/frame/browser_view.cc
@@ -314,11 +314,10 @@ using content::NativeWebKeyboardEvent;
@ -439,7 +439,24 @@ index 39a1660cae03a..f7d7965989cf7 100644
contents_separator_ =
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
@@ -1817,6 +1833,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
@@ -1087,12 +1103,14 @@ gfx::Size BrowserView::GetWebAppFrameToolbarPreferredSize() const {
#if BUILDFLAG(IS_MAC)
bool BrowserView::UsesImmersiveFullscreenMode() const {
+ if (!base::FeatureList::IsEnabled(features::kImmersiveFullscreen)) {
+ return false;
+ }
const bool is_pwa =
base::FeatureList::IsEnabled(features::kImmersiveFullscreenPWAs) &&
GetIsWebAppType();
const bool is_tabbed_window = GetSupportsTabStrip();
- return base::FeatureList::IsEnabled(features::kImmersiveFullscreen) &&
- (is_pwa || is_tabbed_window);
+ return is_pwa || is_tabbed_window;
}
bool BrowserView::UsesImmersiveFullscreenTabbedMode() const {
@@ -1817,6 +1835,8 @@ bool BrowserView::ShouldHideUIForFullscreen() const {
if (immersive_mode_controller_->IsEnabled())
return false;
@ -448,7 +465,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
return frame_->GetFrameView()->ShouldHideTopUIForFullscreen();
}
@@ -2722,7 +2740,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
@@ -2722,7 +2742,8 @@ DownloadShelf* BrowserView::GetDownloadShelf() {
}
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
@ -458,7 +475,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
if (auto* download_button = toolbar_button_provider_->GetDownloadButton())
return download_button->bubble_controller();
return nullptr;
@@ -3222,7 +3241,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
@@ -3222,7 +3243,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
if (top_container()->parent() == this)
return;
@ -468,7 +485,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
top_container()->DestroyLayer();
AddChildViewAt(top_container(), 0);
EnsureFocusOrder();
@@ -3776,8 +3796,10 @@ void BrowserView::Layout() {
@@ -3776,8 +3798,10 @@ void BrowserView::Layout() {
// TODO(jamescook): Why was this in the middle of layout code?
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
@ -481,7 +498,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
// Some of the situations when the BrowserView is laid out are:
// - Enter/exit immersive fullscreen mode.
@@ -3843,6 +3865,11 @@ void BrowserView::AddedToWidget() {
@@ -3843,6 +3867,11 @@ void BrowserView::AddedToWidget() {
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
#endif
@ -493,7 +510,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
toolbar_->Init();
// TODO(pbos): Investigate whether the side panels should be creatable when
@@ -3889,13 +3916,9 @@ void BrowserView::AddedToWidget() {
@@ -3889,13 +3918,9 @@ void BrowserView::AddedToWidget() {
EnsureFocusOrder();
@ -509,7 +526,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
using_native_frame_ = frame_->ShouldUseNativeFrame();
MaybeInitializeWebUITabStrip();
@@ -4300,7 +4323,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
@@ -4300,7 +4325,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen,
// Undo our anti-jankiness hacks and force a re-layout.
in_process_fullscreen_ = false;
ToolbarSizeChanged(false);
@ -519,7 +536,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
}
bool BrowserView::ShouldUseImmersiveFullscreenForUrl(const GURL& url) const {
@@ -4671,6 +4695,8 @@ Profile* BrowserView::GetProfile() {
@@ -4671,6 +4697,8 @@ Profile* BrowserView::GetProfile() {
}
void BrowserView::UpdateUIForTabFullscreen() {
@ -528,7 +545,7 @@ index 39a1660cae03a..f7d7965989cf7 100644
frame()->GetFrameView()->UpdateFullscreenTopUI();
}
@@ -4693,6 +4719,8 @@ void BrowserView::HideDownloadShelf() {
@@ -4693,6 +4721,8 @@ void BrowserView::HideDownloadShelf() {
}
bool BrowserView::CanUserExitFullscreen() const {