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

Unified Diff: components/password_manager/content/browser/credential_manager_impl.cc

Issue 2447813002: Strengthen the rules when the Credential Manager API is disabled. (Closed)
Patch Set: Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/content/browser/credential_manager_impl.cc
diff --git a/components/password_manager/content/browser/credential_manager_impl.cc b/components/password_manager/content/browser/credential_manager_impl.cc
index 66a457b8e0ddefb3a324bca2c0aabd07835b0895..aaa112d89c36149ed90e6ffcd2cbb205a4b1582e 100644
--- a/components/password_manager/content/browser/credential_manager_impl.cc
+++ b/components/password_manager/content/browser/credential_manager_impl.cc
@@ -117,7 +117,7 @@ void CredentialManagerImpl::RequireUserMediation(
.LogRequireUserMediation(web_contents()->GetLastCommittedURL());
}
PasswordStore* store = GetPasswordStore();
- if (!store || !IsUpdatingCredentialAllowed()) {
+ if (!store || !client_->IsSavingAndFillingEnabledForCurrentPage()) {
callback.Run();
return;
}
@@ -178,8 +178,8 @@ void CredentialManagerImpl::Get(bool zero_click_only,
// Return an empty credential if zero-click is required but disabled, or if
// the current page has TLS errors.
- if ((zero_click_only && !IsZeroClickAllowed()) ||
- client_->DidLastPageLoadEncounterSSLErrors()) {
+ if (!client_->IsFillingEnabledForCurrentPage() ||
+ (zero_click_only && !IsZeroClickAllowed())) {
// Callback with empty credential info.
callback.Run(mojom::CredentialManagerError::SUCCESS, CredentialInfo());
return;
@@ -262,7 +262,6 @@ void CredentialManagerImpl::SendPasswordForm(
info = CredentialInfo(*form, type_to_return);
if (PasswordStore* store = GetPasswordStore()) {
if (form->skip_zero_click && IsZeroClickAllowed()) {
- DCHECK(IsUpdatingCredentialAllowed());
autofill::PasswordForm update_form = *form;
update_form.skip_zero_click = false;
store->UpdateLogin(update_form);
@@ -295,9 +294,4 @@ void CredentialManagerImpl::DoneRequiringUserMediation() {
pending_require_user_mediation_.reset();
}
-bool CredentialManagerImpl::IsUpdatingCredentialAllowed() const {
- return !client_->DidLastPageLoadEncounterSSLErrors() &&
- !client_->IsOffTheRecord();
-}
-
} // namespace password_manager

Powered by Google App Engine
This is Rietveld 408576698