-
Notifications
You must be signed in to change notification settings - Fork 894
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26808 from brave/fix_tab_count_in_detached_window
Fixed detached window has unnecessary tabs
- Loading branch information
Showing
3 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at https://mozilla.org/MPL/2.0/. */ | ||
|
||
#include "brave/components/constants/pref_names.h" | ||
|
||
// Prevent detached tab has unnecessary tab restore steps. | ||
// When last window's last tab is closed, |has_open_trackable_browsers_| | ||
// becomes false. If we turn off "Close window when closing last tab" option, | ||
// another new tab is created after last tab is closed. So, it's not the last | ||
// actually. It could make ShouldRestore() give true when creating | ||
// new browser by detaching a tab. | ||
#define BRAVE_SESSION_SERVICE_TAB_CLOSED \ | ||
if (profile()->GetPrefs()->GetBoolean(kEnableClosingLastTab)) | ||
|
||
#include "src/chrome/browser/sessions/session_service.cc" | ||
|
||
#undef BRAVE_SESSION_SERVICE_TAB_CLOSED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc | ||
index 69e538baf515892624b9505a00f19268d6d6e5c7..4b120111dd92f971809e1ded4ce51a46f8ea722a 100644 | ||
--- a/chrome/browser/sessions/session_service.cc | ||
+++ b/chrome/browser/sessions/session_service.cc | ||
@@ -371,6 +371,7 @@ void SessionService::TabClosed(SessionID window_id, SessionID tab_id) { | ||
window_id) == window_closing_ids_.end()) && | ||
IsOnlyOneTabLeft()) { | ||
// This is the last tab in the last tabbed browser. | ||
+ BRAVE_SESSION_SERVICE_TAB_CLOSED | ||
has_open_trackable_browsers_ = false; | ||
} | ||
} |