Index: chrome/browser/ui/browser_init.cc |
=================================================================== |
--- chrome/browser/ui/browser_init.cc (revision 114325) |
+++ chrome/browser/ui/browser_init.cc (working copy) |
@@ -333,10 +333,9 @@ |
SessionStartupPref GetSessionStartupPref(const CommandLine& command_line, |
Profile* profile) { |
- PrefService* pref_service = g_browser_process->local_state(); |
SessionStartupPref pref = SessionStartupPref::GetStartupPref(profile); |
if (command_line.HasSwitch(switches::kRestoreLastSession) || |
- pref_service->GetBoolean(prefs::kWasRestarted)) { |
+ BrowserInit::WasRestarted()) { |
pref.type = SessionStartupPref::LAST; |
} |
if (pref.type == SessionStartupPref::LAST && |
@@ -497,6 +496,9 @@ |
// BrowserInit ---------------------------------------------------------------- |
+bool BrowserInit::was_restarted_ = false; |
+bool BrowserInit::was_restarted_read_ = false; |
+ |
BrowserInit::BrowserInit() {} |
BrowserInit::~BrowserInit() {} |
@@ -583,6 +585,17 @@ |
return true; |
} |
+// static |
+bool BrowserInit::WasRestarted() { |
+ if (!was_restarted_read_) { |
+ PrefService* pref_service = g_browser_process->local_state(); |
+ was_restarted_ = pref_service->GetBoolean(prefs::kWasRestarted); |
+ pref_service->SetBoolean(prefs::kWasRestarted, false); |
+ pref_service->ScheduleSavePersistentPrefs(); |
+ was_restarted_read_ = true; |
+ } |
+ return was_restarted_; |
+} |
// BrowserInit::LaunchWithProfile::Tab ---------------------------------------- |