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> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms | 52 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms |
53 // of the same Scheme will be matched/autofilled against each other. | 53 // of the same Scheme will be matched/autofilled against each other. |
54 enum Scheme { | 54 enum Scheme { |
55 SCHEME_HTML, | 55 SCHEME_HTML, |
56 SCHEME_BASIC, | 56 SCHEME_BASIC, |
57 SCHEME_DIGEST, | 57 SCHEME_DIGEST, |
58 SCHEME_OTHER, | 58 SCHEME_OTHER, |
59 SCHEME_LAST = SCHEME_OTHER | 59 SCHEME_LAST = SCHEME_OTHER |
60 } scheme; | 60 } scheme; |
61 | 61 |
| 62 // During form parsing, Chrome tries to partly understand the type of the form |
| 63 // based on the layout of its fields. The result of this analysis helps to |
| 64 // treat the form correctly once the low-level information is lost by |
| 65 // converting the web form into a PasswordForm. It is only used for observed |
| 66 // HTML forms, not for stored credentials. |
| 67 enum class Layout { |
| 68 // Forms which either do not need to be classified, or cannot be classified |
| 69 // meaningfully. |
| 70 LAYOUT_OTHER, |
| 71 // Login and signup forms combined in one <form>, to distinguish them from, |
| 72 // e.g., change-password forms. |
| 73 LAYOUT_LOGIN_AND_SIGNUP, |
| 74 LAYOUT_LAST = LAYOUT_LOGIN_AND_SIGNUP |
| 75 }; |
| 76 |
62 // The "Realm" for the sign-on. This is scheme, host, port for SCHEME_HTML. | 77 // The "Realm" for the sign-on. This is scheme, host, port for SCHEME_HTML. |
63 // Dialog based forms also contain the HTTP realm. Android based forms will | 78 // Dialog based forms also contain the HTTP realm. Android based forms will |
64 // contain a string of the form "android://<hash of cert>@<package name>" | 79 // contain a string of the form "android://<hash of cert>@<package name>" |
65 // | 80 // |
66 // The signon_realm is effectively the primary key used for retrieving | 81 // The signon_realm is effectively the primary key used for retrieving |
67 // data from the database, so it must not be empty. | 82 // data from the database, so it must not be empty. |
68 std::string signon_realm; | 83 std::string signon_realm; |
69 | 84 |
70 // The original "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, | 85 // The original "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, |
71 // and contains the HTTP realm for dialog-based forms). This realm is only set | 86 // and contains the HTTP realm for dialog-based forms). This realm is only set |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 GURL avatar_url; | 246 GURL avatar_url; |
232 | 247 |
233 // The URL of identity provider used for federated login. | 248 // The URL of identity provider used for federated login. |
234 GURL federation_url; | 249 GURL federation_url; |
235 | 250 |
236 // If true, Chrome will not return this credential to a site in response to | 251 // If true, Chrome will not return this credential to a site in response to |
237 // 'navigator.credentials.request()' without user interaction. | 252 // 'navigator.credentials.request()' without user interaction. |
238 // Once user selects this credential the flag is reseted. | 253 // Once user selects this credential the flag is reseted. |
239 bool skip_zero_click; | 254 bool skip_zero_click; |
240 | 255 |
| 256 // The layout as determined during parsing. Default value is LAYOUT_OTHER. |
| 257 Layout layout; |
| 258 |
241 // Returns true if this match was found using public suffix matching. | 259 // Returns true if this match was found using public suffix matching. |
242 bool IsPublicSuffixMatch() const; | 260 bool IsPublicSuffixMatch() const; |
243 | 261 |
244 // Equality operators for testing. | 262 // Equality operators for testing. |
245 bool operator==(const PasswordForm& form) const; | 263 bool operator==(const PasswordForm& form) const; |
246 bool operator!=(const PasswordForm& form) const; | 264 bool operator!=(const PasswordForm& form) const; |
247 | 265 |
248 PasswordForm(); | 266 PasswordForm(); |
249 ~PasswordForm(); | 267 ~PasswordForm(); |
250 }; | 268 }; |
251 | 269 |
252 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 270 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
253 typedef std::map<base::string16, PasswordForm*> PasswordFormMap; | 271 typedef std::map<base::string16, PasswordForm*> PasswordFormMap; |
254 | 272 |
255 typedef std::map<base::string16, const PasswordForm*> ConstPasswordFormMap; | 273 typedef std::map<base::string16, const PasswordForm*> ConstPasswordFormMap; |
256 | 274 |
257 // For testing. | 275 // For testing. |
| 276 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout); |
258 std::ostream& operator<<(std::ostream& os, | 277 std::ostream& operator<<(std::ostream& os, |
259 const autofill::PasswordForm& form); | 278 const autofill::PasswordForm& form); |
260 | 279 |
261 } // namespace autofill | 280 } // namespace autofill |
262 | 281 |
263 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ | 282 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ |
OLD | NEW |