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

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

Issue 2774653006: Refactor Password Manager to use base::EraseIf (Closed)
Patch Set: Created 3 years, 9 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_manager_util.cc
diff --git a/components/password_manager/core/browser/password_manager_util.cc b/components/password_manager/core/browser/password_manager_util.cc
index ae5e3fc34431165149036cc145b689d64db1ecf0..d8d4eb65b9ccdac69774970469ee572386901ba9 100644
--- a/components/password_manager/core/browser/password_manager_util.cc
+++ b/components/password_manager/core/browser/password_manager_util.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/memory/ptr_util.h"
+#include "base/stl_util.h"
#include "components/autofill/core/common/password_form.h"
#include "components/password_manager/core/browser/log_manager.h"
#include "components/sync/driver/sync_service.h"
@@ -61,15 +62,12 @@ void FindDuplicates(
void TrimUsernameOnlyCredentials(
std::vector<std::unique_ptr<autofill::PasswordForm>>* android_credentials) {
// Remove username-only credentials which are not federated.
- android_credentials->erase(
- std::remove_if(
- android_credentials->begin(), android_credentials->end(),
- [](const std::unique_ptr<autofill::PasswordForm>& form) {
- return form->scheme ==
- autofill::PasswordForm::SCHEME_USERNAME_ONLY &&
- form->federation_origin.unique();
- }),
- android_credentials->end());
+ base::EraseIf(*android_credentials,
+ [](const std::unique_ptr<autofill::PasswordForm>& form) {
+ return form->scheme ==
+ autofill::PasswordForm::SCHEME_USERNAME_ONLY &&
+ form->federation_origin.unique();
+ });
// Set "skip_zero_click" on federated credentials.
std::for_each(

Powered by Google App Engine
This is Rietveld 408576698