Index: components/password_manager/core/browser/password_form_manager.cc |
diff --git a/components/password_manager/core/browser/password_form_manager.cc b/components/password_manager/core/browser/password_form_manager.cc |
index 05d4f85e8f229f581576c1b86c3485277b623cb8..10145b9e807786487ea1534a99c612e610d613cc 100644 |
--- a/components/password_manager/core/browser/password_form_manager.cc |
+++ b/components/password_manager/core/browser/password_form_manager.cc |
@@ -138,6 +138,16 @@ bool ShouldShowInitialPasswordAccountSuggestions() { |
base::CompareCase::SENSITIVE); |
} |
+// Update |credential| to reflect usage. This is broken out from UpdateLogin() |
+// so that PSL matches can also be properly updated. |
+void UpdateMetadataForUsage(PasswordForm* credential) { |
+ ++credential->times_used; |
+ |
+ // Remove alternate usernames. At this point we assume that we have found |
+ // the right username. |
+ credential->other_possible_usernames.clear(); |
+} |
+ |
} // namespace |
PasswordFormManager::PasswordFormManager( |
@@ -728,7 +738,7 @@ void PasswordFormManager::UpdateLogin() { |
return; |
} |
- UpdateMetadataForUsage(pending_credentials_); |
+ UpdateMetadataForUsage(&pending_credentials_); |
client_->GetStoreResultFilter()->ReportFormUsed(pending_credentials_); |
@@ -795,15 +805,6 @@ void PasswordFormManager::UpdateLogin() { |
} |
} |
-void PasswordFormManager::UpdateMetadataForUsage( |
- const PasswordForm& credential) { |
- ++pending_credentials_.times_used; |
- |
- // Remove alternate usernames. At this point we assume that we have found |
- // the right username. |
- pending_credentials_.other_possible_usernames.clear(); |
-} |
- |
bool PasswordFormManager::UpdatePendingCredentialsIfOtherPossibleUsername( |
const base::string16& username) { |
for (PasswordFormMap::const_iterator it = best_matches_.begin(); |
@@ -1098,7 +1099,7 @@ void PasswordFormManager::CreatePendingCredentials() { |
// TODO(gcasto): It would be nice if other state were shared such that if |
// say a password was updated on one match it would update on all related |
// passwords. This is a much larger change. |
- UpdateMetadataForUsage(pending_credentials_); |
+ UpdateMetadataForUsage(&pending_credentials_); |
// Update |pending_credentials_| in order to be able correctly save it. |
pending_credentials_.origin = provisionally_saved_form_->origin; |