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

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

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 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 5 #ifndef COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__
6 #define COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 6 #define COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "components/autofill/core/common/form_data.h" 14 #include "components/autofill/core/common/form_data.h"
15 #include "url/gurl.h" 15 #include "url/gurl.h"
16 #include "url/origin.h" 16 #include "url/origin.h"
17 17
18 namespace autofill { 18 namespace autofill {
19 19
20 // Pair of possible username value and field name that contained this value.
21 using PossibleUsernamePair = std::pair<base::string16, base::string16>;
22
23 // Vector of possible username values and corresponding field names.
24 using PossibleUsernamesVector = std::vector<PossibleUsernamePair>;
25
26 // The PasswordForm struct encapsulates information about a login form, 20 // The PasswordForm struct encapsulates information about a login form,
27 // which can be an HTML form or a dialog with username/password text fields. 21 // which can be an HTML form or a dialog with username/password text fields.
28 // 22 //
29 // The Web Data database stores saved username/passwords and associated form 23 // The Web Data database stores saved username/passwords and associated form
30 // metdata using a PasswordForm struct, typically one that was created from 24 // metdata using a PasswordForm struct, typically one that was created from
31 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have 25 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have
32 // also been created by imported data from another browser. 26 // also been created by imported data from another browser.
33 // 27 //
34 // The PasswordManager implements a fuzzy-matching algorithm to compare saved 28 // The PasswordManager implements a fuzzy-matching algorithm to compare saved
35 // PasswordForm entries against PasswordForms that were created from a parsed 29 // PasswordForm entries against PasswordForms that were created from a parsed
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 // 134 //
141 // When parsing an HTML form, this is typically empty unless the site 135 // When parsing an HTML form, this is typically empty unless the site
142 // has implemented some form of autofill. 136 // has implemented some form of autofill.
143 base::string16 username_value; 137 base::string16 username_value;
144 138
145 // This member is populated in cases where we there are multiple input 139 // This member is populated in cases where we there are multiple input
146 // elements that could possibly be the username. Used when our heuristics for 140 // elements that could possibly be the username. Used when our heuristics for
147 // determining the username are incorrect. Optional. 141 // determining the username are incorrect. Optional.
148 // 142 //
149 // When parsing an HTML form, this is typically empty. 143 // When parsing an HTML form, this is typically empty.
150 PossibleUsernamesVector other_possible_usernames; 144 std::vector<base::string16> other_possible_usernames;
151 145
152 // The name of the input element corresponding to the current password. 146 // The name of the input element corresponding to the current password.
153 // Optional (improves scoring). 147 // Optional (improves scoring).
154 // 148 //
155 // When parsing an HTML form, this will always be set, unless it is a sign-up 149 // When parsing an HTML form, this will always be set, unless it is a sign-up
156 // form or a change password form that does not ask for the current password. 150 // form or a change password form that does not ask for the current password.
157 // In these two cases the |new_password_element| will always be set. 151 // In these two cases the |new_password_element| will always be set.
158 base::string16 password_element; 152 base::string16 password_element;
159 153
160 // The current password. Must be non-empty for PasswordForm instances that are 154 // The current password. Must be non-empty for PasswordForm instances that are
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // (origin, username_element, username_value, password_element, signon_realm). 294 // (origin, username_element, username_value, password_element, signon_realm).
301 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left, 295 bool ArePasswordFormUniqueKeyEqual(const PasswordForm& left,
302 const PasswordForm& right); 296 const PasswordForm& right);
303 297
304 // A comparator for the unique key. 298 // A comparator for the unique key.
305 struct LessThanUniqueKey { 299 struct LessThanUniqueKey {
306 bool operator()(const std::unique_ptr<PasswordForm>& left, 300 bool operator()(const std::unique_ptr<PasswordForm>& left,
307 const std::unique_ptr<PasswordForm>& right) const; 301 const std::unique_ptr<PasswordForm>& right) const;
308 }; 302 };
309 303
310 // Converts a vector of possible usernames to string.
311 base::string16 OtherPossibleUsernamesToString(
312 const PossibleUsernamesVector& possible_usernames);
313
314 // For testing. 304 // For testing.
315 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout); 305 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout);
316 std::ostream& operator<<(std::ostream& os, const PasswordForm& form); 306 std::ostream& operator<<(std::ostream& os, const PasswordForm& form);
317 std::ostream& operator<<(std::ostream& os, PasswordForm* form); 307 std::ostream& operator<<(std::ostream& os, PasswordForm* form);
318 308
319 } // namespace autofill 309 } // namespace autofill
320 310
321 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ 311 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698