Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(609)

Unified Diff: chrome/browser/sessions/session_service.cc

Issue 2345763002: Fix tabs duplication when restoring last closed window. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sessions/session_service.cc
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 805e03e146f575a2e9ebcf468c8b3a658e37f0b0..c00e6029151c5f678c9068340b461b0c2d283482 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -132,7 +132,7 @@ bool SessionService::ShouldNewWindowStartSession() {
}
bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open) {
- return RestoreIfNecessary(urls_to_open, NULL);
+ return RestoreIfNecessary(urls_to_open, NULL, false);
}
void SessionService::ResetFromCurrentBrowsers() {
@@ -234,11 +234,11 @@ void SessionService::TabClosed(const SessionID& window_id,
}
}
-void SessionService::WindowOpened(Browser* browser) {
+void SessionService::WindowOpened(Browser* browser, bool dont_restore) {
if (!ShouldTrackBrowser(browser))
return;
- RestoreIfNecessary(std::vector<GURL>(), browser);
+ RestoreIfNecessary(std::vector<GURL>(), browser, dont_restore);
SetWindowType(browser->session_id(),
browser->type(),
browser->is_app() ? TYPE_APP : TYPE_NORMAL);
@@ -577,7 +577,7 @@ void SessionService::RemoveUnusedRestoreWindows(
}
bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open,
- Browser* browser) {
+ Browser* browser, bool dont_restore) {
if (ShouldNewWindowStartSession()) {
// We're going from no tabbed browsers to a tabbed browser (and not in
// process startup), restore the last session.
@@ -588,7 +588,7 @@ bool SessionService::RestoreIfNecessary(const std::vector<GURL>& urls_to_open,
}
SessionStartupPref pref = StartupBrowserCreator::GetSessionStartupPref(
*base::CommandLine::ForCurrentProcess(), profile());
- if (pref.type == SessionStartupPref::LAST) {
+ if (pref.type == SessionStartupPref::LAST && !dont_restore) {
SessionRestore::RestoreSession(
profile(), browser,
browser ? 0 : SessionRestore::ALWAYS_CREATE_TABBED_BROWSER,

Powered by Google App Engine
This is Rietveld 408576698