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

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

Issue 2714483003: cros: Fix restoring session windows after crash inconsistent minimized window counts (Closed)
Patch Set: SetInitialFocus when active Created 3 years, 9 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
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_restore.cc
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc
index eeafc2d4fed5bd8ac73abeea509a04cf4f662b5f..799aba32f448c5cc6c8ec71fce362bf6ee713bbb 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -410,6 +410,17 @@ class SessionRestoreImpl : public content::NotificationObserver {
!browser_->profile()->IsOffTheRecord()) {
// The first set of tabs is added to the existing browser.
browser = browser_;
+
+ // If the existing browser is not nullptr and tabbed, the tabs from the
+ // session window with |active_window_id| should be restored to this
+ // existing browser. Therefore, the existing browser is the
+ // |browser_to_activate|.
+ for (auto j = windows->begin(); j != windows->end(); ++j) {
sky 2017/03/07 01:05:36 It's confusing to have this logic here. Could you
Qiang(Joe) Xu 2017/03/07 01:19:31 Done.
+ if ((*j)->window_id.id() == active_window_id) {
+ std::iter_swap(i, j);
+ break;
+ }
+ }
} else {
#if defined(OS_CHROMEOS)
chromeos::BootTimesRecorder::Get()->AddLoginTimeMarker(
@@ -656,7 +667,8 @@ class SessionRestoreImpl : public content::NotificationObserver {
// TODO(jcampan): http://crbug.com/8123 we should not need to set the
// initial focus explicitly.
- browser->tab_strip_model()->GetActiveWebContents()->SetInitialFocus();
+ if (browser->window()->IsActive())
+ browser->tab_strip_model()->GetActiveWebContents()->SetInitialFocus();
}
// Appends the urls in |urls| to |browser|.
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698