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

Unified Diff: chrome/browser/ui/browser_init.cc

Issue 8907025: Merge 114213 - Fixes for the kWasRestarted pref. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/963/src/
Patch Set: Created 9 years 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/ui/browser_init.h ('k') | chrome/browser/ui/browser_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 ----------------------------------------
« no previous file with comments | « chrome/browser/ui/browser_init.h ('k') | chrome/browser/ui/browser_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698