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: |