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 "webkit/forms/form_data.h" | 10 #include "webkit/forms/form_data.h" |
(...skipping 11 matching lines...) Expand all Loading... | |
22 // 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/ |
23 // password for login, while | 23 // password for login, while |
24 // 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. |
25 // 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 |
26 // 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 |
27 // unless the PasswordManager determined there is an additional risk | 27 // unless the PasswordManager determined there is an additional risk |
28 // 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 |
29 // 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. |
30 struct WEBKIT_FORMS_EXPORT PasswordFormFillData { | 30 struct WEBKIT_FORMS_EXPORT PasswordFormFillData { |
31 typedef std::map<string16, string16> LoginCollection; | 31 typedef std::map<string16, string16> LoginCollection; |
32 // It used to express the kinds of datas that the instance has. | |
33 enum DataType { | |
34 kUsernameAndPassword = 0, | |
35 kOnlyPassword, | |
36 kError, // the instance has wrong datas. | |
37 }; | |
Ilya Sherman
2012/03/22 16:57:44
There should be no need to add this enum -- you ca
Yumikiyo Osanai
2012/03/26 21:23:43
Umm... You are right, it seems to be it's a bit ve
| |
32 | 38 |
39 // You should set a password basic_data.fields[0]. | |
40 // If there's a username, you should set the username basic_data.fields[1]. | |
33 FormData basic_data; | 41 FormData basic_data; |
34 LoginCollection additional_logins; | 42 LoginCollection additional_logins; |
35 bool wait_for_username; | 43 bool wait_for_username; |
36 PasswordFormFillData(); | 44 PasswordFormFillData(); |
37 ~PasswordFormFillData(); | 45 ~PasswordFormFillData(); |
46 | |
47 // Get the username field from basic_data. | |
48 // If it hasn't any username, calls NOTREACHED(). | |
49 const FormField& GetUsernameField() const; | |
50 | |
51 // Get the username field from basic_data. | |
52 const FormField& GetPasswordField() const; | |
53 | |
54 // Get the DataType. | |
55 // This function judge the datatype with basic_data. | |
56 // If basic_data.size() == 2, it judges I have username and password. | |
57 // If basic_data.size() == 1, it judges I have only password. | |
58 // Otherwise, it judges I have wrong datas. | |
59 DataType GetDataType() const; | |
Ilya Sherman
2012/03/22 16:57:44
There should be no need to add these methods. Thi
Yumikiyo Osanai
2012/03/26 21:23:43
I agree with your idea.
I remove these member meth
| |
38 }; | 60 }; |
39 | 61 |
40 class PasswordFormDomManager { | 62 class PasswordFormDomManager { |
41 public: | 63 public: |
42 // Create a PasswordForm from DOM form. Webkit doesn't allow storing | 64 // 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 | 65 // 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 | 66 // happens with a given form and compare against previously Create'd forms |
45 // to identify..which sucks. | 67 // to identify..which sucks. |
46 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm( | 68 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm( |
47 const WebKit::WebFormElement& form); | 69 const WebKit::WebFormElement& form); |
(...skipping 10 matching lines...) Expand all Loading... | |
58 bool wait_for_username_before_autofill, | 80 bool wait_for_username_before_autofill, |
59 PasswordFormFillData* result); | 81 PasswordFormFillData* result); |
60 private: | 82 private: |
61 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); | 83 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); |
62 }; | 84 }; |
63 | 85 |
64 } // namespace forms | 86 } // namespace forms |
65 } // namespace webkit | 87 } // namespace webkit |
66 | 88 |
67 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ | 89 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ |
OLD | NEW |