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

Unified Diff: chrome/browser/prefs/session_startup_pref.cc

Issue 10702040: Cleanup & tests for the mac startup pref migration. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: reverting protector changes Created 8 years, 6 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 | « no previous file | chrome/browser/prefs/session_startup_pref_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/session_startup_pref.cc
diff --git a/chrome/browser/prefs/session_startup_pref.cc b/chrome/browser/prefs/session_startup_pref.cc
index bbe96c9e5b725b9044b9d6767d89dfeb3e957cbd..5738b6e8d4a2f79775561efa51dbb99c971e8f64 100644
--- a/chrome/browser/prefs/session_startup_pref.cc
+++ b/chrome/browser/prefs/session_startup_pref.cc
@@ -121,11 +121,7 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) {
DCHECK(prefs);
MigrateIfNecessary(prefs);
-
-#if defined(OS_MACOSX)
- if (restore_utils::IsWindowRestoreEnabled())
- MigrateMacDefaultPrefIfNecessary(prefs);
-#endif
+ MigrateMacDefaultPrefIfNecessary(prefs);
SessionStartupPref pref(
PrefValueToType(prefs->GetInteger(prefs::kRestoreOnStartup)));
@@ -188,7 +184,10 @@ void SessionStartupPref::MigrateIfNecessary(PrefService* prefs) {
// static
void SessionStartupPref::MigrateMacDefaultPrefIfNecessary(PrefService* prefs) {
+#if defined(OS_MACOSX)
DCHECK(prefs);
+ if (!restore_utils::IsWindowRestoreEnabled())
+ return;
// The default startup pref used to be LAST, now it is DEFAULT. Don't change
// the setting for existing profiles (even if the user has never changed it),
// but make new profiles default to DEFAULT.
@@ -196,6 +195,7 @@ void SessionStartupPref::MigrateMacDefaultPrefIfNecessary(PrefService* prefs) {
prefs::kProfileCreatedByVersion)).IsOlderThan("21.0.1180.0");
if (old_profile_version && TypeIsDefault(prefs))
prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueLast);
+#endif
}
// static
« no previous file with comments | « no previous file | chrome/browser/prefs/session_startup_pref_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698