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 447df6523efc57b16e18fcdbf7e666bb4dc04e77..131ece4227ce802d75c24691940e6fab0bc7c0a9 100644 |
--- a/chrome/browser/prefs/session_startup_pref.cc |
+++ b/chrome/browser/prefs/session_startup_pref.cc |
@@ -70,6 +70,9 @@ void SessionStartupPref::RegisterUserPrefs(PrefService* prefs) { |
PrefService::SYNCABLE_PREF); |
prefs->RegisterListPref(prefs::kURLsToRestoreOnStartup, |
PrefService::SYNCABLE_PREF); |
+ prefs->RegisterBooleanPref(prefs::kRestoreOnStartupMigrated, |
+ false, |
+ PrefService::UNSYNCABLE_PREF); |
} |
// static |
@@ -132,14 +135,26 @@ SessionStartupPref SessionStartupPref::GetStartupPref(PrefService* prefs) { |
SessionStartupPref pref( |
PrefValueToType(prefs->GetInteger(prefs::kRestoreOnStartup))); |
- // Migrate from "Open the home page" to "Open the following URLs". If the user |
- // had the "Open the homepage" option selected, then we need to switch them to |
- // "Open the following URLs" and set the list of URLs to a list containing |
- // just the user's homepage. |
- if (pref.type == SessionStartupPref::HOMEPAGE) { |
- prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueURLs); |
- pref.type = SessionStartupPref::URLS; |
- SetNewURLList(prefs); |
+ if (!prefs->GetBoolean(prefs::kRestoreOnStartupMigrated)) { |
Ivan Korotkov
2012/04/17 09:27:51
Could you move the migration to a separate functio
Tyler Breisacher (Chromium)
2012/04/17 19:54:33
Done.
|
+ // Migrate from "Open the home page" to "Open the following URLs". If the |
+ // user had the "Open the home page" option selected, switch them to "Open |
+ // the following URLs" and set the list of URLs to a one-item list |
+ // containing their homepage. |
+ if (pref.type == SessionStartupPref::HOMEPAGE || |
+ (!prefs->HasPrefPath(prefs::kRestoreOnStartup) && |
+ !prefs->GetBoolean(prefs::kHomePageIsNewTabPage))) { |
+ |
+ if (prefs->GetBoolean(prefs::kHomePageIsNewTabPage)) { |
Mattias Nissler (ping if slow)
2012/04/17 09:54:48
These values may still come from policy, in which
Tyler Breisacher (Chromium)
2012/04/17 19:54:33
Done.
|
+ prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueNewTab); |
+ pref.type = SessionStartupPref::DEFAULT; |
+ } else { |
+ prefs->SetInteger(prefs::kRestoreOnStartup, kPrefValueURLs); |
+ pref.type = SessionStartupPref::URLS; |
+ SetNewURLList(prefs); |
+ } |
+ } |
+ |
+ prefs->SetBoolean(prefs::kRestoreOnStartupMigrated, true); |
} |
// Always load the urls, even if the pref type isn't URLS. This way the |