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 // A layout characterises the sequence of non-password text and password input | |
63 // fields of which the form is made. It is defined as a regular language over | |
64 // the alphabet {N, P} (indicating Non-password and Password fields); e.g., a | |
65 // layout NPN+PP characterises all forms which have a single non-password | |
66 // field followed by a single password field, followed by 1 or more | |
67 // non-password fields, followed by 2 password fields. | |
68 // For most forms we do not care about the layout (those have LAYOUT_OTHER), | |
69 // but for special cases we might need to know it: e.g., the NPN+PP forms can | |
70 // be a login form glued to a sign-up form, and the "N+" part is what | |
71 // distinguishes such forms from change-password forms. | |
72 // A layout is useful for understanding parsed forms and deciding whether to | |
73 // fill them, but it is not stored. | |
Garrett Casto
2015/03/17 22:49:37
This comment seems like more information than is n
vabr (Chromium)
2015/03/18 16:51:03
Good point, I tried to rephrase.
| |
74 enum class Layout { | |
75 LAYOUT_OTHER, | |
76 LAYOUT_LOGIN_AND_SIGNUP, // NPN+PP | |
77 LAYOUT_LAST = LAYOUT_LOGIN_AND_SIGNUP | |
78 }; | |
79 | |
62 // The "Realm" for the sign-on. This is scheme, host, port for SCHEME_HTML. | 80 // 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 | 81 // 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>" | 82 // contain a string of the form "android://<hash of cert>@<package name>" |
65 // | 83 // |
66 // The signon_realm is effectively the primary key used for retrieving | 84 // The signon_realm is effectively the primary key used for retrieving |
67 // data from the database, so it must not be empty. | 85 // data from the database, so it must not be empty. |
68 std::string signon_realm; | 86 std::string signon_realm; |
69 | 87 |
70 // The original "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, | 88 // 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 | 89 // 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; | 249 GURL avatar_url; |
232 | 250 |
233 // The URL of identity provider used for federated login. | 251 // The URL of identity provider used for federated login. |
234 GURL federation_url; | 252 GURL federation_url; |
235 | 253 |
236 // If true, Chrome will not return this credential to a site in response to | 254 // If true, Chrome will not return this credential to a site in response to |
237 // 'navigator.credentials.request()' without user interaction. | 255 // 'navigator.credentials.request()' without user interaction. |
238 // Once user selects this credential the flag is reseted. | 256 // Once user selects this credential the flag is reseted. |
239 bool skip_zero_click; | 257 bool skip_zero_click; |
240 | 258 |
259 // The layout as determined during parsing. Default value is LAYOUT_OTHER. | |
260 Layout layout; | |
261 | |
241 // Returns true if this match was found using public suffix matching. | 262 // Returns true if this match was found using public suffix matching. |
242 bool IsPublicSuffixMatch() const; | 263 bool IsPublicSuffixMatch() const; |
243 | 264 |
244 // Equality operators for testing. | 265 // Equality operators for testing. |
245 bool operator==(const PasswordForm& form) const; | 266 bool operator==(const PasswordForm& form) const; |
246 bool operator!=(const PasswordForm& form) const; | 267 bool operator!=(const PasswordForm& form) const; |
247 | 268 |
248 PasswordForm(); | 269 PasswordForm(); |
249 ~PasswordForm(); | 270 ~PasswordForm(); |
250 }; | 271 }; |
251 | 272 |
252 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 273 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
253 typedef std::map<base::string16, PasswordForm*> PasswordFormMap; | 274 typedef std::map<base::string16, PasswordForm*> PasswordFormMap; |
254 | 275 |
255 typedef std::map<base::string16, const PasswordForm*> ConstPasswordFormMap; | 276 typedef std::map<base::string16, const PasswordForm*> ConstPasswordFormMap; |
256 | 277 |
257 // For testing. | 278 // For testing. |
279 std::ostream& operator<<(std::ostream& os, PasswordForm::Layout layout); | |
258 std::ostream& operator<<(std::ostream& os, | 280 std::ostream& operator<<(std::ostream& os, |
259 const autofill::PasswordForm& form); | 281 const autofill::PasswordForm& form); |
260 | 282 |
261 } // namespace autofill | 283 } // namespace autofill |
262 | 284 |
263 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ | 285 #endif // COMPONENTS_AUTOFILL_CORE_COMMON_PASSWORD_FORM_H__ |
OLD | NEW |