Commit ece6c267 authored by Reilly Grant's avatar Reilly Grant Committed by Chromium LUCI CQ

Convert callbacks in //chrome/browser/chromeos/platform_keys

This change converts callbacks from base::Bind and base::Callback to
Once/Repeating in //chrome/browser/chromeos/platform_keys.

Bug: 1148570
Change-Id: I05f66512de80ac0fd0ac21cd941a408e17190fd7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2644074
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Omar Morsi <omorsi@google.com>
Reviewed-by: default avatarOmar Morsi <omorsi@google.com>
Cr-Commit-Position: refs/heads/master@{#846134}
parent e5553504
...@@ -83,11 +83,11 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task { ...@@ -83,11 +83,11 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task {
GenerateKeyTask(platform_keys::TokenId token_id, GenerateKeyTask(platform_keys::TokenId token_id,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback, GenerateKeyCallback callback,
ExtensionPlatformKeysService* service) ExtensionPlatformKeysService* service)
: token_id_(token_id), : token_id_(token_id),
extension_id_(extension_id), extension_id_(extension_id),
callback_(callback), callback_(std::move(callback)),
service_(service) {} service_(service) {}
~GenerateKeyTask() override = default; ~GenerateKeyTask() override = default;
...@@ -115,7 +115,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task { ...@@ -115,7 +115,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task {
switch (next_step_) { switch (next_step_) {
case Step::GENERATE_KEY: case Step::GENERATE_KEY:
next_step_ = Step::GET_EXTENSION_PERMISSIONS; next_step_ = Step::GET_EXTENSION_PERMISSIONS;
GenerateKey(base::Bind(&GenerateKeyTask::GeneratedKey, GenerateKey(base::BindOnce(&GenerateKeyTask::GeneratedKey,
weak_factory_.GetWeakPtr())); weak_factory_.GetWeakPtr()));
return; return;
case Step::GET_EXTENSION_PERMISSIONS: case Step::GET_EXTENSION_PERMISSIONS:
...@@ -139,7 +139,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task { ...@@ -139,7 +139,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task {
platform_keys::Status status) { platform_keys::Status status) {
if (status != platform_keys::Status::kSuccess) { if (status != platform_keys::Status::kSuccess) {
next_step_ = Step::DONE; next_step_ = Step::DONE;
callback_.Run(std::string() /* no public key */, status); std::move(callback_).Run(std::string() /* no public key */, status);
DoStep(); DoStep();
return; return;
} }
...@@ -159,7 +159,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task { ...@@ -159,7 +159,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task {
void OnKeyRegisteredForCorporateUsage(platform_keys::Status status) { void OnKeyRegisteredForCorporateUsage(platform_keys::Status status) {
if (status == platform_keys::Status::kSuccess) { if (status == platform_keys::Status::kSuccess) {
callback_.Run(public_key_spki_der_, status); std::move(callback_).Run(public_key_spki_der_, status);
DoStep(); DoStep();
return; return;
} }
...@@ -187,7 +187,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task { ...@@ -187,7 +187,7 @@ class ExtensionPlatformKeysService::GenerateKeyTask : public Task {
} }
next_step_ = Step::DONE; next_step_ = Step::DONE;
callback_.Run(std::string() /* no public key */, std::move(callback_).Run(std::string() /* no public key */,
corporate_key_registration_error_status); corporate_key_registration_error_status);
DoStep(); DoStep();
} }
...@@ -223,9 +223,9 @@ class ExtensionPlatformKeysService::GenerateRSAKeyTask ...@@ -223,9 +223,9 @@ class ExtensionPlatformKeysService::GenerateRSAKeyTask
GenerateRSAKeyTask(platform_keys::TokenId token_id, GenerateRSAKeyTask(platform_keys::TokenId token_id,
unsigned int modulus_length, unsigned int modulus_length,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback, GenerateKeyCallback callback,
ExtensionPlatformKeysService* service) ExtensionPlatformKeysService* service)
: GenerateKeyTask(token_id, extension_id, callback, service), : GenerateKeyTask(token_id, extension_id, std::move(callback), service),
modulus_length_(modulus_length) {} modulus_length_(modulus_length) {}
~GenerateRSAKeyTask() override {} ~GenerateRSAKeyTask() override {}
...@@ -234,7 +234,7 @@ class ExtensionPlatformKeysService::GenerateRSAKeyTask ...@@ -234,7 +234,7 @@ class ExtensionPlatformKeysService::GenerateRSAKeyTask
// Generates the RSA key. // Generates the RSA key.
void GenerateKey(GenerateKeyCallback callback) override { void GenerateKey(GenerateKeyCallback callback) override {
service_->platform_keys_service_->GenerateRSAKey(token_id_, modulus_length_, service_->platform_keys_service_->GenerateRSAKey(token_id_, modulus_length_,
callback); std::move(callback));
} }
const unsigned int modulus_length_; const unsigned int modulus_length_;
...@@ -248,9 +248,9 @@ class ExtensionPlatformKeysService::GenerateECKeyTask : public GenerateKeyTask { ...@@ -248,9 +248,9 @@ class ExtensionPlatformKeysService::GenerateECKeyTask : public GenerateKeyTask {
GenerateECKeyTask(platform_keys::TokenId token_id, GenerateECKeyTask(platform_keys::TokenId token_id,
const std::string& named_curve, const std::string& named_curve,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback, GenerateKeyCallback callback,
ExtensionPlatformKeysService* service) ExtensionPlatformKeysService* service)
: GenerateKeyTask(token_id, extension_id, callback, service), : GenerateKeyTask(token_id, extension_id, std::move(callback), service),
named_curve_(named_curve) {} named_curve_(named_curve) {}
~GenerateECKeyTask() override {} ~GenerateECKeyTask() override {}
...@@ -259,7 +259,7 @@ class ExtensionPlatformKeysService::GenerateECKeyTask : public GenerateKeyTask { ...@@ -259,7 +259,7 @@ class ExtensionPlatformKeysService::GenerateECKeyTask : public GenerateKeyTask {
// Generates the EC key. // Generates the EC key.
void GenerateKey(GenerateKeyCallback callback) override { void GenerateKey(GenerateKeyCallback callback) override {
service_->platform_keys_service_->GenerateECKey(token_id_, named_curve_, service_->platform_keys_service_->GenerateECKey(token_id_, named_curve_,
callback); std::move(callback));
} }
const std::string named_curve_; const std::string named_curve_;
...@@ -410,19 +410,19 @@ class ExtensionPlatformKeysService::SignTask : public Task { ...@@ -410,19 +410,19 @@ class ExtensionPlatformKeysService::SignTask : public Task {
if (raw_pkcs1_) { if (raw_pkcs1_) {
service_->platform_keys_service_->SignRSAPKCS1Raw( service_->platform_keys_service_->SignRSAPKCS1Raw(
token_id_, data_, public_key_spki_der_, token_id_, data_, public_key_spki_der_,
base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); base::BindOnce(&SignTask::DidSign, weak_factory_.GetWeakPtr()));
} else { } else {
service_->platform_keys_service_->SignRSAPKCS1Digest( service_->platform_keys_service_->SignRSAPKCS1Digest(
token_id_, data_, public_key_spki_der_, hash_algorithm_, token_id_, data_, public_key_spki_der_, hash_algorithm_,
base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); base::BindOnce(&SignTask::DidSign, weak_factory_.GetWeakPtr()));
} }
break; break;
} }
case platform_keys::KeyType::kEcdsa: { case platform_keys::KeyType::kEcdsa: {
service_->platform_keys_service_->SignECDSADigest( service_->platform_keys_service_->SignECDSADigest(
token_id_, data_, public_key_spki_der_, hash_algorithm_, token_id_, data_, public_key_spki_der_, hash_algorithm_,
base::Bind(&SignTask::DidSign, weak_factory_.GetWeakPtr())); base::BindOnce(&SignTask::DidSign, weak_factory_.GetWeakPtr()));
break; break;
} }
} }
...@@ -479,14 +479,14 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -479,14 +479,14 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
std::unique_ptr<net::CertificateList> input_client_certificates, std::unique_ptr<net::CertificateList> input_client_certificates,
bool interactive, bool interactive,
const std::string& extension_id, const std::string& extension_id,
const SelectCertificatesCallback& callback, SelectCertificatesCallback callback,
content::WebContents* web_contents, content::WebContents* web_contents,
ExtensionPlatformKeysService* service) ExtensionPlatformKeysService* service)
: request_(request), : request_(request),
input_client_certificates_(std::move(input_client_certificates)), input_client_certificates_(std::move(input_client_certificates)),
interactive_(interactive), interactive_(interactive),
extension_id_(extension_id), extension_id_(extension_id),
callback_(callback), callback_(std::move(callback)),
web_contents_(web_contents), web_contents_(web_contents),
service_(service) {} service_(service) {}
~SelectTask() override {} ~SelectTask() override {}
...@@ -562,7 +562,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -562,7 +562,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
void GetMatchingCerts() { void GetMatchingCerts() {
service_->platform_keys_service_->SelectClientCertificates( service_->platform_keys_service_->SelectClientCertificates(
request_.certificate_authorities, request_.certificate_authorities,
base::Bind(&SelectTask::GotMatchingCerts, weak_factory_.GetWeakPtr())); base::BindOnce(&SelectTask::GotMatchingCerts,
weak_factory_.GetWeakPtr()));
} }
// If the certificate request could be processed successfully, |matches| will // If the certificate request could be processed successfully, |matches| will
...@@ -574,7 +575,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -574,7 +575,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
platform_keys::Status status) { platform_keys::Status status) {
if (status != platform_keys::Status::kSuccess) { if (status != platform_keys::Status::kSuccess) {
next_step_ = Step::DONE; next_step_ = Step::DONE;
callback_.Run(nullptr /* no certificates */, status); std::move(callback_).Run(nullptr /* no certificates */, status);
DoStep(); DoStep();
return; return;
} }
...@@ -666,7 +667,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -666,7 +667,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
} }
platform_keys::IntersectCertificates( platform_keys::IntersectCertificates(
matches_, *input_client_certificates_, matches_, *input_client_certificates_,
base::Bind(&SelectTask::GotIntersection, weak_factory_.GetWeakPtr())); base::BindOnce(&SelectTask::GotIntersection,
weak_factory_.GetWeakPtr()));
} }
void GotIntersection(std::unique_ptr<net::CertificateList> intersection) { void GotIntersection(std::unique_ptr<net::CertificateList> intersection) {
...@@ -686,7 +688,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -686,7 +688,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
} }
service_->select_delegate_->Select( service_->select_delegate_->Select(
extension_id_, matches_, extension_id_, matches_,
base::Bind(&SelectTask::GotSelection, base::Unretained(this)), base::BindOnce(&SelectTask::GotSelection, base::Unretained(this)),
web_contents_, service_->browser_context_); web_contents_, service_->browser_context_);
} }
...@@ -731,7 +733,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -731,7 +733,8 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
selection->assign(matches_.begin(), matches_.end()); selection->assign(matches_.begin(), matches_.end());
} }
callback_.Run(std::move(selection), platform_keys::Status::kSuccess); std::move(callback_).Run(std::move(selection),
platform_keys::Status::kSuccess);
DoStep(); DoStep();
} }
...@@ -745,7 +748,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task { ...@@ -745,7 +748,7 @@ class ExtensionPlatformKeysService::SelectTask : public Task {
std::unique_ptr<net::CertificateList> input_client_certificates_; std::unique_ptr<net::CertificateList> input_client_certificates_;
const bool interactive_; const bool interactive_;
const std::string extension_id_; const std::string extension_id_;
const SelectCertificatesCallback callback_; SelectCertificatesCallback callback_;
content::WebContents* const web_contents_; content::WebContents* const web_contents_;
std::unique_ptr<platform_keys::ExtensionKeyPermissionsService> std::unique_ptr<platform_keys::ExtensionKeyPermissionsService>
extension_key_permissions_service_; extension_key_permissions_service_;
...@@ -788,20 +791,20 @@ void ExtensionPlatformKeysService::GenerateRSAKey( ...@@ -788,20 +791,20 @@ void ExtensionPlatformKeysService::GenerateRSAKey(
platform_keys::TokenId token_id, platform_keys::TokenId token_id,
unsigned int modulus_length, unsigned int modulus_length,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback) { GenerateKeyCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
StartOrQueueTask(std::make_unique<GenerateRSAKeyTask>( StartOrQueueTask(std::make_unique<GenerateRSAKeyTask>(
token_id, modulus_length, extension_id, callback, this)); token_id, modulus_length, extension_id, std::move(callback), this));
} }
void ExtensionPlatformKeysService::GenerateECKey( void ExtensionPlatformKeysService::GenerateECKey(
platform_keys::TokenId token_id, platform_keys::TokenId token_id,
const std::string& named_curve, const std::string& named_curve,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback) { GenerateKeyCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
StartOrQueueTask(std::make_unique<GenerateECKeyTask>( StartOrQueueTask(std::make_unique<GenerateECKeyTask>(
token_id, named_curve, extension_id, callback, this)); token_id, named_curve, extension_id, std::move(callback), this));
} }
bool ExtensionPlatformKeysService::IsUsingSigninProfile() { bool ExtensionPlatformKeysService::IsUsingSigninProfile() {
...@@ -843,12 +846,12 @@ void ExtensionPlatformKeysService::SelectClientCertificates( ...@@ -843,12 +846,12 @@ void ExtensionPlatformKeysService::SelectClientCertificates(
std::unique_ptr<net::CertificateList> client_certificates, std::unique_ptr<net::CertificateList> client_certificates,
bool interactive, bool interactive,
const std::string& extension_id, const std::string& extension_id,
const SelectCertificatesCallback& callback, SelectCertificatesCallback callback,
content::WebContents* web_contents) { content::WebContents* web_contents) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
StartOrQueueTask(std::make_unique<SelectTask>( StartOrQueueTask(std::make_unique<SelectTask>(
request, std::move(client_certificates), interactive, extension_id, request, std::move(client_certificates), interactive, extension_id,
callback, web_contents, this)); std::move(callback), web_contents, this));
} }
void ExtensionPlatformKeysService::StartOrQueueTask( void ExtensionPlatformKeysService::StartOrQueueTask(
......
...@@ -47,7 +47,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -47,7 +47,7 @@ class ExtensionPlatformKeysService : public KeyedService {
// can happen by exposing UI to let the user select. // can happen by exposing UI to let the user select.
class SelectDelegate { class SelectDelegate {
public: public:
using CertificateSelectedCallback = base::Callback<void( using CertificateSelectedCallback = base::OnceCallback<void(
const scoped_refptr<net::X509Certificate>& selection)>; const scoped_refptr<net::X509Certificate>& selection)>;
SelectDelegate(); SelectDelegate();
...@@ -94,7 +94,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -94,7 +94,7 @@ class ExtensionPlatformKeysService : public KeyedService {
// DER encoding of the SubjectPublicKeyInfo of the generated key. If it // DER encoding of the SubjectPublicKeyInfo of the generated key. If it
// failed, |public_key_spki_der| will be empty. // failed, |public_key_spki_der| will be empty.
using GenerateKeyCallback = using GenerateKeyCallback =
base::Callback<void(const std::string& public_key_spki_der, base::OnceCallback<void(const std::string& public_key_spki_der,
platform_keys::Status status)>; platform_keys::Status status)>;
// Generates an RSA key pair with |modulus_length_bits| and registers the key // Generates an RSA key pair with |modulus_length_bits| and registers the key
...@@ -106,7 +106,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -106,7 +106,7 @@ class ExtensionPlatformKeysService : public KeyedService {
void GenerateRSAKey(platform_keys::TokenId token_id, void GenerateRSAKey(platform_keys::TokenId token_id,
unsigned int modulus_length_bits, unsigned int modulus_length_bits,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback); GenerateKeyCallback callback);
// Generates an EC key pair with |named_curve| and registers the key to allow // Generates an EC key pair with |named_curve| and registers the key to allow
// a single sign operation by the given extension. |token_id| specifies the // a single sign operation by the given extension. |token_id| specifies the
...@@ -117,7 +117,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -117,7 +117,7 @@ class ExtensionPlatformKeysService : public KeyedService {
void GenerateECKey(platform_keys::TokenId token_id, void GenerateECKey(platform_keys::TokenId token_id,
const std::string& named_curve, const std::string& named_curve,
const std::string& extension_id, const std::string& extension_id,
const GenerateKeyCallback& callback); GenerateKeyCallback callback);
// Gets the current profile using the BrowserContext object and returns // Gets the current profile using the BrowserContext object and returns
// whether the current profile is a sign in profile with // whether the current profile is a sign in profile with
...@@ -171,7 +171,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -171,7 +171,7 @@ class ExtensionPlatformKeysService : public KeyedService {
// contain the list of matching certificates (maybe empty). If an error // contain the list of matching certificates (maybe empty). If an error
// occurred, |matches| will be null. // occurred, |matches| will be null.
using SelectCertificatesCallback = using SelectCertificatesCallback =
base::Callback<void(std::unique_ptr<net::CertificateList> matches, base::OnceCallback<void(std::unique_ptr<net::CertificateList> matches,
platform_keys::Status status)>; platform_keys::Status status)>;
// Returns a list of certificates matching |request|. // Returns a list of certificates matching |request|.
...@@ -193,7 +193,7 @@ class ExtensionPlatformKeysService : public KeyedService { ...@@ -193,7 +193,7 @@ class ExtensionPlatformKeysService : public KeyedService {
std::unique_ptr<net::CertificateList> client_certificates, std::unique_ptr<net::CertificateList> client_certificates,
bool interactive, bool interactive,
const std::string& extension_id, const std::string& extension_id,
const SelectCertificatesCallback& callback, SelectCertificatesCallback callback,
content::WebContents* web_contents); content::WebContents* web_contents);
private: private:
......
...@@ -105,8 +105,7 @@ std::string StatusToString(Status status) { ...@@ -105,8 +105,7 @@ std::string StatusToString(Status status) {
void IntersectCertificates( void IntersectCertificates(
const net::CertificateList& certs1, const net::CertificateList& certs1,
const net::CertificateList& certs2, const net::CertificateList& certs2,
const base::Callback<void(std::unique_ptr<net::CertificateList>)>& base::OnceCallback<void(std::unique_ptr<net::CertificateList>)> callback) {
callback) {
std::unique_ptr<net::CertificateList> intersection(new net::CertificateList); std::unique_ptr<net::CertificateList> intersection(new net::CertificateList);
net::CertificateList* const intersection_ptr = intersection.get(); net::CertificateList* const intersection_ptr = intersection.get();
...@@ -119,7 +118,7 @@ void IntersectCertificates( ...@@ -119,7 +118,7 @@ void IntersectCertificates(
base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN},
base::BindOnce(&IntersectOnWorkerThread, certs1, certs2, base::BindOnce(&IntersectOnWorkerThread, certs1, certs2,
intersection_ptr), intersection_ptr),
base::BindOnce(callback, base::Passed(&intersection))); base::BindOnce(std::move(callback), std::move(intersection)));
} }
GetPublicKeyAndAlgorithmOutput::GetPublicKeyAndAlgorithmOutput() = default; GetPublicKeyAndAlgorithmOutput::GetPublicKeyAndAlgorithmOutput() = default;
......
...@@ -78,8 +78,7 @@ std::string GetSubjectPublicKeyInfo( ...@@ -78,8 +78,7 @@ std::string GetSubjectPublicKeyInfo(
void IntersectCertificates( void IntersectCertificates(
const net::CertificateList& certs1, const net::CertificateList& certs1,
const net::CertificateList& certs2, const net::CertificateList& certs2,
const base::Callback<void(std::unique_ptr<net::CertificateList>)>& base::OnceCallback<void(std::unique_ptr<net::CertificateList>)> callback);
callback);
// The output for GetPublicKeyAndAlgorithm. // The output for GetPublicKeyAndAlgorithm.
struct GetPublicKeyAndAlgorithmOutput { struct GetPublicKeyAndAlgorithmOutput {
......
...@@ -235,10 +235,9 @@ class PlatformKeysServiceBrowserTestBase ...@@ -235,10 +235,9 @@ class PlatformKeysServiceBrowserTestBase
} }
private: private:
void SetUserSlot(const base::Closure& done_callback, void SetUserSlot(base::OnceClosure done_callback, net::NSSCertDatabase* db) {
net::NSSCertDatabase* db) {
user_slot_ = db->GetPrivateSlot(); user_slot_ = db->GetPrivateSlot();
done_callback.Run(); std::move(done_callback).Run();
} }
const AccountId test_user_account_id_ = AccountId::FromUserEmailGaiaId( const AccountId test_user_account_id_ = AccountId::FromUserEmailGaiaId(
......
...@@ -51,7 +51,7 @@ void GetCertDatabaseOnIoThread( ...@@ -51,7 +51,7 @@ void GetCertDatabaseOnIoThread(
base::RepeatingCallback<void(net::NSSCertDatabase*)> on_got_on_io_thread = base::RepeatingCallback<void(net::NSSCertDatabase*)> on_got_on_io_thread =
base::BindRepeating(&DidGetCertDbOnIoThread, origin_task_runner, base::BindRepeating(&DidGetCertDbOnIoThread, origin_task_runner,
base::AdaptCallbackForRepeating(std::move(callback))); base::Passed(&callback));
net::NSSCertDatabase* cert_db = net::NSSCertDatabase* cert_db =
GetNSSCertDatabaseForResourceContext(context, on_got_on_io_thread); GetNSSCertDatabaseForResourceContext(context, on_got_on_io_thread);
......
...@@ -1873,7 +1873,7 @@ void PlatformKeysServiceImpl::GetTokens(GetTokensCallback callback) { ...@@ -1873,7 +1873,7 @@ void PlatformKeysServiceImpl::GetTokens(GetTokensCallback callback) {
// Get the pointer to |state| before base::Passed releases |state|. // Get the pointer to |state| before base::Passed releases |state|.
NSSOperationState* state_ptr = state.get(); NSSOperationState* state_ptr = state.get();
GetCertDatabase(/*token_id=*/base::nullopt /* don't get any specific slot */, GetCertDatabase(/*token_id=*/base::nullopt /* don't get any specific slot */,
base::Bind(&GetTokensWithDB, base::Passed(&state)), base::BindOnce(&GetTokensWithDB, std::move(state)),
delegate_.get(), state_ptr); delegate_.get(), state_ptr);
} }
...@@ -1891,7 +1891,7 @@ void PlatformKeysServiceImpl::GetKeyLocations( ...@@ -1891,7 +1891,7 @@ void PlatformKeysServiceImpl::GetKeyLocations(
GetCertDatabase( GetCertDatabase(
/*token_id=*/base::nullopt /* don't get any specific slot */, /*token_id=*/base::nullopt /* don't get any specific slot */,
base::BindRepeating(&GetKeyLocationsWithDB, base::Passed(&state)), base::BindOnce(&GetKeyLocationsWithDB, base::Passed(&state)),
delegate_.get(), state_ptr); delegate_.get(), state_ptr);
} }
......
...@@ -38,10 +38,10 @@ class ExecutionWaiter { ...@@ -38,10 +38,10 @@ class ExecutionWaiter {
// Returns the callback to be passed to the PlatformKeysService operation // Returns the callback to be passed to the PlatformKeysService operation
// invocation. // invocation.
base::RepeatingCallback<void(ResultCallbackArgs... result_callback_args, base::OnceCallback<void(ResultCallbackArgs... result_callback_args,
Status status)> Status status)>
GetCallback() { GetCallback() {
return base::BindRepeating(&ExecutionWaiter::OnExecutionDone, return base::BindOnce(&ExecutionWaiter::OnExecutionDone,
weak_ptr_factory_.GetWeakPtr()); weak_ptr_factory_.GetWeakPtr());
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment