[TabRestore] Represent single tab windows as window entries in the UI
Windows that are closed with a single tab are now represented as window entries with a single tab in the recent tabs submenu. This CL removes the logic from the service meaning other platforms using it the service are not subject to desktop specific logic. Removes SessionRestoreTest.WindowWithOneTab since it is no longer applicable. Updates remaining tests to account for this change. Change-Id: I0168dbadfecd4e9b611b91989180e3900d40627b Bug: 41227458, 40438075, 40846749 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6387072 Reviewed-by: David Pennington <dpenning@chromium.org> Commit-Queue: Darryl James <dljames@chromium.org> Cr-Commit-Position: refs/heads/main@{#1437715}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
cba371a958
commit
9e5585fdb2
chrome/browser
components/sessions/core
@ -234,16 +234,14 @@ void TabRestoreServiceHelper::BrowserClosing(LiveTabContext* context) {
|
||||
window->tabs.push_back(std::move(tab));
|
||||
}
|
||||
|
||||
if (window->tabs.size() == 1 && window->app_name.empty() &&
|
||||
window->user_title.empty()) {
|
||||
// Short-circuit creating a Window if only 1 tab was present. This fixes
|
||||
// http://crbug.com/56744.
|
||||
AddEntry(std::move(window->tabs[0]), true, true);
|
||||
} else if (!window->tabs.empty()) {
|
||||
window->selected_tab_index = std::min(
|
||||
static_cast<int>(window->tabs.size() - 1), window->selected_tab_index);
|
||||
AddEntry(std::move(window), true, true);
|
||||
if (window->tabs.empty()) {
|
||||
// This can happen in tests.
|
||||
return;
|
||||
}
|
||||
|
||||
window->selected_tab_index = std::min(
|
||||
static_cast<int>(window->tabs.size() - 1), window->selected_tab_index);
|
||||
AddEntry(std::move(window), true, true);
|
||||
}
|
||||
|
||||
void TabRestoreServiceHelper::BrowserClosed(LiveTabContext* context) {
|
||||
|
Reference in New Issue
Block a user