Commit tab closure for last tab when session restore is enabled
If the one and only tab in a session is an auto-closed tab, such as a
facebook login host, then subsequent launches will restore that tab and
immediately close. While this can be worked around by launching to
another tab, many users could get lost and frustrated and not know what
to do. To fix this, we can detect the situation and force commit the
tab close.
Bug: 1052096
Change-Id: I7372e2a0a13922abb7f2245b8c4a2edf7514fe95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2057627
Commit-Queue: Cliff Smolinsky <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Cr-Commit-Position: refs/heads/master@{#758972}
diff --git a/chrome/browser/sessions/session_service.h b/chrome/browser/sessions/session_service.h
index df24dcf9..365d433 100644
--- a/chrome/browser/sessions/session_service.h
+++ b/chrome/browser/sessions/session_service.h
@@ -144,14 +144,9 @@
const SessionID& tab_id,
bool is_pinned);
- // Notification that a tab has been closed. |closed_by_user_gesture| comes
- // from |WebContents::closed_by_user_gesture|; see it for details.
- //
// Note: this is invoked from the NavigationController's destructor, which is
// after the actual tab has been removed.
- void TabClosed(const SessionID& window_id,
- const SessionID& tab_id,
- bool closed_by_user_gesture);
+ void TabClosed(const SessionID& window_id, const SessionID& tab_id);
// Notification a window has opened.
void WindowOpened(Browser* browser);
@@ -376,6 +371,12 @@
// Are there any open trackable browsers?
bool has_open_trackable_browsers_;
+ // Used to override HasOpenTrackableBrowsers()
+ bool has_open_trackable_browser_for_test_ = true;
+
+ // Use to override IsOnlyOneTableft()
+ bool is_only_one_tab_left_for_test_ = false;
+
// If true and a new tabbed browser is created and there are no opened tabbed
// browser (has_open_trackable_browsers_ is false), then the current session
// is made the last session. See description above class for details on