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

Unified Diff: chrome/browser/password_manager/password_store_mac.cc

Issue 299443002: Password Login Database: report correct changes from UpdateLogin(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added UpdateNonexistentLogin tests Created 6 years, 7 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/password_manager/password_store_mac.cc
diff --git a/chrome/browser/password_manager/password_store_mac.cc b/chrome/browser/password_manager/password_store_mac.cc
index 71be693c6ac2473cd80bacf82682ed403950810f..c46c5d891228212a0f3ae8f4bb5ca15fa0e63928 100644
--- a/chrome/browser/password_manager/password_store_mac.cc
+++ b/chrome/browser/password_manager/password_store_mac.cc
@@ -885,13 +885,10 @@ PasswordStoreChangeList PasswordStoreMac::AddLoginImpl(
PasswordStoreChangeList PasswordStoreMac::UpdateLoginImpl(
const PasswordForm& form) {
DCHECK(thread_->message_loop() == base::MessageLoop::current());
- PasswordStoreChangeList changes;
- int update_count = 0;
- if (!login_metadata_db_->UpdateLogin(form, &update_count))
- return changes;
+ PasswordStoreChangeList changes = login_metadata_db_->UpdateLogin(form);
MacKeychainPasswordFormAdapter keychain_adapter(keychain_.get());
- if (update_count == 0 &&
+ if (changes.empty() &&
!keychain_adapter.HasPasswordsMergeableWithForm(form)) {
// If the password isn't in either the DB or the keychain, then it must have
// been deleted after autofill happened, and should not be re-added.
@@ -900,11 +897,8 @@ PasswordStoreChangeList PasswordStoreMac::UpdateLoginImpl(
// The keychain add will update if there is a collision and add if there
// isn't, which is the behavior we want, so there's no separate update call.
- if (AddToKeychainIfNecessary(form)) {
- if (update_count == 0)
- changes = login_metadata_db_->AddLogin(form);
- else
- changes.push_back(PasswordStoreChange(PasswordStoreChange::UPDATE, form));
+ if (AddToKeychainIfNecessary(form) && changes.empty()) {
+ changes = login_metadata_db_->AddLogin(form);
}
return changes;
}

Powered by Google App Engine
This is Rietveld 408576698