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 COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 5 #ifndef COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 6 #define COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 // conceivable that a user (or ui test) could attempt to submit a login | 77 // conceivable that a user (or ui test) could attempt to submit a login |
78 // prompt before the callback has occured, which would InvokeLater a call to | 78 // prompt before the callback has occured, which would InvokeLater a call to |
79 // PasswordManager::ProvisionallySave, which would interact with this object | 79 // PasswordManager::ProvisionallySave, which would interact with this object |
80 // before the db has had time to answer with matching password entries. | 80 // before the db has had time to answer with matching password entries. |
81 // This is intended to be a one-time check; if the return value is false the | 81 // This is intended to be a one-time check; if the return value is false the |
82 // expectation is caller will give up. This clearly won't work if you put it | 82 // expectation is caller will give up. This clearly won't work if you put it |
83 // in a loop and wait for matching to complete; you're (supposed to be) on | 83 // in a loop and wait for matching to complete; you're (supposed to be) on |
84 // the same thread! | 84 // the same thread! |
85 bool HasCompletedMatching() const; | 85 bool HasCompletedMatching() const; |
86 | 86 |
87 // Returns true if the observed form has both the current and new password | |
88 // fields, and the username field was not explicitly marked with | |
89 // autocomplete=username. In these cases it is not clear whether the username | |
90 // field is the right guess (often such change password forms do not contain | |
91 // the username at all), and the user should not be bothered with saving a | |
92 // potentially malformed credential. Once we handle change password forms | |
93 // correctly, or http://crbug.com/448351 gets implemented, this method should | |
94 // be replaced accordingly. | |
95 bool IsIgnorableChangePasswordForm() const; | |
96 | |
97 // Determines if the user opted to 'never remember' passwords for this form. | 87 // Determines if the user opted to 'never remember' passwords for this form. |
98 bool IsBlacklisted() const; | 88 bool IsBlacklisted() const; |
99 | 89 |
100 // Used by PasswordManager to determine whether or not to display | 90 // Used by PasswordManager to determine whether or not to display |
101 // a SavePasswordBar when given the green light to save the PasswordForm | 91 // a SavePasswordBar when given the green light to save the PasswordForm |
102 // managed by this. | 92 // managed by this. |
103 bool IsNewLogin() const; | 93 bool IsNewLogin() const; |
104 | 94 |
105 // Returns true if the current pending credentials were found using | 95 // Returns true if the current pending credentials were found using |
106 // origin matching of the public suffix, instead of the signon realm of the | 96 // origin matching of the public suffix, instead of the signon realm of the |
(...skipping 16 matching lines...) Expand all Loading... |
123 void ProcessFrame(const base::WeakPtr<PasswordManagerDriver>& driver); | 113 void ProcessFrame(const base::WeakPtr<PasswordManagerDriver>& driver); |
124 | 114 |
125 void OnGetPasswordStoreResults( | 115 void OnGetPasswordStoreResults( |
126 const std::vector<autofill::PasswordForm*>& results) override; | 116 const std::vector<autofill::PasswordForm*>& results) override; |
127 | 117 |
128 // A user opted to 'never remember' passwords for this form. | 118 // A user opted to 'never remember' passwords for this form. |
129 // 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. |
130 // TODO: Make this private once we switch to the new UI. | 120 // TODO: Make this private once we switch to the new UI. |
131 void PermanentlyBlacklist(); | 121 void PermanentlyBlacklist(); |
132 | 122 |
133 // If the user has submitted observed_form_, provisionally hold on to | 123 // If the user has submitted |observed_form_|, provisionally hold on to |
134 // the submitted credentials until we are told by PasswordManager whether | 124 // the submitted credentials until we are told by PasswordManager whether |
135 // or not the login was successful. |action| describes how we deal with | 125 // or not the login was successful. |action| describes how we deal with |
136 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will | 126 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will |
137 // treat a possible usernames match as a sign that our original heuristics | 127 // treat a possible usernames match as a sign that our original heuristics |
138 // were wrong and that the user selected the correct username from the | 128 // were wrong and that the user selected the correct username from the |
139 // Autofill UI. | 129 // Autofill UI. If the |observed_form_| is a ignorable change-password form |
140 void ProvisionallySave(const autofill::PasswordForm& credentials, | 130 // having non-matching credentials to that of in |best_matches_|, this |
| 131 // functions returns false; for all other cases returns true. |
| 132 bool ProvisionallySave(const autofill::PasswordForm& credentials, |
141 OtherPossibleUsernamesAction action); | 133 OtherPossibleUsernamesAction action); |
142 | 134 |
143 // Handles save-as-new or update of the form managed by this manager. | 135 // Handles save-as-new or update of the form managed by this manager. |
144 // Note the basic data of updated_credentials must match that of | 136 // Note the basic data of updated_credentials must match that of |
145 // observed_form_ (e.g DoesManage(pending_credentials_) == true). | 137 // observed_form_ (e.g DoesManage(pending_credentials_) == true). |
146 // TODO: Make this private once we switch to the new UI. | 138 // TODO: Make this private once we switch to the new UI. |
147 void Save(); | 139 void Save(); |
148 | 140 |
149 // Call these if/when we know the form submission worked or failed. | 141 // Call these if/when we know the form submission worked or failed. |
150 // These routines are used to update internal statistics ("ActionsTaken"). | 142 // These routines are used to update internal statistics ("ActionsTaken"). |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 267 |
276 // Remove possible_usernames that may contains sensitive information and | 268 // Remove possible_usernames that may contains sensitive information and |
277 // duplicates. | 269 // duplicates. |
278 void SanitizePossibleUsernames(autofill::PasswordForm* form); | 270 void SanitizePossibleUsernames(autofill::PasswordForm* form); |
279 | 271 |
280 // Helper function to delegate uploading to the AutofillManager. | 272 // Helper function to delegate uploading to the AutofillManager. |
281 virtual void UploadPasswordForm( | 273 virtual void UploadPasswordForm( |
282 const autofill::FormData& form_data, | 274 const autofill::FormData& form_data, |
283 const autofill::ServerFieldType& password_type); | 275 const autofill::ServerFieldType& password_type); |
284 | 276 |
| 277 // Returns true if the observed form has both the current and new password |
| 278 // fields, and the username field was not explicitly marked with |
| 279 // autocomplete=username. In these cases it is not clear whether the username |
| 280 // field is the right guess (often such change password forms do not contain |
| 281 // the username at all), and the user should not be bothered with saving a |
| 282 // potentially malformed credential. Once we handle change password forms |
| 283 // correctly, or http://crbug.com/448351 gets implemented, this method should |
| 284 // be replaced accordingly. |
| 285 bool IsIgnorableChangePasswordForm() const; |
| 286 |
285 // Set of PasswordForms from the DB that best match the form | 287 // Set of PasswordForms from the DB that best match the form |
286 // being managed by this. Use a map instead of vector, because we most | 288 // being managed by this. Use a map instead of vector, because we most |
287 // frequently require lookups by username value in IsNewLogin. | 289 // frequently require lookups by username value in IsNewLogin. |
288 autofill::PasswordFormMap best_matches_; | 290 autofill::PasswordFormMap best_matches_; |
289 | 291 |
290 // Cleans up when best_matches_ goes out of scope. | 292 // Cleans up when best_matches_ goes out of scope. |
291 STLValueDeleter<autofill::PasswordFormMap> best_matches_deleter_; | 293 STLValueDeleter<autofill::PasswordFormMap> best_matches_deleter_; |
292 | 294 |
293 // The PasswordForm from the page or dialog managed by |this|. | 295 // The PasswordForm from the page or dialog managed by |this|. |
294 const autofill::PasswordForm observed_form_; | 296 const autofill::PasswordForm observed_form_; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 ManagerAction manager_action_; | 355 ManagerAction manager_action_; |
354 UserAction user_action_; | 356 UserAction user_action_; |
355 SubmitResult submit_result_; | 357 SubmitResult submit_result_; |
356 | 358 |
357 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 359 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
358 }; | 360 }; |
359 | 361 |
360 } // namespace password_manager | 362 } // namespace password_manager |
361 | 363 |
362 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ | 364 #endif // COMPONENTS_PASSWORD_MANAGER_CORE_BROWSER_PASSWORD_FORM_MANAGER_H_ |
OLD | NEW |