OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FORMS_PASSWORD_FORM_H__ | 5 #ifndef CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ |
6 #define WEBKIT_FORMS_PASSWORD_FORM_H__ | 6 #define CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/time.h" | 11 #include "base/time.h" |
| 12 #include "content/common/content_export.h" |
12 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h
" | |
14 #include "webkit/forms/webkit_forms_export.h" | |
15 | 14 |
16 namespace webkit { | 15 namespace content { |
17 namespace forms { | |
18 | 16 |
19 // The PasswordForm struct encapsulates information about a login form, | 17 // The PasswordForm struct encapsulates information about a login form, |
20 // which can be an HTML form or a dialog with username/password text fields. | 18 // which can be an HTML form or a dialog with username/password text fields. |
21 // | 19 // |
22 // The Web Data database stores saved username/passwords and associated form | 20 // The Web Data database stores saved username/passwords and associated form |
23 // metdata using a PasswordForm struct, typically one that was created from | 21 // metdata using a PasswordForm struct, typically one that was created from |
24 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have | 22 // a parsed HTMLFormElement or LoginDialog, but the saved entries could have |
25 // also been created by imported data from another browser. | 23 // also been created by imported data from another browser. |
26 // | 24 // |
27 // The PasswordManager implements a fuzzy-matching algorithm to compare saved | 25 // The PasswordManager implements a fuzzy-matching algorithm to compare saved |
28 // PasswordForm entries against PasswordForms that were created from a parsed | 26 // PasswordForm entries against PasswordForms that were created from a parsed |
29 // 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 |
30 // 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 |
31 // 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 |
32 // accurately. But it is not always possible, especially when importing from | 30 // accurately. But it is not always possible, especially when importing from |
33 // 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 |
34 // about a particular "saved password entry" to our PasswordForm | 32 // about a particular "saved password entry" to our PasswordForm |
35 // representation. | 33 // representation. |
36 // | 34 // |
37 // The field descriptions in the struct specification below are intended to | 35 // The field descriptions in the struct specification below are intended to |
38 // describe which fields are not strictly required when adding a saved password | 36 // describe which fields are not strictly required when adding a saved password |
39 // 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. |
40 | 38 |
41 struct WEBKIT_FORMS_EXPORT PasswordForm { | 39 struct CONTENT_EXPORT PasswordForm { |
42 // Enum to differentiate between HTML form based authentication, and dialogs | 40 // Enum to differentiate between HTML form based authentication, and dialogs |
43 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms | 41 // using basic or digest schemes. Default is SCHEME_HTML. Only PasswordForms |
44 // of the same Scheme will be matched/autofilled against each other. | 42 // of the same Scheme will be matched/autofilled against each other. |
45 enum Scheme { | 43 enum Scheme { |
46 SCHEME_HTML, | 44 SCHEME_HTML, |
47 SCHEME_BASIC, | 45 SCHEME_BASIC, |
48 SCHEME_DIGEST, | 46 SCHEME_DIGEST, |
49 SCHEME_OTHER | 47 SCHEME_OTHER |
50 } scheme; | 48 } scheme; |
51 | 49 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 // generated passwords. | 139 // generated passwords. |
142 enum Type { | 140 enum Type { |
143 TYPE_MANUAL, | 141 TYPE_MANUAL, |
144 TYPE_GENERATED, | 142 TYPE_GENERATED, |
145 }; | 143 }; |
146 | 144 |
147 // The form type. Not used yet. Please see http://crbug.com/152422 | 145 // The form type. Not used yet. Please see http://crbug.com/152422 |
148 Type type; | 146 Type type; |
149 | 147 |
150 PasswordForm(); | 148 PasswordForm(); |
151 PasswordForm(const WebKit::WebPasswordFormData& web_password_form); | |
152 ~PasswordForm(); | 149 ~PasswordForm(); |
153 }; | 150 }; |
154 | 151 |
155 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 152 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
156 typedef std::map<string16, PasswordForm*> PasswordFormMap; | 153 typedef std::map<string16, PasswordForm*> PasswordFormMap; |
157 | 154 |
158 } // namespace forms | 155 } // namespace content |
159 } // namespace webkit | |
160 | 156 |
161 #endif // WEBKIT_FORMS_PASSWORD_FORM_H__ | 157 #endif // CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ |
OLD | NEW |