| 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 current password to be saved when ApplyEdits() is called. Will |
| 75 // override a previous call to BlacklistPassword(). |
| 76 void SavePassword(); |
| 77 |
| 78 // Sets current password to be blacklisted when ApplyEdits() is called. Will |
| 79 // override a previous call to SavePassword(). |
| 80 void BlacklistPassword(); |
| 81 |
| 82 // Persist changes from the latest call to either SavePassword() or |
| 83 // BlacklistPassword(). |
| 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 14 matching lines...) Expand all Loading... |
| 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. |
| 120 |
| 121 // TODO: Make this private once we switch to the new UI. |
| 108 void PermanentlyBlacklist(); | 122 void PermanentlyBlacklist(); |
| 109 | 123 |
| 110 // If the user has submitted observed_form_, provisionally hold on to | 124 // If the user has submitted observed_form_, provisionally hold on to |
| 111 // the submitted credentials until we are told by PasswordManager whether | 125 // the submitted credentials until we are told by PasswordManager whether |
| 112 // or not the login was successful. |action| describes how we deal with | 126 // or not the login was successful. |action| describes how we deal with |
| 113 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will | 127 // possible usernames. If |action| is ALLOW_OTHER_POSSIBLE_USERNAMES we will |
| 114 // treat a possible usernames match as a sign that our original heuristics | 128 // 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 | 129 // were wrong and that the user selected the correct username from the |
| 116 // Autofill UI. | 130 // Autofill UI. |
| 117 void ProvisionallySave(const content::PasswordForm& credentials, | 131 void ProvisionallySave(const content::PasswordForm& credentials, |
| 118 OtherPossibleUsernamesAction action); | 132 OtherPossibleUsernamesAction action); |
| 119 | 133 |
| 120 // Handles save-as-new or update of the form managed by this manager. | 134 // 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 | 135 // Note the basic data of updated_credentials must match that of |
| 122 // observed_form_ (e.g DoesManage(pending_credentials_) == true). | 136 // observed_form_ (e.g DoesManage(pending_credentials_) == true). |
| 137 |
| 138 // TODO: Make this private once we switch to the new UI. |
| 123 void Save(); | 139 void Save(); |
| 124 | 140 |
| 125 // 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. |
| 126 // These routines are used to update internal statistics ("ActionsTaken"). | 142 // These routines are used to update internal statistics ("ActionsTaken"). |
| 127 void SubmitPassed(); | 143 void SubmitPassed(); |
| 128 void SubmitFailed(); | 144 void SubmitFailed(); |
| 129 | 145 |
| 130 // Return the username associated with the credentials. | 146 // Return the username associated with the credentials. |
| 131 const string16& associated_username() const { | 147 const string16& associated_username() const { |
| 132 return pending_credentials_.username_value; | 148 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 | 300 // Web contents from which we get the RenderViewHost for sending messages to |
| 285 // the corresponding renderer. | 301 // the corresponding renderer. |
| 286 content::WebContents* web_contents_; | 302 content::WebContents* web_contents_; |
| 287 | 303 |
| 288 // These three fields record the "ActionsTaken" by the browser and | 304 // These three fields record the "ActionsTaken" by the browser and |
| 289 // the user with this form, and the result. They are combined and | 305 // the user with this form, and the result. They are combined and |
| 290 // recorded in UMA when the manager is destroyed. | 306 // recorded in UMA when the manager is destroyed. |
| 291 ManagerAction manager_action_; | 307 ManagerAction manager_action_; |
| 292 UserAction user_action_; | 308 UserAction user_action_; |
| 293 SubmitResult submit_result_; | 309 SubmitResult submit_result_; |
| 310 bool should_save_password_; |
| 311 bool should_blacklist_password_; |
| 294 | 312 |
| 295 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 313 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
| 296 }; | 314 }; |
| 297 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 315 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
| OLD | NEW |