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

Unified Diff: chrome/browser/protector/protected_prefs_watcher.cc

Issue 10170046: [protector] Bump Preferences backup version to 3 to mitigate the startup prefs migration. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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/protector/protected_prefs_watcher_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/protector/protected_prefs_watcher.cc
diff --git a/chrome/browser/protector/protected_prefs_watcher.cc b/chrome/browser/protector/protected_prefs_watcher.cc
index 1f991769cce77e1ebfeffcc76e940113d193a02f..5f98e153f9c0fea0224de24455d2d9d36aeebca3 100644
--- a/chrome/browser/protector/protected_prefs_watcher.cc
+++ b/chrome/browser/protector/protected_prefs_watcher.cc
@@ -63,7 +63,7 @@ void StringAppendStringDictionary(const base::DictionaryValue* dict,
} // namespace
// static
-const int ProtectedPrefsWatcher::kCurrentVersionNumber = 2;
+const int ProtectedPrefsWatcher::kCurrentVersionNumber = 3;
ProtectedPrefsWatcher::ProtectedPrefsWatcher(Profile* profile)
: is_backup_valid_(true),
@@ -208,8 +208,18 @@ void ProtectedPrefsWatcher::MigrateOldBackupIfNeeded() {
switch (current_version) {
case 1:
+ // Add pinned tabs.
prefs->Set(kBackupPinnedTabs, *prefs->GetList(prefs::kPinnedTabs));
// FALL THROUGH
+
+ case 2:
+ // SessionStartupPref migration.
+ DCHECK(prefs->GetBoolean(prefs::kRestoreOnStartupMigrated));
+ prefs->SetInteger(kBackupRestoreOnStartup,
+ prefs->GetInteger(prefs::kRestoreOnStartup));
+ prefs->Set(kBackupURLsToRestoreOnStartup,
+ *prefs->GetList(prefs::kURLsToRestoreOnStartup));
+ // FALL THROUGH
}
prefs->SetInteger(kBackupVersion, kCurrentVersionNumber);
« no previous file with comments | « no previous file | chrome/browser/protector/protected_prefs_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698