Chromium Code Reviews| 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/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 form_manager_ = base::MakeUnique<CredentialManagerPasswordFormManager>( | 79 form_manager_ = base::MakeUnique<CredentialManagerPasswordFormManager>( |
| 80 client_, GetDriver(), *CreateObservedPasswordFormFromOrigin(origin), | 80 client_, GetDriver(), *CreateObservedPasswordFormFromOrigin(origin), |
| 81 std::move(form), this, nullptr, nullptr); | 81 std::move(form), this, nullptr, nullptr); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void CredentialManagerImpl::OnProvisionalSaveComplete() { | 84 void CredentialManagerImpl::OnProvisionalSaveComplete() { |
| 85 DCHECK(form_manager_); | 85 DCHECK(form_manager_); |
| 86 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); | 86 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); |
| 87 const autofill::PasswordForm& form = form_manager_->pending_credentials(); | 87 const autofill::PasswordForm& form = form_manager_->pending_credentials(); |
| 88 | 88 |
| 89 if (form.is_public_suffix_match) { | |
|
vasilii
2016/12/22 13:24:59
Use IsPendingCredentialsPublicSuffixMatch() for co
jdoerrie
2016/12/22 16:20:01
Done.
| |
| 90 // Having a credential with a PSL match implies there is no credential with | |
| 91 // an exactly matching origin. This is because the presence of the exact | |
|
vasilii
2016/12/22 13:24:58
exactly matching origin and username.
jdoerrie
2016/12/22 16:20:01
Done.
| |
| 92 // match would stop the PSL matches from appearing in the account chooser. | |
|
vasilii
2016/12/22 13:24:59
The explanation is wrong. A site doesn't have to u
jdoerrie
2016/12/22 16:20:01
Acknowledged.
| |
| 93 // In order to avoid showing a save bubble to the user when he already chose | |
| 94 // this credential via the account chooser Save() is called directly. | |
| 95 form_manager_->Save(); | |
| 96 return; | |
| 97 } | |
| 98 | |
| 89 if (!form.federation_origin.unique()) { | 99 if (!form.federation_origin.unique()) { |
| 90 // If this is a federated credential, check it against the federated matches | 100 // If this is a federated credential, check it against the federated matches |
| 91 // produced by the PasswordFormManager. If a match is found, update it and | 101 // produced by the PasswordFormManager. If a match is found, update it and |
| 92 // return. | 102 // return. |
| 93 for (const auto& match : | 103 for (const auto& match : |
| 94 form_manager_->form_fetcher()->GetFederatedMatches()) { | 104 form_manager_->form_fetcher()->GetFederatedMatches()) { |
| 95 if (match->username_value == form.username_value && | 105 if (match->username_value == form.username_value && |
| 96 match->federation_origin.IsSameOriginWith(form.federation_origin)) { | 106 match->federation_origin.IsSameOriginWith(form.federation_origin)) { |
| 97 form_manager_->Update(*match); | 107 form_manager_->Update(*match); |
| 98 return; | 108 return; |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() | 277 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() |
| 268 const { | 278 const { |
| 269 PasswordStore::FormDigest digest = { | 279 PasswordStore::FormDigest digest = { |
| 270 autofill::PasswordForm::SCHEME_HTML, std::string(), | 280 autofill::PasswordForm::SCHEME_HTML, std::string(), |
| 271 web_contents()->GetLastCommittedURL().GetOrigin()}; | 281 web_contents()->GetLastCommittedURL().GetOrigin()}; |
| 272 digest.signon_realm = digest.origin.spec(); | 282 digest.signon_realm = digest.origin.spec(); |
| 273 return digest; | 283 return digest; |
| 274 } | 284 } |
| 275 | 285 |
| 276 } // namespace password_manager | 286 } // namespace password_manager |
| OLD | NEW |