Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1526)

Side by Side Diff: webkit/forms/password_form_dom_manager.h

Issue 9625026: Save password without an associated username. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: Modify the errors from Lint Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
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 32
33 // It used to express the kinds of datas that the instance has.
34 enum DataType {
35 kUsernameAndPassword = 0,
36 kOnlyPassword,
37 kError, // the instance has wrong datas.
38 };
Ilya Sherman 2012/03/20 23:39:43 Hmm, I don't much like all this extra complexity i
Yumikiyo Osanai 2012/03/21 18:01:37 I've changed to reverse the order of username and
39
40 // You should set username and password in basic_data as below.
41 // 1. If you would like to set a username and a password in it,
42 // - You should set the username basic_data.fields[0]
43 // - You should set the password basic_data.fields[1]
44 // 2. If you would like to set only a password in it,
45 // - You should set the password basic_data.fields[0]
33 FormData basic_data; 46 FormData basic_data;
34 LoginCollection additional_logins; 47 LoginCollection additional_logins;
35 bool wait_for_username; 48 bool wait_for_username;
49
36 PasswordFormFillData(); 50 PasswordFormFillData();
37 ~PasswordFormFillData(); 51 ~PasswordFormFillData();
52
53 // Get the username field from basic_data.
54 // If it hasn't any username, calls NOTREACHED().
55 const FormField& GetUsernameField() const;
56
57 // Get the username field from basic_data.
58 const FormField& GetPasswordField() const;
59
60 // Get the DataType.
61 // This function judge the datatype with basic_data.
62 // If basic_data.size() == 2, it judges I have username and password.
63 // If basic_data.size() == 1, it judges I have only password.
64 // Otherwise, it judges I have wrong datas.
65 DataType GetDataType() const;
38 }; 66 };
39 67
40 class PasswordFormDomManager { 68 class PasswordFormDomManager {
41 public: 69 public:
42 // Create a PasswordForm from DOM form. Webkit doesn't allow storing 70 // 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 71 // 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 72 // happens with a given form and compare against previously Create'd forms
45 // to identify..which sucks. 73 // to identify..which sucks.
46 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm( 74 WEBKIT_FORMS_EXPORT static PasswordForm* CreatePasswordForm(
47 const WebKit::WebFormElement& form); 75 const WebKit::WebFormElement& form);
(...skipping 10 matching lines...) Expand all
58 bool wait_for_username_before_autofill, 86 bool wait_for_username_before_autofill,
59 PasswordFormFillData* result); 87 PasswordFormFillData* result);
60 private: 88 private:
61 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager); 89 DISALLOW_IMPLICIT_CONSTRUCTORS(PasswordFormDomManager);
62 }; 90 };
63 91
64 } // namespace forms 92 } // namespace forms
65 } // namespace webkit 93 } // namespace webkit
66 94
67 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__ 95 #endif // WEBKIT_FORMS_PASSWORD_FORM_DOM_MANAGER_H__
OLDNEW
« no previous file with comments | « chrome/renderer/autofill/password_autofill_manager.cc ('k') | webkit/forms/password_form_dom_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698