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

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

Issue 2747733004: [Password Manager] Send username correction votes (Closed)
Patch Set: Changes addressed to reviewer comments 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/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:

Powered by Google App Engine
This is Rietveld 408576698