Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 typedef std::pair<base::string16, base::string16> PossibleUsernamePair; | |
|
vabr (Chromium)
2017/03/16 21:00:42
Here and below please use:
using new_alias = old_t
kolos1
2017/03/17 14:09:34
Done.
| |
| 22 | |
| 23 // Vector of possible username values and corresponding field names. | |
| 24 typedef std::vector<PossibleUsernamePair> PossibleUsernamesVector; | |
| 25 | |
| 20 // The PasswordForm struct encapsulates information about a login form, | 26 // The PasswordForm struct encapsulates information about a login form, |
| 21 // which can be an HTML form or a dialog with username/password text fields. | 27 // which can be an HTML form or a dialog with username/password text fields. |
| 22 // | 28 // |
| 23 // The Web Data database stores saved username/passwords and associated form | 29 // The Web Data database stores saved username/passwords and associated form |
| 24 // metdata using a PasswordForm struct, typically one that was created from | 30 // metdata using a PasswordForm struct, typically one that was created from |
| 25 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have | 31 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have |
| 26 // also been created by imported data from another browser. | 32 // also been created by imported data from another browser. |
| 27 // | 33 // |
| 28 // The PasswordManager implements a fuzzy-matching algorithm to compare saved | 34 // The PasswordManager implements a fuzzy-matching algorithm to compare saved |
| 29 // PasswordForm entries against PasswordForms that were created from a parsed | 35 // PasswordForm entries against PasswordForms that were created from a parsed |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 // | 140 // |
| 135 // When parsing an HTML form, this is typically empty unless the site | 141 // When parsing an HTML form, this is typically empty unless the site |
| 136 // has implemented some form of autofill. | 142 // has implemented some form of autofill. |
| 137 base::string16 username_value; | 143 base::string16 username_value; |
| 138 | 144 |
| 139 // This member is populated in cases where we there are multiple input | 145 // This member is populated in cases where we there are multiple input |
| 140 // elements that could possibly be the username. Used when our heuristics for | 146 // elements that could possibly be the username. Used when our heuristics for |
| 141 // determining the username are incorrect. Optional. | 147 // determining the username are incorrect. Optional. |
| 142 // | 148 // |
| 143 // When parsing an HTML form, this is typically empty. | 149 // When parsing an HTML form, this is typically empty. |
| 144 std::vector<base::string16> other_possible_usernames; | 150 PossibleUsernamesVector other_possible_usernames; |
| 145 | 151 |
| 146 // The name of the input element corresponding to the current password. | 152 // The name of the input element corresponding to the current password. |
| 147 // Optional (improves scoring). | 153 // Optional (improves scoring). |
| 148 // | 154 // |
| 149 // When parsing an HTML form, this will always be set, unless it is a sign-up | 155 // When parsing an HTML form, this will always be set, unless it is a sign-up |
| 150 // form or a change password form that does not ask for the current password. | 156 // form or a change password form that does not ask for the current password. |
| 151 // In these two cases the |new_password_element| will always be set. | 157 // In these two cases the |new_password_element| will always be set. |
| 152 base::string16 password_element; | 158 base::string16 password_element; |
| 153 | 159 |
| 154 // The current password. Must be non-empty for PasswordForm instances that are | 160 // The current password. Must be non-empty for PasswordForm instances that are |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 // A comparator for the unique key. | 304 // A comparator for the unique key. |
| 299 struct LessThanUniqueKey { | 305 struct LessThanUniqueKey { |
| 300 bool operator()(const std::unique_ptr<PasswordForm>& left, | 306 bool operator()(const std::unique_ptr<PasswordForm>& left, |
| 301 const std::unique_ptr<PasswordForm>& right) const; | 307 const std::unique_ptr<PasswordForm>& right) const; |
| 302 }; | 308 }; |
| 303 | 309 |
| 304 // For testing. | 310 // For testing. |
| 305 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout); | 311 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout); |
| 306 std::ostream& operator<<(std::ostream& os, const PasswordForm& form); | 312 std::ostream& operator<<(std::ostream& os, const PasswordForm& form); |
| 307 std::ostream& operator<<(std::ostream& os, PasswordForm* form); | 313 std::ostream& operator<<(std::ostream& os, PasswordForm* form); |
| 314 base::string16 OtherPossibleUsernamesToStr(const PasswordForm& form); | |
|
vabr (Chromium)
2017/03/16 21:00:42
Having both OtherPossibleUsernamesToStr and OtherP
kolos1
2017/03/17 14:09:34
Done.
| |
| 308 | 315 |
| 309 } // namespace autofill | 316 } // namespace autofill |
| 310 | 317 |
| 311 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ | 318 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ |
| OLD | NEW |