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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 9965012: Honor session content settings even if "continue where I left off" is selected. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Code review. Created 8 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 | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | chrome/browser/profiles/profile_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698