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

Unified Diff: components/password_manager/core/browser/credential_manager_pending_request_task.cc

Issue 2864493003: Deprecate CredentialRequestOptions.unmediated in favor mediation enum (Closed)
Patch Set: Rebase Created 3 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 side-by-side diff with in-line comments
Download patch
Index: components/password_manager/core/browser/credential_manager_pending_request_task.cc
diff --git a/components/password_manager/core/browser/credential_manager_pending_request_task.cc b/components/password_manager/core/browser/credential_manager_pending_request_task.cc
index cd89fb0e8944e82d0672935d01da590f1cdb4e90..6901dc02dfe65d58947965e9e1e4bc2ebd7cb0f1 100644
--- a/components/password_manager/core/browser/credential_manager_pending_request_task.cc
+++ b/components/password_manager/core/browser/credential_manager_pending_request_task.cc
@@ -113,12 +113,12 @@ void FilterDuplicatesAndEmptyUsername(
CredentialManagerPendingRequestTask::CredentialManagerPendingRequestTask(
CredentialManagerPendingRequestTaskDelegate* delegate,
const SendCredentialCallback& callback,
- bool request_zero_click_only,
+ CredentialMediationRequirement mediation,
bool include_passwords,
const std::vector<GURL>& request_federations)
: delegate_(delegate),
send_callback_(callback),
- zero_click_only_(request_zero_click_only),
+ mediation_(mediation),
origin_(delegate_->GetOrigin()),
include_passwords_(include_passwords) {
CHECK(!delegate_->client()->DidLastPageLoadEncounterSSLErrors());
@@ -149,12 +149,9 @@ void CredentialManagerPendingRequestTask::ProcessMigratedForms(
void CredentialManagerPendingRequestTask::ProcessForms(
std::vector<std::unique_ptr<autofill::PasswordForm>> results) {
using metrics_util::LogCredentialManagerGetResult;
- metrics_util::CredentialManagerGetMediation mediation_status =
- zero_click_only_ ? metrics_util::CREDENTIAL_MANAGER_GET_UNMEDIATED
- : metrics_util::CREDENTIAL_MANAGER_GET_MEDIATED;
if (delegate_->GetOrigin() != origin_) {
LogCredentialManagerGetResult(metrics_util::CREDENTIAL_MANAGER_GET_NONE,
- mediation_status);
+ mediation_);
delegate_->SendCredential(send_callback_, CredentialInfo());
return;
}
@@ -187,13 +184,15 @@ void CredentialManagerPendingRequestTask::ProcessForms(
FilterDuplicatesAndEmptyUsername(&local_results, &has_empty_username,
&has_duplicates);
- // We only perform zero-click sign-in when the result is completely
- // unambigious. If there is one and only one entry, and zero-click is
+ // We only perform zero-click sign-in when it is not forbidden via the
+ // mediation requirement and the result is completely unambigious.
+ // If there is one and only one entry, and zero-click is
// enabled for that entry, return it.
//
// Moreover, we only return such a credential if the user has opted-in via the
// first-run experience.
const bool can_use_autosignin =
+ mediation_ != CredentialMediationRequirement::kRequired &&
local_results.size() == 1u && delegate_->IsZeroClickAllowed();
if (can_use_autosignin && !local_results[0]->skip_zero_click &&
!password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience(
@@ -206,12 +205,12 @@ void CredentialManagerPendingRequestTask::ProcessForms(
origin_);
base::RecordAction(base::UserMetricsAction("CredentialManager_Autosignin"));
LogCredentialManagerGetResult(
- metrics_util::CREDENTIAL_MANAGER_GET_AUTOSIGNIN, mediation_status);
+ metrics_util::CREDENTIAL_MANAGER_GET_AUTOSIGNIN, mediation_);
delegate_->SendCredential(send_callback_, info);
return;
}
- if (zero_click_only_) {
+ if (mediation_ == CredentialMediationRequirement::kSilent) {
metrics_util::CredentialManagerGetResult get_result;
if (local_results.empty())
get_result = metrics_util::CREDENTIAL_MANAGER_GET_NONE_EMPTY_STORE;
@@ -231,7 +230,7 @@ void CredentialManagerPendingRequestTask::ProcessForms(
std::move(local_results[0]));
}
- LogCredentialManagerGetResult(get_result, mediation_status);
+ LogCredentialManagerGetResult(get_result, mediation_);
delegate_->SendCredential(send_callback_, CredentialInfo());
return;
}
@@ -246,8 +245,7 @@ void CredentialManagerPendingRequestTask::ProcessForms(
if (local_results.empty()) {
LogCredentialManagerGetResult(
- metrics_util::CREDENTIAL_MANAGER_GET_NONE_EMPTY_STORE,
- mediation_status);
+ metrics_util::CREDENTIAL_MANAGER_GET_NONE_EMPTY_STORE, mediation_);
delegate_->SendCredential(send_callback_, CredentialInfo());
return;
}
@@ -258,9 +256,9 @@ void CredentialManagerPendingRequestTask::ProcessForms(
std::move(local_results), origin_,
base::Bind(
&CredentialManagerPendingRequestTaskDelegate::SendPasswordForm,
- base::Unretained(delegate_), send_callback_))) {
+ base::Unretained(delegate_), send_callback_, mediation_))) {
LogCredentialManagerGetResult(metrics_util::CREDENTIAL_MANAGER_GET_NONE,
- mediation_status);
+ mediation_);
delegate_->SendCredential(send_callback_, CredentialInfo());
}
}

Powered by Google App Engine
This is Rietveld 408576698