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 76261153b96b2389b202041aa73d07713de2ae3f..43ee997ef1ddb73cc45e329da9a69bc9dfb0b67b 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, |
@@ -284,8 +291,9 @@ void CredentialManager::SendCredential( |
}]; |
} |
-void CredentialManager::SendPasswordForm(int request_id, |
- const autofill::PasswordForm* form) { |
+void CredentialManager::SendPasswordForm( |
+ const password_manager::SendCredentialCallback& send_callback, |
+ const autofill::PasswordForm* form) { |
password_manager::CredentialInfo info; |
if (form) { |
password_manager::CredentialType type_to_return = |
@@ -295,7 +303,7 @@ void CredentialManager::SendPasswordForm(int request_id, |
info = password_manager::CredentialInfo(*form, type_to_return); |
// TODO(vasilii): update |skip_zero_click| in the store (crbug.com/594110). |
} |
- SendCredential(request_id, info); |
+ SendCredential(send_callback, info); |
} |
password_manager::PasswordManagerClient* CredentialManager::client() const { |