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

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

Issue 1946563003: Fix blacklisting password forms with Credential Manager API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ios Created 4 years, 7 months 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
« no previous file with comments | « no previous file | components/password_manager/content/browser/credential_manager_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/strings/string16.h" 10 #include "base/strings/string16.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 const StoreCallback& callback) { 54 const StoreCallback& callback) {
55 CredentialInfo info = credential.To<CredentialInfo>(); 55 CredentialInfo info = credential.To<CredentialInfo>();
56 DCHECK_NE(CredentialType::CREDENTIAL_TYPE_EMPTY, info.type); 56 DCHECK_NE(CredentialType::CREDENTIAL_TYPE_EMPTY, info.type);
57 57
58 // Send acknowledge response back. 58 // Send acknowledge response back.
59 callback.Run(); 59 callback.Run();
60 60
61 if (!client_->IsSavingAndFillingEnabledForCurrentPage()) 61 if (!client_->IsSavingAndFillingEnabledForCurrentPage())
62 return; 62 return;
63 63
64 GURL origin = web_contents()->GetLastCommittedURL().GetOrigin();
64 std::unique_ptr<autofill::PasswordForm> form( 65 std::unique_ptr<autofill::PasswordForm> form(
65 CreatePasswordFormFromCredentialInfo( 66 CreatePasswordFormFromCredentialInfo(info, origin));
66 info, web_contents()->GetLastCommittedURL().GetOrigin()));
67 form->skip_zero_click = !IsZeroClickAllowed(); 67 form->skip_zero_click = !IsZeroClickAllowed();
68 68
69 form_manager_.reset(new CredentialManagerPasswordFormManager( 69 form_manager_.reset(new CredentialManagerPasswordFormManager(
70 client_, GetDriver(), *form, this)); 70 client_, GetDriver(), *CreateObservedPasswordFormFromOrigin(origin),
71 std::move(form), this));
71 } 72 }
72 73
73 void CredentialManagerImpl::OnProvisionalSaveComplete() { 74 void CredentialManagerImpl::OnProvisionalSaveComplete() {
74 DCHECK(form_manager_); 75 DCHECK(form_manager_);
75 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); 76 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage());
76 const autofill::PasswordForm& form = form_manager_->pending_credentials(); 77 const autofill::PasswordForm& form = form_manager_->pending_credentials();
77 78
78 if (!form.federation_origin.unique()) { 79 if (!form.federation_origin.unique()) {
79 // If this is a federated credential, check it against the federated matches 80 // If this is a federated credential, check it against the federated matches
80 // produced by the PasswordFormManager. If a match is found, update it and 81 // produced by the PasswordFormManager. If a match is found, update it and
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/content/browser/credential_manager_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698