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

Unified Diff: components/password_manager/core/browser/password_syncable_service.cc

Issue 335893002: Support to remove passwords by date_synced timestamp. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vabr's comments 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
Index: components/password_manager/core/browser/password_syncable_service.cc
diff --git a/components/password_manager/core/browser/password_syncable_service.cc b/components/password_manager/core/browser/password_syncable_service.cc
index 61d1d40a64f1fb569d662d4bc5ea139233143a1e..8cf38174c4a4eb9901884adcdcc1602c828ce28a 100644
--- a/components/password_manager/core/browser/password_syncable_service.cc
+++ b/components/password_manager/core/browser/password_syncable_service.cc
@@ -221,6 +221,7 @@ syncer::SyncError PasswordSyncableService::ProcessSyncChanges(
ScopedVector<autofill::PasswordForm> new_sync_entries;
ScopedVector<autofill::PasswordForm> updated_sync_entries;
ScopedVector<autofill::PasswordForm> deleted_entries;
+ base::Time time_now = base::Time::Now();
for (syncer::SyncChangeList::const_iterator it = change_list.begin();
it != change_list.end();
@@ -231,10 +232,12 @@ syncer::SyncError PasswordSyncableService::ProcessSyncChanges(
form.get());
switch (it->change_type()) {
case syncer::SyncChange::ACTION_ADD: {
+ form->date_synced = time_now;
new_sync_entries.push_back(form.release());
break;
}
case syncer::SyncChange::ACTION_UPDATE: {
+ form->date_synced = time_now;
updated_sync_entries.push_back(form.release());
break;
}
@@ -368,10 +371,12 @@ void PasswordSyncableService::CreateOrUpdateEntry(
// Check whether the data from sync is already in the password store.
PasswordEntryMap::iterator existing_local_entry_iter =
umatched_data_from_password_db->find(tag);
+ base::Time time_now = base::Time::Now();
if (existing_local_entry_iter == umatched_data_from_password_db->end()) {
// The sync data is not in the password store, so we need to create it in
// the password store. Add the entry to the new_entries list.
scoped_ptr<autofill::PasswordForm> new_password(new autofill::PasswordForm);
+ new_password->date_synced = time_now;
PasswordFromSpecifics(password_specifics, new_password.get());
new_sync_entries->push_back(new_password.release());
} else {
@@ -384,6 +389,7 @@ void PasswordSyncableService::CreateOrUpdateEntry(
case IDENTICAL:
break;
case SYNC:
+ new_password->date_synced = time_now;
updated_sync_entries->push_back(new_password.release());
break;
case LOCAL:

Powered by Google App Engine
This is Rietveld 408576698