Chromium Code Reviews| 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..af857e1667844079fe27e5b20681c661cddc6006 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; |
| } |
| @@ -188,13 +185,15 @@ void CredentialManagerPendingRequestTask::ProcessForms( |
| &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 |
| + // unambigious and zero-click sign-in is not forbidden via the mediation |
| + // requirement. 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 = |
| - local_results.size() == 1u && delegate_->IsZeroClickAllowed(); |
| + local_results.size() == 1u && delegate_->IsZeroClickAllowed() && |
|
vasilii
2017/05/18 12:34:03
I think the class should not ask the delegate unne
jdoerrie
2017/05/18 14:57:24
Done.
|
| + mediation_ != CredentialMediationRequirement::REQUIRED; |
| if (can_use_autosignin && !local_results[0]->skip_zero_click && |
| !password_bubble_experiment::ShouldShowAutoSignInPromptFirstRunExperience( |
| delegate_->client()->GetPrefs())) { |
| @@ -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::SILENT) { |
| 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; |
| } |
| @@ -260,7 +258,7 @@ void CredentialManagerPendingRequestTask::ProcessForms( |
| &CredentialManagerPendingRequestTaskDelegate::SendPasswordForm, |
| base::Unretained(delegate_), send_callback_))) { |
| LogCredentialManagerGetResult(metrics_util::CREDENTIAL_MANAGER_GET_NONE, |
| - mediation_status); |
| + mediation_); |
| delegate_->SendCredential(send_callback_, CredentialInfo()); |
| } |
| } |