Index: chrome/browser/ui/browser_init.cc |
=================================================================== |
--- chrome/browser/ui/browser_init.cc (revision 72634) |
+++ chrome/browser/ui/browser_init.cc (working copy) |
@@ -370,7 +370,8 @@ |
if (command_line.HasSwitch(switches::kRestoreLastSession)) |
pref.type = SessionStartupPref::LAST; |
if (command_line.HasSwitch(switches::kIncognito) && |
- pref.type == SessionStartupPref::LAST) { |
+ pref.type == SessionStartupPref::LAST && |
+ profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) { |
// We don't store session information when incognito. If the user has |
// chosen to restore last session and launched incognito, fallback to |
// default launch behavior. |
@@ -484,8 +485,10 @@ |
#endif |
// Continue with the off-the-record profile from here on if --incognito |
- if (command_line.HasSwitch(switches::kIncognito)) |
+ if (command_line.HasSwitch(switches::kIncognito) && |
+ profile->GetPrefs()->GetBoolean(prefs::kIncognitoEnabled)) { |
profile = profile->GetOffTheRecordProfile(); |
+ } |
BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, this); |
bool launched = lwp.Launch(profile, process_startup); |