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

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

Issue 1960653002: Fix blacklisting password forms with Credential Manager API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: 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_dispatcher_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_dispatc her.h" 5 #include "components/password_manager/content/browser/credential_manager_dispatc her.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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 const password_manager::CredentialInfo& credential) { 57 const password_manager::CredentialInfo& credential) {
58 DCHECK(credential.type != CredentialType::CREDENTIAL_TYPE_EMPTY); 58 DCHECK(credential.type != CredentialType::CREDENTIAL_TYPE_EMPTY);
59 DCHECK(request_id); 59 DCHECK(request_id);
60 web_contents()->GetRenderViewHost()->Send( 60 web_contents()->GetRenderViewHost()->Send(
61 new CredentialManagerMsg_AcknowledgeStore( 61 new CredentialManagerMsg_AcknowledgeStore(
62 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id)); 62 web_contents()->GetRenderViewHost()->GetRoutingID(), request_id));
63 63
64 if (!client_->IsSavingAndFillingEnabledForCurrentPage()) 64 if (!client_->IsSavingAndFillingEnabledForCurrentPage())
65 return; 65 return;
66 66
67 GURL origin = web_contents()->GetLastCommittedURL().GetOrigin();
67 std::unique_ptr<autofill::PasswordForm> form( 68 std::unique_ptr<autofill::PasswordForm> form(
68 CreatePasswordFormFromCredentialInfo( 69 CreatePasswordFormFromCredentialInfo(credential, origin));
69 credential, web_contents()->GetLastCommittedURL().GetOrigin()));
70 form->skip_zero_click = !IsZeroClickAllowed(); 70 form->skip_zero_click = !IsZeroClickAllowed();
71 71
72 form_manager_.reset(new CredentialManagerPasswordFormManager( 72 form_manager_.reset(new CredentialManagerPasswordFormManager(
73 client_, GetDriver(), *form, this)); 73 client_, GetDriver(), *CreateObservedPasswordFormFromOrigin(origin),
74 std::move(form), this));
74 } 75 }
75 76
76 void CredentialManagerDispatcher::OnProvisionalSaveComplete() { 77 void CredentialManagerDispatcher::OnProvisionalSaveComplete() {
77 DCHECK(form_manager_); 78 DCHECK(form_manager_);
78 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage()); 79 DCHECK(client_->IsSavingAndFillingEnabledForCurrentPage());
79 const autofill::PasswordForm& form = form_manager_->pending_credentials(); 80 const autofill::PasswordForm& form = form_manager_->pending_credentials();
80 81
81 if (!form.federation_origin.unique()) { 82 if (!form.federation_origin.unique()) {
82 // If this is a federated credential, check it against the federated matches 83 // If this is a federated credential, check it against the federated matches
83 // produced by the PasswordFormManager. If a match is found, update it and 84 // produced by the PasswordFormManager. If a match is found, update it and
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 DCHECK(pending_require_user_mediation_); 284 DCHECK(pending_require_user_mediation_);
284 pending_require_user_mediation_.reset(); 285 pending_require_user_mediation_.reset();
285 } 286 }
286 287
287 bool CredentialManagerDispatcher::IsUpdatingCredentialAllowed() const { 288 bool CredentialManagerDispatcher::IsUpdatingCredentialAllowed() const {
288 return !client_->DidLastPageLoadEncounterSSLErrors() && 289 return !client_->DidLastPageLoadEncounterSSLErrors() &&
289 !client_->IsOffTheRecord(); 290 !client_->IsOffTheRecord();
290 } 291 }
291 292
292 } // namespace password_manager 293 } // namespace password_manager
OLDNEW
« no previous file with comments | « no previous file | components/password_manager/content/browser/credential_manager_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698