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 CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ | 5 #ifndef CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ |
6 #define CONTENT_PUBLIC_COMMON_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 #include <vector> | 10 #include <vector> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 SCHEME_DIGEST, | 47 SCHEME_DIGEST, |
48 SCHEME_OTHER | 48 SCHEME_OTHER |
49 } scheme; | 49 } scheme; |
50 | 50 |
51 // The "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, and | 51 // The "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, and |
52 // contains the HTTP realm for dialog-based forms). | 52 // contains the HTTP realm for dialog-based forms). |
53 // The signon_realm is effectively the primary key used for retrieving | 53 // The signon_realm is effectively the primary key used for retrieving |
54 // data from the database, so it must not be empty. | 54 // data from the database, so it must not be empty. |
55 std::string signon_realm; | 55 std::string signon_realm; |
56 | 56 |
| 57 // The original "Realm" for the sign-on (scheme, host, port for SCHEME_HTML, |
| 58 // and contains the HTTP realm for dialog-based forms). This realm is only set |
| 59 // when two PasswordForms are matched when trying to find a login/pass pair |
| 60 // for a site. It is only set to a non-empty value during a match of the |
| 61 // original stored login/pass and the current observed form if all these |
| 62 // statements are true: |
| 63 // 1) The full signon_realm is not the same. |
| 64 // 2) The registry controlled domain is the same. For example; foo.bar, |
| 65 // m.foo.bar, baz.login.foo.bar and www.foo.bar would all resolve to foo.bar |
| 66 // if .bar is the public suffix. |
| 67 // 3) The scheme is the same. |
| 68 // 4) The port is the same. |
| 69 // For example, if there exists a stored password for http://www.foo.bar |
| 70 // (where .bar is the public suffix) and the observed form is |
| 71 // http://m.foo.bar, |original_signon_realm| must be set to |
| 72 // http://www.foo.bar. |
| 73 std::string original_signon_realm; |
| 74 |
57 // The URL (minus query parameters) containing the form. This is the primary | 75 // The URL (minus query parameters) containing the form. This is the primary |
58 // data used by the PasswordManager to decide (in longest matching prefix | 76 // data used by the PasswordManager to decide (in longest matching prefix |
59 // fashion) whether or not a given PasswordForm result from the database is a | 77 // fashion) whether or not a given PasswordForm result from the database is a |
60 // good fit for a particular form on a page, so it must not be empty. | 78 // good fit for a particular form on a page, so it must not be empty. |
61 GURL origin; | 79 GURL origin; |
62 | 80 |
63 // The action target of the form. This is the primary data used by the | 81 // The action target of the form. This is the primary data used by the |
64 // PasswordManager for form autofill; that is, the action of the saved | 82 // PasswordManager for form autofill; that is, the action of the saved |
65 // credentials must match the action of the form on the page to be autofilled. | 83 // credentials must match the action of the form on the page to be autofilled. |
66 // If this is empty / not available, it will result in a "restricted" | 84 // If this is empty / not available, it will result in a "restricted" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 174 |
157 // 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 |
158 Type type; | 176 Type type; |
159 | 177 |
160 // 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 |
161 // authenticate the user. | 179 // authenticate the user. |
162 // | 180 // |
163 // When parsing an HTML form, this is not used. | 181 // When parsing an HTML form, this is not used. |
164 int times_used; | 182 int times_used; |
165 | 183 |
| 184 // Returns true if this match was found using public suffix matching. |
| 185 bool IsPublicSuffixMatch() const; |
| 186 |
166 PasswordForm(); | 187 PasswordForm(); |
167 ~PasswordForm(); | 188 ~PasswordForm(); |
168 }; | 189 }; |
169 | 190 |
170 // Map username to PasswordForm* for convenience. See password_form_manager.h. | 191 // Map username to PasswordForm* for convenience. See password_form_manager.h. |
171 typedef std::map<string16, PasswordForm*> PasswordFormMap; | 192 typedef std::map<string16, PasswordForm*> PasswordFormMap; |
172 | 193 |
173 } // namespace content | 194 } // namespace content |
174 | 195 |
175 #endif // CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ | 196 #endif // CONTENT_PUBLIC_COMMON_PASSWORD_FORM_H__ |
OLD | NEW |