Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: components/password_manager/content/browser/credential_manager_impl.cc

Issue 2598003002: Suppress save and update bubbles when storing a PSL matched credential (Closed)
Patch Set: Addressed comments. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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_manager_->IsPendingCredentialsPublicSuffixMatch()) {
90 // Having a credential with a PSL match implies there is no credential with
91 // an exactly matching origin and username. In order to avoid showing a save
92 // bubble to the user Save() is called directly.
93 form_manager_->Save();
94 return;
95 }
96
89 if (!form.federation_origin.unique()) { 97 if (!form.federation_origin.unique()) {
90 // If this is a federated credential, check it against the federated matches 98 // 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 99 // produced by the PasswordFormManager. If a match is found, update it and
92 // return. 100 // return.
93 for (const auto& match : 101 for (const auto& match :
94 form_manager_->form_fetcher()->GetFederatedMatches()) { 102 form_manager_->form_fetcher()->GetFederatedMatches()) {
95 if (match->username_value == form.username_value && 103 if (match->username_value == form.username_value &&
96 match->federation_origin.IsSameOriginWith(form.federation_origin)) { 104 match->federation_origin.IsSameOriginWith(form.federation_origin)) {
97 form_manager_->Update(*match); 105 form_manager_->Update(*match);
98 return; 106 return;
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin() 275 PasswordStore::FormDigest CredentialManagerImpl::GetSynthesizedFormForOrigin()
268 const { 276 const {
269 PasswordStore::FormDigest digest = { 277 PasswordStore::FormDigest digest = {
270 autofill::PasswordForm::SCHEME_HTML, std::string(), 278 autofill::PasswordForm::SCHEME_HTML, std::string(),
271 web_contents()->GetLastCommittedURL().GetOrigin()}; 279 web_contents()->GetLastCommittedURL().GetOrigin()};
272 digest.signon_realm = digest.origin.spec(); 280 digest.signon_realm = digest.origin.spec();
273 return digest; 281 return digest;
274 } 282 }
275 283
276 } // namespace password_manager 284 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698