| 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_GLUE_PASSWORD_FORM_DOM_MANAGER_H_ | 5 #ifndef WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H_ |
| 6 #define WEBKIT_GLUE_PASSWORD_FORM_DOM_MANAGER_H_ | 6 #define WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "webkit/glue/form_data.h" | 10 #include "webkit/forms/form_data.h" |
| 11 #include "webkit/glue/password_form.h" | 11 #include "webkit/forms/password_form.h" |
| 12 #include "webkit/glue/webkit_glue_export.h" | 12 #include "webkit/forms/webkit_forms_export.h" |
| 13 | 13 |
| 14 namespace WebKit { | 14 namespace WebKit { |
| 15 class WebForm; | 15 class WebForm; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace webkit_glue { | 18 namespace webkit { |
| 19 namespace forms { |
| 19 | 20 |
| 20 // Structure used for autofilling password forms. | 21 // Structure used for autofilling password forms. |
| 21 // basic_data identifies the HTML form on the page and preferred username/ | 22 // basic_data identifies the HTML form on the page and preferred username/ |
| 22 // password for login, while | 23 // password for login, while |
| 23 // additional_logins is a list of other matching user/pass pairs for the form. | 24 // additional_logins is a list of other matching user/pass pairs for the form. |
| 24 // wait_for_username tells us whether we need to wait for the user to enter | 25 // wait_for_username tells us whether we need to wait for the user to enter |
| 25 // a valid username before we autofill the password. By default, this is off | 26 // a valid username before we autofill the password. By default, this is off |
| 26 // unless the PasswordManager determined there is an additional risk | 27 // unless the PasswordManager determined there is an additional risk |
| 27 // associated with this form. This can happen, for example, if action URI's | 28 // associated with this form. This can happen, for example, if action URI's |
| 28 // of the observed form and our saved representation don't match up. | 29 // of the observed form and our saved representation don't match up. |
| 29 struct WEBKIT_GLUE_EXPORT PasswordFormFillData { | 30 struct WEBKIT_FORMS_EXPORT PasswordFormFillData { |
| 30 typedef std::map<string16, string16> LoginCollection; | 31 typedef std::map<string16, string16> LoginCollection; |
| 31 | 32 |
| 32 FormData basic_data; | 33 FormData basic_data; |
| 33 LoginCollection additional_logins; | 34 LoginCollection additional_logins; |
| 34 bool wait_for_username; | 35 bool wait_for_username; |
| 35 PasswordFormFillData(); | 36 PasswordFormFillData(); |
| 36 ~PasswordFormFillData(); | 37 ~PasswordFormFillData(); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 class PasswordFormDomManager { | 40 class PasswordFormDomManager { |
| 40 public: | 41 public: |
| 41 // Create a PasswordForm from DOM form. Webkit doesn't allow storing | 42 // Create a PasswordForm from DOM form. Webkit doesn't allow storing |
| 42 // custom metadata to DOM nodes, so we have to do this every time an event | 43 // custom metadata to DOM nodes, so we have to do this every time an event |
| 43 // happens with a given form and compare against previously Create'd forms | 44 // happens with a given form and compare against previously Create'd forms |
| 44 // to identify..which sucks. | 45 // to identify..which sucks. |
| 45 WEBKIT_GLUE_EXPORT static PasswordForm* CreatePasswordForm( | 46 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm( |
| 46 const WebKit::WebFormElement& form); | 47 const WebKit::WebFormElement& form); |
| 47 | 48 |
| 48 // Create a FillData structure in preparation for autofilling a form, | 49 // Create a FillData structure in preparation for autofilling a form, |
| 49 // from basic_data identifying which form to fill, and a collection of | 50 // from basic_data identifying which form to fill, and a collection of |
| 50 // matching stored logins to use as username/password values. | 51 // matching stored logins to use as username/password values. |
| 51 // preferred_match should equal (address) one of matches. | 52 // preferred_match should equal (address) one of matches. |
| 52 // wait_for_username_before_autofill is true if we should not autofill | 53 // wait_for_username_before_autofill is true if we should not autofill |
| 53 // anything until the user typed in a valid username and blurred the field. | 54 // anything until the user typed in a valid username and blurred the field. |
| 54 WEBKIT_GLUE_EXPORT static void InitFillData(const PasswordForm& form_on_page, | 55 WEBKIT_FORMS_EXPORT static void InitFillData(const PasswordForm& form_on_page, |
| 55 const PasswordFormMap& matches, | 56 const PasswordFormMap& matches, |
| 56 const PasswordForm* const preferred_match, | 57 const PasswordForm* const preferred_match, |
| 57 bool wait_for_username_before_autofill, | 58 bool wait_for_username_before_autofill, |
| 58 PasswordFormFillData* result); | 59 PasswordFormFillData* result); |
| 59 private: | 60 private: |
| 60 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); | 61 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace webkit_glue | 64 } // namespace forms |
| 65 } // namespace webkit |
| 64 | 66 |
| 65 #endif // WEBKIT_GLUE_PASSWORD_FORM_DOM_MANAGER_H__ | 67 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ |
| OLD | NEW |