OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 WEBKIT_GLUE_PASSWORD_FORM_H__ | 5 #ifndef WEBKIT_GLUE_PASSWORD_FORM_H__ |
6 #define WEBKIT_GLUE_PASSWORD_FORM_H__ | 6 #define WEBKIT_GLUE_PASSWORD_FORM_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <map> | 9 #include <map> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 // The PasswordManager implements a fuzzy-matching algorithm to compare saved | 25 // The PasswordManager implements a fuzzy-matching algorithm to compare saved |
26 // PasswordForm entries against PasswordForms that were created from a parsed | 26 // PasswordForm entries against PasswordForms that were created from a parsed |
27 // HTML or dialog form. As one might expect, the more data contained in one | 27 // HTML or dialog form. As one might expect, the more data contained in one |
28 // of the saved PasswordForms, the better the job the PasswordManager can do | 28 // of the saved PasswordForms, the better the job the PasswordManager can do |
29 // in matching it against the actual form it was saved on, and autofill | 29 // in matching it against the actual form it was saved on, and autofill |
30 // accurately. But it is not always possible, especially when importing from | 30 // accurately. But it is not always possible, especially when importing from |
31 // other browsers with different data models, to copy over all the information | 31 // other browsers with different data models, to copy over all the information |
32 // about a particular "saved password entry" to our PasswordForm | 32 // about a particular "saved password entry" to our PasswordForm |
33 // representation. | 33 // representation. |
34 // | 34 // |
35 // The field descriptions in the struct specification below are | 35 // The field descriptions in the struct specification below are intended to |
36 // intended to describe which fields are not strictly required when adding a sav
ed | 36 // describe which fields are not strictly required when adding a saved password |
37 // password entry to the database and how they can affect the matching process. | 37 // entry to the database and how they can affect the matching process. |
38 | 38 |
39 struct PasswordForm { | 39 struct PasswordForm { |
40 // Enum to differentiate between HTML form based authentication, and dialogs | 40 // Enum to differentiate between HTML form based authentication, and dialogs |
41 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms | 41 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms |
42 // of the same Scheme will be matched/autofilled against each other. | 42 // of the same Scheme will be matched/autofilled against each other. |
43 enum Scheme { | 43 enum Scheme { |
44 SCHEME_HTML, | 44 SCHEME_HTML, |
45 SCHEME_BASIC, | 45 SCHEME_BASIC, |
46 SCHEME_DIGEST, | 46 SCHEME_DIGEST, |
47 SCHEME_OTHER | 47 SCHEME_OTHER |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 // | 128 // |
129 // When parsing an HTML form, this is not used. | 129 // When parsing an HTML form, this is not used. |
130 base::Time date_created; | 130 base::Time date_created; |
131 | 131 |
132 // Tracks if the user opted to never remember passwords for this form. Default | 132 // Tracks if the user opted to never remember passwords for this form. Default |
133 // to false. | 133 // to false. |
134 // | 134 // |
135 // When parsing an HTML form, this is not used. | 135 // When parsing an HTML form, this is not used. |
136 bool blacklisted_by_user; | 136 bool blacklisted_by_user; |
137 | 137 |
138 PasswordForm() | 138 PasswordForm(); |
139 : scheme(SCHEME_HTML), | 139 PasswordForm(const WebKit::WebPasswordFormData& web_password_form); |
140 ssl_valid(false), | 140 ~PasswordForm(); |
141 preferred(false), | |
142 blacklisted_by_user(false) { | |
143 } | |
144 | |
145 PasswordForm(const WebKit::WebPasswordFormData& web_password_form) | |
146 : scheme(SCHEME_HTML), | |
147 signon_realm(web_password_form.signonRealm.utf8()), | |
148 origin(web_password_form.origin), | |
149 action(web_password_form.action), | |
150 submit_element(web_password_form.submitElement), | |
151 username_element(web_password_form.userNameElement), | |
152 username_value(web_password_form.userNameValue), | |
153 password_element(web_password_form.passwordElement), | |
154 password_value(web_password_form.passwordValue), | |
155 old_password_element(web_password_form.oldPasswordElement), | |
156 old_password_value(web_password_form.oldPasswordValue), | |
157 ssl_valid(false), | |
158 preferred(false), | |
159 blacklisted_by_user(false) { | |
160 } | |
161 }; | 141 }; |
162 | 142 |
163 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 143 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
164 typedef std::map<string16, PasswordForm*> PasswordFormMap; | 144 typedef std::map<string16, PasswordForm*> PasswordFormMap; |
165 | 145 |
166 } // namespace webkit_glue | 146 } // namespace webkit_glue |
167 | 147 |
168 #endif // WEBKIT_GLUE_PASSWORD_FORM_H__ | 148 #endif // WEBKIT_GLUE_PASSWORD_FORM_H__ |
OLD | NEW |