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

Unified Diff: chrome/browser/sync/profile_sync_service.cc

Issue 367063005: Use new sync backup DB if settings are reset to avoid undoing reset. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/sync/profile_sync_service.cc
diff --git a/chrome/browser/sync/profile_sync_service.cc b/chrome/browser/sync/profile_sync_service.cc
index 03001b436101ecf8c819835ded23f3aa16d15b2d..cd24db0e80278c188cf754857b136e9bfc390a6c 100644
--- a/chrome/browser/sync/profile_sync_service.cc
+++ b/chrome/browser/sync/profile_sync_service.cc
@@ -32,6 +32,7 @@
#include "chrome/browser/defaults.h"
#include "chrome/browser/invalidation/profile_invalidation_provider_factory.h"
#include "chrome/browser/net/chrome_cookie_notification_details.h"
+#include "chrome/browser/prefs/chrome_pref_service_factory.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/services/gcm/gcm_profile_service.h"
@@ -521,11 +522,20 @@ bool ProfileSyncService::ShouldDeleteSyncFolder() {
if (backend_mode_ == SYNC)
return !HasSyncSetupCompleted();
- // Start fresh if it's the first time backup after user stopped syncing.
- // This is needed because backup DB may contain items deleted by user during
- // sync period and can cause back-from-dead issues.
- if (backend_mode_ == BACKUP && !sync_prefs_.GetFirstSyncTime().is_null())
- return true;
+ if (backend_mode_ == BACKUP) {
+ base::Time reset_time = chrome_prefs::GetResetTime(profile_);
+
+ // Start fresh if:
+ // * It's the first time backup after user stopped syncing because backup
+ // DB may contain items deleted by user during sync period and can cause
+ // back-from-dead issues if user didn't choose rollback.
+ // * Settings are reset during startup because of tampering to avoid
+ // restoring settings from backup.
+ if (!sync_prefs_.GetFirstSyncTime().is_null() ||
+ (!reset_time.is_null() && profile_->GetStartTime() <= reset_time)) {
+ return true;
+ }
+ }
return false;
}

Powered by Google App Engine
This is Rietveld 408576698