From 0b4f8d3a37e57647c158efce0c1dfa514287a389 Mon Sep 17 00:00:00 2001 From: Max Karolinskiy Date: Tue, 5 May 2026 15:58:09 -0400 Subject: [PATCH] [cr149] `UnloadHandler` as `UnownedData` Chromium changes: https://chromium.googlesource.com/chromium/src/+/beaae0fe841a3830d1f23fbe2579955d159a02cf commit beaae0fe841a3830d1f23fbe2579955d159a02cf Author: Thomas Lukaszewicz Date: Sun May 3 11:52:41 2026 -0700 [bedrock] Rehome UnloadHandler to BrowserWindowFeatures There is no intended behavior change in this CL. Future CLs will further refactor Browser methods to call the UnloadHandler directly. Bug: 502745808 Change-Id: I00d39b8c0a61ac3541465420bd9c6fb121a4fcbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7805864 Commit-Queue: Thomas Lukaszewicz Reviewed-by: Allen Bauer Cr-Commit-Position: refs/heads/main@{#1624444} [cr149][WIP] Fixes not opening new tab on closing last tab. We were relying on the order of notifications for TabStripEmpty to call UnloadController before BraveBrowser and using the state of UnloadController to make the decision on closing the window. With the upstream change below the order is now reversed, but it's unclear to me why we need to rely on UnloadController here since it's the same notification. Chromium changes: https://chromium.googlesource.com/chromium/src/+/beaae0fe841a3830d1f23fbe2579955d159a02cf commit beaae0fe841a3830d1f23fbe2579955d159a02cf Author: Thomas Lukaszewicz Date: Sun May 3 11:52:41 2026 -0700 [bedrock] Rehome UnloadHandler to BrowserWindowFeatures There is no intended behavior change in this CL. Future CLs will further refactor Browser methods to call the UnloadHandler directly. Bug: 502745808 Change-Id: I00d39b8c0a61ac3541465420bd9c6fb121a4fcbc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7805864 Commit-Queue: Thomas Lukaszewicz Reviewed-by: Allen Bauer Cr-Commit-Position: refs/heads/main@{#1624444} --- browser/ui/brave_browser.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/ui/brave_browser.cc b/browser/ui/brave_browser.cc index 5402ca7b6ba..4597ab13604 100644 --- a/browser/ui/brave_browser.cc +++ b/browser/ui/brave_browser.cc @@ -148,7 +148,7 @@ void BraveBrowser::OnTabClosing(content::WebContents* contents) { } void BraveBrowser::TabStripEmpty() { - if (unload_controller_.is_attempting_to_close_browser() || + if (profile()->GetPrefs()->GetBoolean(kEnableClosingLastTab) || !is_type_normal() || ignore_enable_closing_last_tab_pref_) { Browser::TabStripEmpty(); return;