Chromium Code Reviews| 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..c1afa08667be83fe321f411a13d6b208e98f75d0 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(), [](PossibleUsernamePair p) { |
|
dvadym
2017/03/22 10:56:18
Nit: const PossibleUsernamePair&
kolos1
2017/03/22 13:40:39
Done.
|
| + 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: |