Chromium Code Reviews| Index: chrome/browser/profiles/profile_impl.cc |
| diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc |
| index 0c894336d6b33b01f7fc0a6ce77261a70fbb01b9..a725e0bfed955981a2a1f9bfbc2bee1df83af80b 100644 |
| --- a/chrome/browser/profiles/profile_impl.cc |
| +++ b/chrome/browser/profiles/profile_impl.cc |
| @@ -362,18 +362,34 @@ void ProfileImpl::DoFinalInit(bool is_new_profile) { |
| FilePath app_path = GetPath().Append(chrome::kIsolatedAppStateDirname); |
| + bool restore_old_session_cookies = false; |
| + if (session_restore_enabled_) { |
| + // Restore old session cookies |
| + // - after crashes |
| + // - after updates |
| + // - when the user has the "continue where I left off" startup option |
| + // selected, and hasn't selected to clear cookies on exit or restricted them |
| + // to session only. |
| + const CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| #if defined(OS_ANDROID) |
| SessionStartupPref::Type startup_pref_type = |
|
Bernhard Bauer
2012/03/30 12:40:05
Nit: Indent
marja
2012/03/30 12:51:37
Done.
|
| SessionStartupPref::GetDefaultStartupType(); |
| #else |
| SessionStartupPref::Type startup_pref_type = |
| - BrowserInit::GetSessionStartupPref(*CommandLine::ForCurrentProcess(), |
| - this).type; |
| + BrowserInit::GetSessionStartupPref(*command_line, this).type; |
| #endif |
| - bool restore_old_session_cookies = |
| - session_restore_enabled_ && |
| - (!DidLastSessionExitCleanly() || |
| - startup_pref_type == SessionStartupPref::LAST); |
| + CookieSettings* cookie_settings = |
| + CookieSettings::Factory::GetForProfile(this); |
| + |
| + restore_old_session_cookies = |
| + !DidLastSessionExitCleanly() || |
| + command_line->HasSwitch(switches::kRestoreLastSession) || |
| + BrowserInit::WasRestarted() || |
| + (startup_pref_type == SessionStartupPref::LAST && |
| + !clear_local_state_on_exit_ && |
|
Bernhard Bauer
2012/03/30 12:40:05
Can you indent this line and the next one by one s
marja
2012/03/30 12:51:37
Done.
|
| + cookie_settings->GetDefaultCookieSetting(NULL) != |
| + CONTENT_SETTING_SESSION_ONLY); |
|
Bernhard Bauer
2012/03/30 12:40:05
...and this line by five spaces (so it's indented
marja
2012/03/30 12:51:37
Done.
|
| + } |
| InitHostZoomMap(); |
| @@ -560,13 +576,7 @@ ProfileImpl::~ProfileImpl() { |
| chrome::NOTIFICATION_PROFILE_DESTROYED, |
| content::Source<Profile>(this), |
| content::NotificationService::NoDetails()); |
| - // Save the session state if we're going to restore the session during the |
| - // next startup. |
| - SessionStartupPref pref = SessionStartupPref::GetStartupPref(this); |
| - if (pref.type == SessionStartupPref::LAST) { |
| - if (session_restore_enabled_) |
| - BrowserContext::SaveSessionState(this); |
| - } else if (clear_local_state_on_exit_) { |
| + if (clear_local_state_on_exit_) { |
|
Bernhard Bauer
2012/03/30 12:40:05
Nit: Braces unnecessary.
marja
2012/03/30 12:51:37
Done.
|
| BrowserContext::ClearLocalOnDestruction(this); |
| } |