| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 // Called by destructor to ensure if this object is deleted, no potential | 85 // Called by destructor to ensure if this object is deleted, no potential |
| 86 // outstanding callbacks can call OnWebDataServiceRequestDone. | 86 // outstanding callbacks can call OnWebDataServiceRequestDone. |
| 87 void CancelLoginsQuery(); | 87 void CancelLoginsQuery(); |
| 88 | 88 |
| 89 // Helper for OnWebDataServiceRequestDone to determine whether or not | 89 // Helper for OnWebDataServiceRequestDone to determine whether or not |
| 90 // the given result form is worth scoring. | 90 // the given result form is worth scoring. |
| 91 bool IgnoreResult(const webkit_glue::PasswordForm& form) const; | 91 bool IgnoreResult(const webkit_glue::PasswordForm& form) const; |
| 92 | 92 |
| 93 // Helper for Save in the case that best_matches.size() == 0, meaning | 93 // Helper for Save in the case that best_matches.size() == 0, meaning |
| 94 // we have no prior record of this form/username/password and the user | 94 // we have no prior record of this form/username/password and the user |
| 95 // has opted to 'Save Password'. | 95 // has opted to 'Save Password'. If |reset_preferred_login| is set, |
| 96 void SaveAsNewLogin(); | 96 // the previously preferred login from |best_matches_| will be reset. |
| 97 void SaveAsNewLogin(bool reset_preferred_login); |
| 97 | 98 |
| 98 // Helper for OnWebDataServiceRequestDone to score an individual result | 99 // Helper for OnWebDataServiceRequestDone to score an individual result |
| 99 // against the observed_form_. | 100 // against the observed_form_. |
| 100 int ScoreResult(const webkit_glue::PasswordForm& form) const; | 101 int ScoreResult(const webkit_glue::PasswordForm& form) const; |
| 101 | 102 |
| 102 // Helper for Save in the case that best_matches.size() > 0, meaning | 103 // Helper for Save in the case that best_matches.size() > 0, meaning |
| 103 // we have at least one match for this form/username/password. This | 104 // we have at least one match for this form/username/password. This |
| 104 // Updates the form managed by this object, as well as any matching forms | 105 // Updates the form managed by this object, as well as any matching forms |
| 105 // that now need to have preferred bit changed, since updated_credentials | 106 // that now need to have preferred bit changed, since updated_credentials |
| 106 // is now implicitly 'preferred'. | 107 // is now implicitly 'preferred'. |
| 107 void UpdateLogin(); | 108 void UpdateLogin(); |
| 108 | 109 |
| 110 // Update all login matches to reflect new preferred state - preferred flag |
| 111 // will be reset on all matched logins that different than the current |
| 112 // |pending_credentials_|. |
| 113 void UpdatePreferredLoginState(PasswordStore* password_store); |
| 114 |
| 109 // Set of PasswordForms from the DB that best match the form | 115 // Set of PasswordForms from the DB that best match the form |
| 110 // being managed by this. Use a map instead of vector, because we most | 116 // being managed by this. Use a map instead of vector, because we most |
| 111 // frequently require lookups by username value in IsNewLogin. | 117 // frequently require lookups by username value in IsNewLogin. |
| 112 webkit_glue::PasswordFormMap best_matches_; | 118 webkit_glue::PasswordFormMap best_matches_; |
| 113 | 119 |
| 114 // Cleans up when best_matches_ goes out of scope. | 120 // Cleans up when best_matches_ goes out of scope. |
| 115 STLValueDeleter<webkit_glue::PasswordFormMap> best_matches_deleter_; | 121 STLValueDeleter<webkit_glue::PasswordFormMap> best_matches_deleter_; |
| 116 | 122 |
| 117 // The PasswordForm from the page or dialog managed by this. | 123 // The PasswordForm from the page or dialog managed by this. |
| 118 webkit_glue::PasswordForm observed_form_; | 124 webkit_glue::PasswordForm observed_form_; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 // assuming we've already processed the web data request for matching logins, | 160 // assuming we've already processed the web data request for matching logins, |
| 155 // when we actually haven't. | 161 // when we actually haven't. |
| 156 PasswordFormManagerState state_; | 162 PasswordFormManagerState state_; |
| 157 | 163 |
| 158 // The profile from which we get the WebDataService. | 164 // The profile from which we get the WebDataService. |
| 159 Profile* profile_; | 165 Profile* profile_; |
| 160 | 166 |
| 161 DISALLOW_EVIL_CONSTRUCTORS(PasswordFormManager); | 167 DISALLOW_EVIL_CONSTRUCTORS(PasswordFormManager); |
| 162 }; | 168 }; |
| 163 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ | 169 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_FORM_MANAGER_H_ |
| OLD | NEW |