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

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

Issue 2714483003: cros: Fix restoring session windows after crash inconsistent minimized window counts (Closed)
Patch Set: based on ps4's comments 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..bc9cdea408b64872c828fcbdf9dd18e822ea3e55 100644
--- a/chrome/browser/sessions/session_restore.cc
+++ b/chrome/browser/sessions/session_restore.cc
@@ -399,6 +399,16 @@ class SessionRestoreImpl : public content::NotificationObserver {
has_visible_browser = true;
}
+ // Always move the session window with |active_window_id| to the front, so
sky 2017/03/07 17:34:19 Now that I think about it you shouldn't reorder wi
Qiang(Joe) Xu 2017/03/07 21:17:04 ok, thanks for the info. Another solution I upload
+ // that if the first session window is restored to the existing tabbed
+ // browser, the existing browser is the |browser_to_activate|.
+ for (auto i = windows->begin(); i != windows->end(); ++i) {
+ if ((*i)->window_id.id() == active_window_id) {
+ std::iter_swap(windows->begin(), i);
+ break;
+ }
+ }
+
for (auto i = windows->begin(); i != windows->end(); ++i) {
Browser* browser = nullptr;
if (!has_tabbed_browser &&
@@ -656,7 +666,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