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..a3361f87ccabe8c6fee3c94e75a512fba85d487c 100644 |
| --- a/components/autofill/core/common/password_form.cc |
| +++ b/components/autofill/core/common/password_form.cc |
| @@ -16,6 +16,17 @@ namespace autofill { |
| namespace { |
| +base::string16 OtherPossibleUsernamesToString( |
|
vabr (Chromium)
2017/03/16 21:00:42
You can also implement it as two pass processing:
kolos1
2017/03/17 14:09:34
Done.
|
| + PossibleUsernamesVector possible_usernames) { |
|
vabr (Chromium)
2017/03/16 21:00:42
const PossibleUsernamesVector&
kolos1
2017/03/17 14:09:34
Done.
|
| + base::string16 result; |
| + for (const PossibleUsernamePair pair : possible_usernames) { |
|
vabr (Chromium)
2017/03/16 21:00:41
use const ref not const value:
const PossibleUsern
kolos1
2017/03/17 14:09:34
Done.
|
| + if (!result.empty()) |
| + result += base::ASCIIToUTF16(", "); |
| + result += pair.first + base::ASCIIToUTF16("+") + pair.second; |
| + } |
| + return result; |
| +} |
| + |
| // Serializes a PasswordForm to a JSON object. Used only for logging in tests. |
| void PasswordFormToJSON(const PasswordForm& form, |
| base::DictionaryValue* target) { |
| @@ -40,9 +51,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()); |
| @@ -207,4 +218,8 @@ std::ostream& operator<<(std::ostream& os, PasswordForm* form) { |
| return os << "&" << *form; |
| } |
| +base::string16 OtherPossibleUsernamesToStr(const PasswordForm& form) { |
| + return OtherPossibleUsernamesToString(form.other_possible_usernames); |
| +} |
| + |
| } // namespace autofill |