Index: ios/chrome/browser/passwords/credential_manager.mm |
diff --git a/ios/chrome/browser/passwords/credential_manager.mm b/ios/chrome/browser/passwords/credential_manager.mm |
index 7376962e22b7bc64d8a0c05d64ce73df58356c92..b0fa212b04970905ebcb3b9b2c22090fe62f9d23 100644 |
--- a/ios/chrome/browser/passwords/credential_manager.mm |
+++ b/ios/chrome/browser/passwords/credential_manager.mm |
@@ -117,7 +117,7 @@ void CredentialManager::CredentialsRequested( |
// Invoked when the page invokes navigator.credentials.request(), this |
// function will attempt to retrieve a Credential from the PasswordStore that |
// meets the specified parameters and, if successful, send it back to the page |
- // via SendCredential. |
+ // via SendCredentialByID. |
DCHECK_GE(request_id, 0); |
password_manager::PasswordStore* store = GetPasswordStore(); |
@@ -139,7 +139,7 @@ void CredentialManager::CredentialsRequested( |
// available, send back an empty credential. |
if (zero_click_only && !IsZeroClickAllowed()) { |
base::MessageLoop::current()->PostTask( |
- FROM_HERE, base::Bind(&CredentialManager::SendCredential, |
+ FROM_HERE, base::Bind(&CredentialManager::SendCredentialByID, |
weak_factory_.GetWeakPtr(), request_id, |
password_manager::CredentialInfo())); |
return; |
@@ -161,8 +161,9 @@ void CredentialManager::CredentialsRequested( |
std::vector<std::string> realms; |
pending_request_.reset( |
new password_manager::CredentialManagerPendingRequestTask( |
- this, request_id, zero_click_only, page_url, true, federation_urls, |
- realms)); |
+ this, base::Bind(&CredentialManager::SendCredentialByID, |
+ base::Unretained(this), request_id), |
+ zero_click_only, page_url, true, federation_urls, realms)); |
store->GetAutofillableLogins(pending_request_.get()); |
} |
@@ -269,6 +270,12 @@ GURL CredentialManager::GetOrigin() const { |
} |
void CredentialManager::SendCredential( |
+ const password_manager::SendCredentialCallback& send_callback, |
+ const password_manager::CredentialInfo& credential) { |
+ send_callback.Run(credential); |
+} |
+ |
+void CredentialManager::SendCredentialByID( |
int request_id, |
const password_manager::CredentialInfo& credential) { |
// Invoked when the asynchronous interaction with the PasswordStore completes, |