Chromium Code Reviews| 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; |
| } |