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

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, 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f4ab21aecc238e9d4cc0d9a32074e28c4ac97ded..3c387deb8a851bf65934c2262b90ad7d0babcf70 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/pref_hash_filter.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/services/gcm/gcm_profile_service.h"
@@ -518,14 +519,25 @@ SyncCredentials ProfileSyncService::GetCredentials() {
}
bool ProfileSyncService::ShouldDeleteSyncFolder() {
+ DVLOG(1) << "start time: " << profile_->GetStartTime().ToInternalValue()
+ << ", reset time: "
+ << PrefHashFilter::GetResetTime(profile_->GetPrefs()).ToInternalValue();
gab 2014/07/03 13:08:53 Please use chrome_prefs::GetResetTime(Profile*) fr
haitaol1 2014/07/07 20:43:19 Done.
+
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) {
+ // 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 tampered and reset during startup to avoid undo reset.
+ if (!sync_prefs_.GetFirstSyncTime().is_null() ||
+ profile_->GetStartTime() <=
+ PrefHashFilter::GetResetTime(profile_->GetPrefs())) {
+ return true;
+ }
+ }
return false;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698