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

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

Issue 2263683002: credentials_to_update should own its PasswordForms (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@621355_dont_set_preferred
Patch Set: No empty->null Created 4 years, 4 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/form_saver_impl.cc
diff --git a/components/password_manager/core/browser/form_saver_impl.cc b/components/password_manager/core/browser/form_saver_impl.cc
index aaf509455ef6fe367ebc5621fc4d16fa4e535c6d..d45c64d998ac9bc83597c343c141ae80450decf7 100644
--- a/components/password_manager/core/browser/form_saver_impl.cc
+++ b/components/password_manager/core/browser/form_saver_impl.cc
@@ -46,7 +46,7 @@ void FormSaverImpl::Save(const PasswordForm& pending,
void FormSaverImpl::Update(
const PasswordForm& pending,
const autofill::PasswordFormMap& best_matches,
- const std::vector<const PasswordForm*>* credentials_to_update,
+ const std::vector<PasswordForm>* credentials_to_update,
const PasswordForm* old_primary_key) {
SaveImpl(pending, false, best_matches, credentials_to_update,
old_primary_key);
@@ -96,13 +96,8 @@ void FormSaverImpl::SaveImpl(
const PasswordForm& pending,
bool is_new_login,
const PasswordFormMap& best_matches,
- const std::vector<const PasswordForm*>* credentials_to_update,
+ const std::vector<PasswordForm>* credentials_to_update,
const PasswordForm* old_primary_key) {
- // Empty and null |credentials_to_update| mean the same, having a canonical
- // representation as nullptr makes the code simpler.
- if (credentials_to_update && credentials_to_update->empty())
- credentials_to_update = nullptr;
-
DCHECK(pending.preferred);
DCHECK(!pending.blacklisted_by_user);
@@ -126,8 +121,8 @@ void FormSaverImpl::SaveImpl(
}
if (credentials_to_update) {
- for (const PasswordForm* credential : *credentials_to_update) {
- store_->UpdateLogin(*credential);
+ for (const PasswordForm& credential : *credentials_to_update) {
+ store_->UpdateLogin(credential);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698