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

Unified Diff: chrome/browser/ui/startup/startup_browser_creator.cc

Issue 694593002: Profile unlock should always use session restore, regardless of system preference. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make startup code more flexible for tests (and cold starts?) Created 6 years, 2 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/ui/webui/signin/user_manager_screen_handler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/startup/startup_browser_creator.cc
diff --git a/chrome/browser/ui/startup/startup_browser_creator.cc b/chrome/browser/ui/startup/startup_browser_creator.cc
index 295690e2afde26702b72264593bcd70ab0648474..f1fe812efc59e885a032370ef1c18d8f57350baf 100644
--- a/chrome/browser/ui/startup/startup_browser_creator.cc
+++ b/chrome/browser/ui/startup/startup_browser_creator.cc
@@ -388,6 +388,23 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref(
!profile->IsNewProfile()) {
pref.type = SessionStartupPref::LAST;
}
+
+ // A browser starting for a profile being unlocked should always restore.
+ if (!profile->IsGuestSession()) {
+ ProfileInfoCache& info_cache =
+ g_browser_process->profile_manager()->GetProfileInfoCache();
+ size_t index = info_cache.GetIndexOfProfileWithPath(profile->GetPath());
+
+ // If called during CreatePrimaryProfile on startup, |profile| has not yet
msw 2014/10/30 22:29:49 nit: not sure the comment is entirely necessary.
+ // been added to the ProfileInfoCache; other code checks IsSigninRequired
+ // and launches the UserManager if set. Thus here, only handle Profiles
+ // that are in the ProfileInfoCache and have the bit set.
+ if (index != std::string::npos &&
+ info_cache.ProfileIsSigninRequiredAtIndex(index)) {
+ pref.type = SessionStartupPref::LAST;
msw 2014/10/30 22:29:50 nit: fix indent
+ }
+ }
+
if (pref.type == SessionStartupPref::LAST &&
IncognitoModePrefs::ShouldLaunchIncognito(command_line, prefs)) {
// We don't store session information when incognito. If the user has
« no previous file with comments | « no previous file | chrome/browser/ui/webui/signin/user_manager_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698