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

Unified Diff: components/autofill/core/common/password_form.cc

Issue 2747733004: [Password Manager] Send username correction votes (Closed)
Patch Set: Rebase 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
« no previous file with comments | « components/autofill/core/common/password_form.h ('k') | components/password_manager/core/browser/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/core/common/password_form.cc
diff --git a/components/autofill/core/common/password_form.cc b/components/autofill/core/common/password_form.cc
index 3969e1ff4e4a41f9adba4503b0f339986e3e0a6c..17892915c65c8f852b94dd2ad7648843be18e296 100644
--- a/components/autofill/core/common/password_form.cc
+++ b/components/autofill/core/common/password_form.cc
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <algorithm>
#include <ostream>
#include <sstream>
@@ -40,9 +41,9 @@ void PasswordFormToJSON(const PasswordForm& form,
form.new_password_value_is_default);
target->SetBoolean("new_password_marked_by_site",
form.new_password_marked_by_site);
- target->SetString("other_possible_usernames",
- base::JoinString(form.other_possible_usernames,
- base::ASCIIToUTF16("|")));
+ target->SetString(
+ "other_possible_usernames",
+ OtherPossibleUsernamesToString(form.other_possible_usernames));
target->SetBoolean("blacklisted", form.blacklisted_by_user);
target->SetBoolean("preferred", form.preferred);
target->SetDouble("date_created", form.date_created.ToDoubleT());
@@ -167,6 +168,16 @@ bool LessThanUniqueKey::operator()(
return left->origin < right->origin;
}
+base::string16 OtherPossibleUsernamesToString(
+ const PossibleUsernamesVector& possible_usernames) {
+ std::vector<base::string16> pairs(possible_usernames.size());
+ std::transform(possible_usernames.begin(), possible_usernames.end(),
+ pairs.begin(), [](const PossibleUsernamePair& p) {
+ return p.first + base::ASCIIToUTF16("+") + p.second;
+ });
+ return base::JoinString(pairs, base::ASCIIToUTF16(", "));
+}
+
std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) {
switch (layout) {
case PasswordForm::Layout::LAYOUT_OTHER:
« no previous file with comments | « components/autofill/core/common/password_form.h ('k') | components/password_manager/core/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698