[cr149] UnloadHandler as UnownedData

Chromium changes:
https://chromium.googlesource.com/chromium/src/+/beaae0fe841a3830d1f23fbe2579955d159a02cf

commit beaae0fe841a3830d1f23fbe2579955d159a02cf
Author: Thomas Lukaszewicz <tluk@chromium.org>
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 <tluk@chromium.org>
    Reviewed-by: Allen Bauer <kylixrd@chromium.org>
    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 <tluk@chromium.org>
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 <tluk@chromium.org>
    Reviewed-by: Allen Bauer <kylixrd@chromium.org>
    Cr-Commit-Position: refs/heads/main@{#1624444}
This commit is contained in:
Max Karolinskiy
2026-05-22 16:57:35 -04:00
parent 557b596be6
commit 0b4f8d3a37
+1 -1
View File
@@ -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;