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

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

Issue 2513033002: Refactor CredentialManagerImpl::RequireUserMediation method. (Closed)
Patch Set: ios Created 4 years, 1 month 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 2f53fc7f58f47a93108bcc02346e64fe6264fa94..444d3adccf4dffaf6600381a428d1cc8213a65b5 100644
--- a/components/password_manager/content/browser/credential_manager_impl.cc
+++ b/components/password_manager/content/browser/credential_manager_impl.cc
@@ -118,46 +118,19 @@ void CredentialManagerImpl::RequireUserMediation(
CredentialManagerLogger(client_->GetLogManager())
.LogRequireUserMediation(web_contents()->GetLastCommittedURL());
}
+ // Send acknowledge response back.
+ callback.Run();
+
PasswordStore* store = GetPasswordStore();
if (!store || !client_->IsSavingAndFillingEnabledForCurrentPage() ||
- !client_->OnCredentialManagerUsed()) {
- callback.Run();
+ !client_->OnCredentialManagerUsed())
return;
- }
-
- if (store->affiliated_match_helper()) {
- store->affiliated_match_helper()->GetAffiliatedAndroidRealms(
- GetSynthesizedFormForOrigin(),
- base::Bind(&CredentialManagerImpl::ScheduleRequireMediationTask,
- weak_factory_.GetWeakPtr(), callback));
- } else {
- std::vector<std::string> no_affiliated_realms;
- ScheduleRequireMediationTask(callback, no_affiliated_realms);
- }
-}
-void CredentialManagerImpl::ScheduleRequireMediationTask(
- const RequireUserMediationCallback& callback,
- const std::vector<std::string>& android_realms) {
- DCHECK(GetPasswordStore());
if (!pending_require_user_mediation_) {
pending_require_user_mediation_.reset(
- new CredentialManagerPendingRequireUserMediationTask(
- this, web_contents()->GetLastCommittedURL().GetOrigin(),
- android_realms));
-
- // This will result in a callback to
- // CredentialManagerPendingRequireUserMediationTask::
- // OnGetPasswordStoreResults().
- GetPasswordStore()->GetAutofillableLogins(
- pending_require_user_mediation_.get());
- } else {
- pending_require_user_mediation_->AddOrigin(
- web_contents()->GetLastCommittedURL().GetOrigin());
+ new CredentialManagerPendingRequireUserMediationTask(this));
}
-
- // Send acknowledge response back.
- callback.Run();
+ pending_require_user_mediation_->AddOrigin(GetSynthesizedFormForOrigin());
}
void CredentialManagerImpl::Get(bool zero_click_only,

Powered by Google App Engine
This is Rietveld 408576698