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 56205fd70ba33ed5dd29578af1575744e6182800..56546da7407456b53585dd03233cba867387afd6 100644 |
--- a/components/password_manager/core/browser/password_form_manager.cc |
+++ b/components/password_manager/core/browser/password_form_manager.cc |
@@ -400,6 +400,8 @@ void PasswordFormManager::OnRequestDone( |
if (is_credential_protected) |
protected_credentials.push_back(login.Pass()); |
+ if (login->IsPublicSuffixMatch()) |
+ psl_not_best_matches_.push_back(login.Pass()); |
continue; |
} |
@@ -620,6 +622,7 @@ void PasswordFormManager::UpdateLogin() { |
UpdatePreferredLoginState(password_store); |
+ bool password_was_update = false; |
vasilii
2015/08/28 11:10:48
password_was_updated
dvadym
2015/08/28 11:25:29
Done.
|
// Update the new preferred login. |
if (!selected_username_.empty()) { |
// Username has changed. We set this selected username as the real |
@@ -669,8 +672,30 @@ void PasswordFormManager::UpdateLogin() { |
pending_credentials_.submit_element = observed_form_.submit_element; |
password_store->UpdateLoginWithPrimaryKey(pending_credentials_, |
old_primary_key); |
+ password_was_update = true; |
} else { |
password_store->UpdateLogin(pending_credentials_); |
+ password_was_update = true; |
+ } |
+ // If this was password update then update all PSL matches entries with the |
+ // same username and with old password. |
+ if (password_was_update) { |
+ PasswordFormMap::const_iterator updated_password_it = |
+ best_matches_.find(pending_credentials_.username_value); |
+ DCHECK(best_matches_.end() != updated_password_it); |
+ const base::string16& old_password = |
+ updated_password_it->second->password_value; |
+ for (size_t i = 0; i < psl_not_best_matches_.size(); ++i) { |
+ if (psl_not_best_matches_[i]->username_value == |
+ pending_credentials_.username_value && |
+ psl_not_best_matches_[i]->password_value == old_password) { |
+ psl_not_best_matches_[i]->password_value = |
+ pending_credentials_.password_value; |
+ psl_not_best_matches_[i]->signon_realm = |
+ psl_not_best_matches_[i]->original_signon_realm; |
+ password_store->UpdateLogin(*psl_not_best_matches_[i]); |
vasilii
2015/08/28 11:10:48
What about the origin? I'm afraid it's lost during
dvadym
2015/08/28 11:25:29
I've done for libsecret that it's not lost, as I w
|
+ } |
+ } |
} |
} |