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

Unified Diff: chrome/browser/password_manager/native_backend_kwallet_x.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/native_backend_kwallet_x.cc
diff --git a/chrome/browser/password_manager/native_backend_kwallet_x.cc b/chrome/browser/password_manager/native_backend_kwallet_x.cc
index c9ec8c4d9ffdea5ed76df923fa62877505365503..08c23a98bdf26acc6bc0ebe77405e95ad7337eec 100644
--- a/chrome/browser/password_manager/native_backend_kwallet_x.cc
+++ b/chrome/browser/password_manager/native_backend_kwallet_x.cc
@@ -301,23 +301,35 @@ password_manager::PasswordStoreChangeList NativeBackendKWallet::AddLogin(
return changes;
}
-bool NativeBackendKWallet::UpdateLogin(const PasswordForm& form) {
+bool NativeBackendKWallet::UpdateLogin(
+ const PasswordForm& form,
+ password_manager::PasswordStoreChangeList* changes) {
+ DCHECK(changes);
+ changes->clear();
int wallet_handle = WalletHandle();
if (wallet_handle == kInvalidKWalletHandle)
return false;
- PasswordFormList forms;
- GetLoginsList(&forms, form.signon_realm, wallet_handle);
+ ScopedVector<autofill::PasswordForm> forms;
+ GetLoginsList(&forms.get(), form.signon_realm, wallet_handle);
+ bool updated = false;
for (size_t i = 0; i < forms.size(); ++i) {
- if (CompareForms(form, *forms[i], true))
+ if (CompareForms(form, *forms[i], true)) {
*forms[i] = form;
+ updated = true;
+ }
}
+ if (!updated)
+ return true;
- bool ok = SetLoginsList(forms, form.signon_realm, wallet_handle);
+ if (SetLoginsList(forms.get(), form.signon_realm, wallet_handle)) {
+ changes->push_back(password_manager::PasswordStoreChange(
+ password_manager::PasswordStoreChange::UPDATE, form));
+ return true;
+ }
- STLDeleteElements(&forms);
- return ok;
+ return false;
}
bool NativeBackendKWallet::RemoveLogin(const PasswordForm& form) {

Powered by Google App Engine
This is Rietveld 408576698