| 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 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 // Checks if the form is a valid password form. Forms which lack either | 65 // Checks if the form is a valid password form. Forms which lack either |
| 66 // login or password field are not considered valid. | 66 // login or password field are not considered valid. |
| 67 bool HasValidPasswordForm(); | 67 bool HasValidPasswordForm(); |
| 68 | 68 |
| 69 // Determines if we need to autofill given the results of the query. | 69 // Determines if we need to autofill given the results of the query. |
| 70 void OnRequestDone( | 70 void OnRequestDone( |
| 71 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 71 int handle, const std::vector<webkit_glue::PasswordForm*>& result); |
| 72 | 72 |
| 73 // PasswordStoreConsumer implementation. | 73 // PasswordStoreConsumer implementation. |
| 74 virtual void OnPasswordStoreRequestDone( | 74 virtual void OnPasswordStoreRequestDone( |
| 75 int handle, const std::vector<webkit_glue::PasswordForm*>& result); | 75 PasswordStore::Handle handle, |
| 76 const std::vector<webkit_glue::PasswordForm*>& result); |
| 76 | 77 |
| 77 // A user opted to 'never remember' passwords for this form. | 78 // A user opted to 'never remember' passwords for this form. |
| 78 // Blacklist it so that from now on when it is seen we ignore it. | 79 // Blacklist it so that from now on when it is seen we ignore it. |
| 79 void PermanentlyBlacklist(); | 80 void PermanentlyBlacklist(); |
| 80 | 81 |
| 81 // If the user has submitted observed_form_, provisionally hold on to | 82 // If the user has submitted observed_form_, provisionally hold on to |
| 82 // the submitted credentials until we are told by PasswordManager whether | 83 // the submitted credentials until we are told by PasswordManager whether |
| 83 // or not the login was successful. | 84 // or not the login was successful. |
| 84 void ProvisionallySave(const webkit_glue::PasswordForm& credentials); | 85 void ProvisionallySave(const webkit_glue::PasswordForm& credentials); |
| 85 | 86 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 kSubmitResultFailed, | 130 kSubmitResultFailed, |
| 130 kSubmitResultPassed, | 131 kSubmitResultPassed, |
| 131 kSubmitResultMax | 132 kSubmitResultMax |
| 132 }; | 133 }; |
| 133 | 134 |
| 134 // The maximum number of combinations of the three preceding enums. | 135 // The maximum number of combinations of the three preceding enums. |
| 135 // This is used when recording the actions taken by the form in UMA. | 136 // This is used when recording the actions taken by the form in UMA. |
| 136 static const int kMaxNumActionsTaken = kManagerActionMax * kUserActionMax * | 137 static const int kMaxNumActionsTaken = kManagerActionMax * kUserActionMax * |
| 137 kSubmitResultMax; | 138 kSubmitResultMax; |
| 138 | 139 |
| 139 // Called by destructor to ensure if this object is deleted, no potential | |
| 140 // outstanding callbacks can call OnPasswordStoreRequestDone. | |
| 141 void CancelLoginsQuery(); | |
| 142 | |
| 143 // Helper for OnPasswordStoreRequestDone to determine whether or not | 140 // Helper for OnPasswordStoreRequestDone to determine whether or not |
| 144 // the given result form is worth scoring. | 141 // the given result form is worth scoring. |
| 145 bool IgnoreResult(const webkit_glue::PasswordForm& form) const; | 142 bool IgnoreResult(const webkit_glue::PasswordForm& form) const; |
| 146 | 143 |
| 147 // Helper for Save in the case that best_matches.size() == 0, meaning | 144 // Helper for Save in the case that best_matches.size() == 0, meaning |
| 148 // we have no prior record of this form/username/password and the user | 145 // we have no prior record of this form/username/password and the user |
| 149 // has opted to 'Save Password'. If |reset_preferred_login| is set, | 146 // has opted to 'Save Password'. If |reset_preferred_login| is set, |
| 150 // the previously preferred login from |best_matches_| will be reset. | 147 // the previously preferred login from |best_matches_| will be reset. |
| 151 void SaveAsNewLogin(bool reset_preferred_login); | 148 void SaveAsNewLogin(bool reset_preferred_login); |
| 152 | 149 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 webkit_glue::PasswordForm pending_credentials_; | 187 webkit_glue::PasswordForm pending_credentials_; |
| 191 | 188 |
| 192 // Whether pending_credentials_ stores a new login or is an update | 189 // Whether pending_credentials_ stores a new login or is an update |
| 193 // to an existing one. | 190 // to an existing one. |
| 194 bool is_new_login_; | 191 bool is_new_login_; |
| 195 | 192 |
| 196 // PasswordManager owning this. | 193 // PasswordManager owning this. |
| 197 const PasswordManager* const password_manager_; | 194 const PasswordManager* const password_manager_; |
| 198 | 195 |
| 199 // Handle to any pending PasswordStore::GetLogins query. | 196 // Handle to any pending PasswordStore::GetLogins query. |
| 200 int pending_login_query_; | 197 PasswordStore::Handle pending_login_query_; |
| 201 | 198 |
| 202 // Convenience pointer to entry in best_matches_ that is marked | 199 // Convenience pointer to entry in best_matches_ that is marked |
| 203 // as preferred. This is only allowed to be null if there are no best matches | 200 // as preferred. This is only allowed to be null if there are no best matches |
| 204 // at all, since there will always be one preferred login when there are | 201 // at all, since there will always be one preferred login when there are |
| 205 // multiple matches (when first saved, a login is marked preferred). | 202 // multiple matches (when first saved, a login is marked preferred). |
| 206 const webkit_glue::PasswordForm* preferred_match_; | 203 const webkit_glue::PasswordForm* preferred_match_; |
| 207 | 204 |
| 208 typedef enum { | 205 typedef enum { |
| 209 PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find | 206 PRE_MATCHING_PHASE, // Have not yet invoked a GetLogins query to find |
| 210 // matching login information from password store. | 207 // matching login information from password store. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 225 // These three fields record the "ActionsTaken" by the browser and | 222 // These three fields record the "ActionsTaken" by the browser and |
| 226 // the user with this form, and the result. They are combined and | 223 // the user with this form, and the result. They are combined and |
| 227 // recorded in UMA when the manager is destroyed. | 224 // recorded in UMA when the manager is destroyed. |
| 228 ManagerAction manager_action_; | 225 ManagerAction manager_action_; |
| 229 UserAction user_action_; | 226 UserAction user_action_; |
| 230 SubmitResult submit_result_; | 227 SubmitResult submit_result_; |
| 231 | 228 |
| 232 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); | 229 DISALLOW_COPY_AND_ASSIGN(PasswordFormManager); |
| 233 }; | 230 }; |
| 234 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 231 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
| OLD | NEW |