OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/password_manager/content/browser/credential_manager_impl.h" | 5 #include "components/password_manager/content/browser/credential_manager_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/metrics/user_metrics.h" | 10 #include "base/metrics/user_metrics.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 void CredentialManagerImpl::OnProvisionalSaveComplete() { | 72 void CredentialManagerImpl::OnProvisionalSaveComplete() { |
73 DCHECK(form_manager_); | 73 DCHECK(form_manager_); |
74 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); | 74 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); |
75 const autofill::PasswordForm& form = form_manager_->pending_credentials(); | 75 const autofill::PasswordForm& form = form_manager_->pending_credentials(); |
76 | 76 |
77 if (!form.federation_origin.unique()) { | 77 if (!form.federation_origin.unique()) { |
78 // If this is a federated credential, check it against the federated matches | 78 // If this is a federated credential, check it against the federated matches |
79 // produced by the PasswordFormManager. If a match is found, update it and | 79 // produced by the PasswordFormManager. If a match is found, update it and |
80 // return. | 80 // return. |
81 for (const auto& match : form_manager_->federated_matches()) { | 81 for (const auto& match : |
| 82 form_manager_->form_fetcher()->GetFederatedMatches()) { |
82 if (match->username_value == form.username_value && | 83 if (match->username_value == form.username_value && |
83 match->federation_origin.IsSameOriginWith(form.federation_origin)) { | 84 match->federation_origin.IsSameOriginWith(form.federation_origin)) { |
84 form_manager_->Update(*match); | 85 form_manager_->Update(*match); |
85 return; | 86 return; |
86 } | 87 } |
87 } | 88 } |
88 } else if (!form_manager_->IsNewLogin()) { | 89 } else if (!form_manager_->IsNewLogin()) { |
89 // Otherwise, if this is not a new password credential, update the existing | 90 // Otherwise, if this is not a new password credential, update the existing |
90 // credential without prompting the user. This will also update the | 91 // credential without prompting the user. This will also update the |
91 // 'skip_zero_click' state, as we've gotten an explicit signal that the page | 92 // 'skip_zero_click' state, as we've gotten an explicit signal that the page |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 DCHECK(pending_require_user_mediation_); | 273 DCHECK(pending_require_user_mediation_); |
273 pending_require_user_mediation_.reset(); | 274 pending_require_user_mediation_.reset(); |
274 } | 275 } |
275 | 276 |
276 bool CredentialManagerImpl::IsUpdatingCredentialAllowed() const { | 277 bool CredentialManagerImpl::IsUpdatingCredentialAllowed() const { |
277 return !client_->DidLastPageLoadEncounterSSLErrors() && | 278 return !client_->DidLastPageLoadEncounterSSLErrors() && |
278 !client_->IsOffTheRecord(); | 279 !client_->IsOffTheRecord(); |
279 } | 280 } |
280 | 281 |
281 } // namespace password_manager | 282 } // namespace password_manager |
OLD | NEW |