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

Side by Side Diff: components/autofill/core/common/password_form.cc

Issue 2985373002: Revert of [Password Manager] Send username correction votes (Closed)
Patch Set: Created 3 years, 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <algorithm>
6 #include <ostream> 5 #include <ostream>
7 #include <sstream> 6 #include <sstream>
8 7
9 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
10 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
11 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
12 #include "base/strings/utf_string_conversions.h" 11 #include "base/strings/utf_string_conversions.h"
13 #include "base/values.h" 12 #include "base/values.h"
14 #include "components/autofill/core/common/password_form.h" 13 #include "components/autofill/core/common/password_form.h"
15 14
(...skipping 18 matching lines...) Expand all
34 target->SetString("password_elem", form.password_element); 33 target->SetString("password_elem", form.password_element);
35 target->SetString("password_value", form.password_value); 34 target->SetString("password_value", form.password_value);
36 target->SetBoolean("password_value_is_default", 35 target->SetBoolean("password_value_is_default",
37 form.password_value_is_default); 36 form.password_value_is_default);
38 target->SetString("new_password_element", form.new_password_element); 37 target->SetString("new_password_element", form.new_password_element);
39 target->SetString("new_password_value", form.new_password_value); 38 target->SetString("new_password_value", form.new_password_value);
40 target->SetBoolean("new_password_value_is_default", 39 target->SetBoolean("new_password_value_is_default",
41 form.new_password_value_is_default); 40 form.new_password_value_is_default);
42 target->SetBoolean("new_password_marked_by_site", 41 target->SetBoolean("new_password_marked_by_site",
43 form.new_password_marked_by_site); 42 form.new_password_marked_by_site);
44 target->SetString( 43 target->SetString("other_possible_usernames",
45 "other_possible_usernames", 44 base::JoinString(form.other_possible_usernames,
46 OtherPossibleUsernamesToString(form.other_possible_usernames)); 45 base::ASCIIToUTF16("|")));
47 target->SetBoolean("blacklisted", form.blacklisted_by_user); 46 target->SetBoolean("blacklisted", form.blacklisted_by_user);
48 target->SetBoolean("preferred", form.preferred); 47 target->SetBoolean("preferred", form.preferred);
49 target->SetDouble("date_created", form.date_created.ToDoubleT()); 48 target->SetDouble("date_created", form.date_created.ToDoubleT());
50 target->SetDouble("date_synced", form.date_synced.ToDoubleT()); 49 target->SetDouble("date_synced", form.date_synced.ToDoubleT());
51 target->SetInteger("type", form.type); 50 target->SetInteger("type", form.type);
52 target->SetInteger("times_used", form.times_used); 51 target->SetInteger("times_used", form.times_used);
53 std::ostringstream form_data_string_stream; 52 std::ostringstream form_data_string_stream;
54 form_data_string_stream << form.form_data; 53 form_data_string_stream << form.form_data;
55 target->SetString("form_data", form_data_string_stream.str()); 54 target->SetString("form_data", form_data_string_stream.str());
56 target->SetInteger("generation_upload_status", form.generation_upload_status); 55 target->SetInteger("generation_upload_status", form.generation_upload_status);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 if (result) 160 if (result)
162 return result < 0; 161 return result < 0;
163 162
164 result = left->password_element.compare(right->password_element); 163 result = left->password_element.compare(right->password_element);
165 if (result) 164 if (result)
166 return result < 0; 165 return result < 0;
167 166
168 return left->origin < right->origin; 167 return left->origin < right->origin;
169 } 168 }
170 169
171 base::string16 OtherPossibleUsernamesToString(
172 const PossibleUsernamesVector& possible_usernames) {
173 std::vector<base::string16> pairs(possible_usernames.size());
174 std::transform(possible_usernames.begin(), possible_usernames.end(),
175 pairs.begin(), [](const PossibleUsernamePair& p) {
176 return p.first + base::ASCIIToUTF16("+") + p.second;
177 });
178 return base::JoinString(pairs, base::ASCIIToUTF16(", "));
179 }
180
181 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) { 170 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout) {
182 switch (layout) { 171 switch (layout) {
183 case PasswordForm::Layout::LAYOUT_OTHER: 172 case PasswordForm::Layout::LAYOUT_OTHER:
184 os << "LAYOUT_OTHER"; 173 os << "LAYOUT_OTHER";
185 break; 174 break;
186 case PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP: 175 case PasswordForm::Layout::LAYOUT_LOGIN_AND_SIGNUP:
187 os << "LAYOUT_LOGIN_AND_SIGNUP"; 176 os << "LAYOUT_LOGIN_AND_SIGNUP";
188 break; 177 break;
189 } 178 }
190 return os; 179 return os;
(...skipping 21 matching lines...) Expand all
212 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string); 201 form_json, base::JSONWriter::OPTIONS_PRETTY_PRINT, &form_as_string);
213 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string); 202 base::TrimWhitespaceASCII(form_as_string, base::TRIM_ALL, &form_as_string);
214 return os << "PasswordForm(" << form_as_string << ")"; 203 return os << "PasswordForm(" << form_as_string << ")";
215 } 204 }
216 205
217 std::ostream& operator<<(std::ostream& os, PasswordForm* form) { 206 std::ostream& operator<<(std::ostream& os, PasswordForm* form) {
218 return os << "&" << *form; 207 return os << "&" << *form;
219 } 208 }
220 209
221 } // namespace autofill 210 } // namespace autofill
OLDNEW
« 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