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..0e6f79f190c7b0b4bfb2da5bdbfd1a2b16c3a94c 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; |
|
sail
2012/03/30 15:50:01
Hi Marja. Since this is getting a bit complicated
marja
2012/03/30 16:26:42
This got reverted back to the original version.
|
| + 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 = |
| - SessionStartupPref::GetDefaultStartupType(); |
| + SessionStartupPref::Type startup_pref_type = |
| + SessionStartupPref::GetDefaultStartupType(); |
| #else |
| - SessionStartupPref::Type startup_pref_type = |
| - BrowserInit::GetSessionStartupPref(*CommandLine::ForCurrentProcess(), |
| - this).type; |
| + SessionStartupPref::Type startup_pref_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_ && |
| + cookie_settings->GetDefaultCookieSetting(NULL) != |
| + CONTENT_SETTING_SESSION_ONLY); |
| + } |
| InitHostZoomMap(); |
| @@ -560,15 +576,8 @@ 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_) |
| BrowserContext::ClearLocalOnDestruction(this); |
| - } |
| StopCreateSessionServiceTimer(); |