| 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_DOM_MANAGER_H_ | 5 #ifndef WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H_ |
| 6 #define WEBKIT_FORMS_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 "base/memory/scoped_ptr.h" |
| 10 #include "webkit/forms/form_data.h" | 11 #include "webkit/forms/form_data.h" |
| 11 #include "webkit/forms/password_form.h" | 12 #include "webkit/forms/password_form.h" |
| 12 #include "webkit/forms/webkit_forms_export.h" | 13 #include "webkit/forms/webkit_forms_export.h" |
| 13 | 14 |
| 14 namespace WebKit { | 15 namespace WebKit { |
| 15 class WebForm; | 16 class WebForm; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace webkit { | 19 namespace webkit { |
| 19 namespace forms { | 20 namespace forms { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 36 PasswordFormFillData(); | 37 PasswordFormFillData(); |
| 37 ~PasswordFormFillData(); | 38 ~PasswordFormFillData(); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 class PasswordFormDomManager { | 41 class PasswordFormDomManager { |
| 41 public: | 42 public: |
| 42 // Create a PasswordForm from DOM form. Webkit doesn't allow storing | 43 // Create a PasswordForm from DOM form. Webkit doesn't allow storing |
| 43 // custom metadata to DOM nodes, so we have to do this every time an event | 44 // custom metadata to DOM nodes, so we have to do this every time an event |
| 44 // happens with a given form and compare against previously Create'd forms | 45 // happens with a given form and compare against previously Create'd forms |
| 45 // to identify..which sucks. | 46 // to identify..which sucks. |
| 46 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm( | 47 WEBKIT_FORMS_EXPORT static scoped_ptr<PasswordForm> CreatePasswordForm( |
| 47 const WebKit::WebFormElement& form); | 48 const WebKit::WebFormElement& form); |
| 48 | 49 |
| 49 // Create a FillData structure in preparation for autofilling a form, | 50 // Create a FillData structure in preparation for autofilling a form, |
| 50 // from basic_data identifying which form to fill, and a collection of | 51 // from basic_data identifying which form to fill, and a collection of |
| 51 // matching stored logins to use as username/password values. | 52 // matching stored logins to use as username/password values. |
| 52 // preferred_match should equal (address) one of matches. | 53 // preferred_match should equal (address) one of matches. |
| 53 // wait_for_username_before_autofill is true if we should not autofill | 54 // wait_for_username_before_autofill is true if we should not autofill |
| 54 // anything until the user typed in a valid username and blurred the field. | 55 // anything until the user typed in a valid username and blurred the field. |
| 55 WEBKIT_FORMS_EXPORT static void InitFillData(const PasswordForm& form_on_page, | 56 WEBKIT_FORMS_EXPORT static void InitFillData(const PasswordForm& form_on_page, |
| 56 const PasswordFormMap& matches, | 57 const PasswordFormMap& matches, |
| 57 const PasswordForm* const preferred_match, | 58 const PasswordForm* const preferred_match, |
| 58 bool wait_for_username_before_autofill, | 59 bool wait_for_username_before_autofill, |
| 59 PasswordFormFillData* result); | 60 PasswordFormFillData* result); |
| 60 private: | 61 private: |
| 61 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); | 62 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); |
| 62 }; | 63 }; |
| 63 | 64 |
| 64 } // namespace forms | 65 } // namespace forms |
| 65 } // namespace webkit | 66 } // namespace webkit |
| 66 | 67 |
| 67 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ | 68 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ |
| OLD | NEW |