| 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 <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/autofill/core/common/form_data.h" |
| 13 #include "url/gurl.h" | 14 #include "url/gurl.h" |
| 14 | 15 |
| 15 namespace autofill { | 16 namespace autofill { |
| 16 | 17 |
| 17 // The PasswordForm struct encapsulates information about a login form, | 18 // The PasswordForm struct encapsulates information about a login form, |
| 18 // which can be an HTML form or a dialog with username/password text fields. | 19 // which can be an HTML form or a dialog with username/password text fields. |
| 19 // | 20 // |
| 20 // The Web Data database stores saved username/passwords and associated form | 21 // The Web Data database stores saved username/passwords and associated form |
| 21 // metdata using a PasswordForm struct, typically one that was created from | 22 // metdata using a PasswordForm struct, typically one that was created from |
| 22 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have | 23 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 174 |
| 174 // The form type. Not used yet. Please see http://crbug.com/152422 | 175 // The form type. Not used yet. Please see http://crbug.com/152422 |
| 175 Type type; | 176 Type type; |
| 176 | 177 |
| 177 // The number of times that this username/password has been used to | 178 // The number of times that this username/password has been used to |
| 178 // authenticate the user. | 179 // authenticate the user. |
| 179 // | 180 // |
| 180 // When parsing an HTML form, this is not used. | 181 // When parsing an HTML form, this is not used. |
| 181 int times_used; | 182 int times_used; |
| 182 | 183 |
| 184 // Autofill representation of this form. Used to communicate with the |
| 185 // Autofill servers if necessary. Currently this is only used to help |
| 186 // determine forms where we can trigger password generation. |
| 187 // |
| 188 // When parsing an HTML form, this is normally set. |
| 189 FormData form_data; |
| 190 |
| 183 // Returns true if this match was found using public suffix matching. | 191 // Returns true if this match was found using public suffix matching. |
| 184 bool IsPublicSuffixMatch() const; | 192 bool IsPublicSuffixMatch() const; |
| 185 | 193 |
| 194 // Equality operators for testing. |
| 195 bool operator==(const PasswordForm& form) const; |
| 196 bool operator!=(const PasswordForm& form) const; |
| 197 |
| 186 PasswordForm(); | 198 PasswordForm(); |
| 187 ~PasswordForm(); | 199 ~PasswordForm(); |
| 188 }; | 200 }; |
| 189 | 201 |
| 190 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 202 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
| 191 typedef std::map<string16, PasswordForm*> PasswordFormMap; | 203 typedef std::map<string16, PasswordForm*> PasswordFormMap; |
| 192 | 204 |
| 205 // For testing. |
| 206 std::ostream& operator<<(std::ostream& os, |
| 207 const autofill::PasswordForm& form); |
| 208 |
| 193 } // namespace autofill | 209 } // namespace autofill |
| 194 | 210 |
| 195 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ | 211 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ |
| OLD | NEW |