OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
64 // conceivable that a user (or ui test) could attempt to submit a login | 64 // conceivable that a user (or ui test) could attempt to submit a login |
65 // prompt before the callback has occured, which would InvokeLater a call to | 65 // prompt before the callback has occured, which would InvokeLater a call to |
66 // PasswordManager::ProvisionallySave, which would interact with this object | 66 // PasswordManager::ProvisionallySave, which would interact with this object |
67 // before the db has had time to answer with matching password entries. | 67 // before the db has had time to answer with matching password entries. |
68 // This is intended to be a one-time check; if the return value is false the | 68 // This is intended to be a one-time check; if the return value is false the |
69 // expectation is caller will give up. This clearly won't work if you put it | 69 // expectation is caller will give up. This clearly won't work if you put it |
70 // in a loop and wait for matching to complete; you're (supposed to be) on | 70 // in a loop and wait for matching to complete; you're (supposed to be) on |
71 // the same thread! | 71 // the same thread! |
72 bool HasCompletedMatching(); | 72 bool HasCompletedMatching(); |
73 | 73 |
74 // Sets |should_save_password_| to true which means the password will be | |
75 // saved upon the next navigation. | |
Garrett Casto
2013/09/03 23:46:43
I try to write comments in the header as a consume
npentrel
2013/09/04 08:32:23
Done.
| |
76 void SavePassword(); | |
77 | |
78 // Sets |should_blacklist_password_| to true which means the password will be | |
79 // blacklisted upon the next navigation. | |
Garrett Casto
2013/09/03 23:46:43
Similar to above.
npentrel
2013/09/04 08:32:23
Done.
| |
80 void BlacklistPassword(); | |
81 | |
82 // Applies the change, i.e. saves or blacklists password according to | |
83 // |should_blacklist_password_| and |should_save_password_|. | |
Garrett Casto
2013/09/03 23:46:43
Something like "Persist changes from the latest ca
npentrel
2013/09/04 08:32:23
Done.
| |
84 void ApplyChange(); | |
85 | |
74 // Determines if the user opted to 'never remember' passwords for this form. | 86 // Determines if the user opted to 'never remember' passwords for this form. |
75 bool IsBlacklisted(); | 87 bool IsBlacklisted(); |
76 | 88 |
77 // Used by PasswordManager to determine whether or not to display | 89 // Used by PasswordManager to determine whether or not to display |
78 // a SavePasswordBar when given the green light to save the PasswordForm | 90 // a SavePasswordBar when given the green light to save the PasswordForm |
79 // managed by this. | 91 // managed by this. |
80 bool IsNewLogin(); | 92 bool IsNewLogin(); |
81 | 93 |
82 // Returns true if the current pending credentials were found using | 94 // Returns true if the current pending credentials were found using |
83 // origin matching of the public suffix, instead of the signon realm of the | 95 // origin matching of the public suffix, instead of the signon realm of the |
(...skipping 13 matching lines...) Expand all Loading... | |
97 void OnRequestDone(const std::vector<content::PasswordForm*>& result); | 109 void OnRequestDone(const std::vector<content::PasswordForm*>& result); |
98 | 110 |
99 // PasswordStoreConsumer implementation. | 111 // PasswordStoreConsumer implementation. |
100 virtual void OnPasswordStoreRequestDone( | 112 virtual void OnPasswordStoreRequestDone( |
101 CancelableRequestProvider::Handle handle, | 113 CancelableRequestProvider::Handle handle, |
102 const std::vector<content::PasswordForm*>& result) OVERRIDE; | 114 const std::vector<content::PasswordForm*>& result) OVERRIDE; |
103 virtual void OnGetPasswordStoreResults( | 115 virtual void OnGetPasswordStoreResults( |
104 const std::vector<content::PasswordForm*>& results) OVERRIDE; | 116 const std::vector<content::PasswordForm*>& results) OVERRIDE; |
105 | 117 |
106 // A user opted to 'never remember' passwords for this form. | 118 // A user opted to 'never remember' passwords for this form. |
107 // Blacklist it so that from now on when it is seen we ignore it. | 119 // Blacklist it so that from now on when it is seen we ignore it. |
Garrett Casto
2013/09/03 23:46:43
Add a TODO here to make this private once we switc
npentrel
2013/09/04 08:32:23
Done.
| |
108 void PermanentlyBlacklist(); | 120 void PermanentlyBlacklist(); |
109 | 121 |
110 // If the user has submitted observed_form_, provisionally hold on to | 122 // If the user has submitted observed_form_, provisionally hold on to |
111 // the submitted credentials until we are told by PasswordManager whether | 123 // the submitted credentials until we are told by PasswordManager whether |
112 // or not the login was successful. |action| describes how we deal with | 124 // or not the login was successful. |action| describes how we deal with |
113 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will | 125 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will |
114 // treat a possible usernames match as a sign that our original heuristics | 126 // treat a possible usernames match as a sign that our original heuristics |
115 // were wrong and that the user selected the correct username from the | 127 // were wrong and that the user selected the correct username from the |
116 // Autofill UI. | 128 // Autofill UI. |
117 void ProvisionallySave(const content::PasswordForm& credentials, | 129 void ProvisionallySave(const content::PasswordForm& credentials, |
118 OtherPossibleUsernamesAction action); | 130 OtherPossibleUsernamesAction action); |
119 | 131 |
120 // Handles save-as-new or update of the form managed by this manager. | 132 // Handles save-as-new or update of the form managed by this manager. |
121 // Note the basic data of updated_credentials must match that of | 133 // Note the basic data of updated_credentials must match that of |
122 // observed_form_ (e.g DoesManage(pending_credentials_) == true). | 134 // observed_form_ (e.g DoesManage(pending_credentials_) == true). |
Garrett Casto
2013/09/03 23:46:43
Same here.
npentrel
2013/09/04 08:32:23
Done.
| |
123 void Save(); | 135 void Save(); |
124 | 136 |
125 // Call these if/when we know the form submission worked or failed. | 137 // Call these if/when we know the form submission worked or failed. |
126 // These routines are used to update internal statistics ("ActionsTaken"). | 138 // These routines are used to update internal statistics ("ActionsTaken"). |
127 void SubmitPassed(); | 139 void SubmitPassed(); |
128 void SubmitFailed(); | 140 void SubmitFailed(); |
129 | 141 |
130 // Return the username associated with the credentials. | 142 // Return the username associated with the credentials. |
131 const string16& associated_username() const { | 143 const string16& associated_username() const { |
132 return pending_credentials_.username_value; | 144 return pending_credentials_.username_value; |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
284 // Web contents from which we get the RenderViewHost for sending messages to | 296 // Web contents from which we get the RenderViewHost for sending messages to |
285 // the corresponding renderer. | 297 // the corresponding renderer. |
286 content::WebContents* web_contents_; | 298 content::WebContents* web_contents_; |
287 | 299 |
288 // These three fields record the "ActionsTaken" by the browser and | 300 // These three fields record the "ActionsTaken" by the browser and |
289 // the user with this form, and the result. They are combined and | 301 // the user with this form, and the result. They are combined and |
290 // recorded in UMA when the manager is destroyed. | 302 // recorded in UMA when the manager is destroyed. |
291 ManagerAction manager_action_; | 303 ManagerAction manager_action_; |
292 UserAction user_action_; | 304 UserAction user_action_; |
293 SubmitResult submit_result_; | 305 SubmitResult submit_result_; |
306 bool should_save_password_; | |
307 bool should_blacklist_password_; | |
294 | 308 |
295 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 309 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
296 }; | 310 }; |
297 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 311 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
OLD | NEW |