Chromium Code Reviews| 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 14369090569c3caaec8898563d78ef620565a143..1ed6ed01da0f4f070665aa70870845723f4fd485 100644 |
| --- a/chrome/browser/ui/startup/startup_browser_creator.cc |
| +++ b/chrome/browser/ui/startup/startup_browser_creator.cc |
| @@ -14,6 +14,7 @@ |
| #include "base/environment.h" |
| #include "base/file_path.h" |
| #include "base/lazy_instance.h" |
| +#include "base/logging.h" |
| #include "base/memory/scoped_ptr.h" |
| #include "base/metrics/histogram.h" |
| #include "base/path_service.h" |
| @@ -230,10 +231,16 @@ bool StartupBrowserCreator::WasRestarted() { |
| SessionStartupPref StartupBrowserCreator::GetSessionStartupPref( |
| const CommandLine& command_line, |
| Profile* profile) { |
| - SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); |
| - |
| - // Session restore should be avoided on the first run. |
| - if (first_run::IsChromeFirstRun()) |
| + DCHECK(profile); |
| + PrefService *prefs = profile->GetPrefs(); |
|
Peter Kasting
2012/05/23 18:37:49
Nit: * goes on type
bartfab (slow)
2012/05/23 18:44:00
Done.
|
| + SessionStartupPref pref = SessionStartupPref::GetStartupPref(prefs); |
| + |
| + // The pref has an OS-dependent default value. For the first run only, this |
| + // default is overridden with SessionStartupPref::DEFAULT so that first run |
| + // behavior (sync promo, welcome page) is consistently invoked. |
| + // This applies only if the pref is still at its default and has not been |
| + // set by the user, managed prefs or policy. |
| + if (first_run::IsChromeFirstRun() && SessionStartupPref::TypeIsDefault(prefs)) |
| pref.type = SessionStartupPref::DEFAULT; |
| if (command_line.HasSwitch(switches::kRestoreLastSession) || |
| @@ -241,8 +248,7 @@ SessionStartupPref StartupBrowserCreator::GetSessionStartupPref( |
| pref.type = SessionStartupPref::LAST; |
| } |
| if (pref.type == SessionStartupPref::LAST && |
| - IncognitoModePrefs::ShouldLaunchIncognito(command_line, |
| - profile->GetPrefs())) { |
| + IncognitoModePrefs::ShouldLaunchIncognito(command_line, prefs)) { |
| // 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. |