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 5a5050773be4e0340ca66388109b50b1b97135f1..2a7e0db3261cc9df3aa55b77027ee8ead77d5a44 100644 |
--- a/components/password_manager/core/browser/password_syncable_service.cc |
+++ b/components/password_manager/core/browser/password_syncable_service.cc |
@@ -54,7 +54,7 @@ MergeResult MergeLocalAndSyncPasswords( |
} |
// If the passwords differ, take the one that was created more recently. |
- if (base::Time::FromInternalValue(password_specifics.date_created()) <= |
+ if (base::Time::FromInternalValue(password_specifics.date_created()) < |
password_form.date_created) { |
*new_password_form = password_form; |
return LOCAL; |
@@ -215,54 +215,29 @@ syncer::SyncError PasswordSyncableService::ProcessSyncChanges( |
base::AutoReset<bool> processing_changes(&is_processing_sync_changes_, true); |
// The |db_entries_map| and associated vectors are filled only in case of |
// update change. |
- PasswordEntryMap db_entries_map; |
- ScopedVector<autofill::PasswordForm> password_db_entries; |
ScopedVector<autofill::PasswordForm> new_sync_entries; |
ScopedVector<autofill::PasswordForm> updated_sync_entries; |
ScopedVector<autofill::PasswordForm> deleted_entries; |
- bool has_read_passwords = false; |
for (syncer::SyncChangeList::const_iterator it = change_list.begin(); |
it != change_list.end(); |
++it) { |
+ const sync_pb::EntitySpecifics& specifics = it->sync_data().GetSpecifics(); |
+ scoped_ptr<autofill::PasswordForm> form(new autofill::PasswordForm); |
+ PasswordFromSpecifics(specifics.password().client_only_encrypted_data(), |
+ form.get()); |
switch (it->change_type()) { |
case syncer::SyncChange::ACTION_ADD: { |
- const sync_pb::EntitySpecifics& specifics = |
- it->sync_data().GetSpecifics(); |
- new_sync_entries.push_back(new autofill::PasswordForm); |
- PasswordFromSpecifics(specifics.password().client_only_encrypted_data(), |
- new_sync_entries.back()); |
+ new_sync_entries.push_back(form.release()); |
break; |
} |
case syncer::SyncChange::ACTION_UPDATE: { |
- if (!has_read_passwords) { |
- if (ReadFromPasswordStore(&password_db_entries, |
- &db_entries_map)) { |
- has_read_passwords = true; |
- } else { |
- return sync_error_factory_->CreateAndUploadError( |
- FROM_HERE, |
- "Failed to get passwords from store."); |
- } |
- } |
- syncer::SyncChangeList sync_changes; |
- |
- CreateOrUpdateEntry(it->sync_data(), |
- &db_entries_map, |
- &new_sync_entries, |
- &updated_sync_entries, |
- &sync_changes); |
- DCHECK(sync_changes.empty()); |
+ updated_sync_entries.push_back(form.release()); |
break; |
} |
case syncer::SyncChange::ACTION_DELETE: { |
- const sync_pb::EntitySpecifics& specifics = |
- it->sync_data().GetSpecifics(); |
- const sync_pb::PasswordSpecificsData& password_specifics( |
- specifics.password().client_only_encrypted_data()); |
- deleted_entries.push_back(new autofill::PasswordForm); |
- PasswordFromSpecifics(password_specifics, deleted_entries.back()); |
+ deleted_entries.push_back(form.release()); |
break; |
} |
case syncer::SyncChange::ACTION_INVALID: |