Commit 2c50fa52 authored by Omar Morsi's avatar Omar Morsi Committed by Commit Bot

Accept only OnceCallbacks in PlatformKeysService interface

Bug: 1130594
Change-Id: I815675d485a40f7131e48908cd1f25d8f20c74d4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2421459Reviewed-by: default avatarPavol Marko <pmarko@chromium.org>
Commit-Queue: Omar Morsi <omorsi@google.com>
Cr-Commit-Position: refs/heads/master@{#809232}
parent 6b2a0e0d
......@@ -57,7 +57,7 @@ CertificateHelperForTesting::~CertificateHelperForTesting() = default;
void CertificateHelperForTesting::GetCertificates(
platform_keys::TokenId token_id,
const platform_keys::GetCertificatesCallback& callback) {
platform_keys::GetCertificatesCallback callback) {
auto result = std::make_unique<net::CertificateList>();
*result = cert_list_;
std::move(callback).Run(std::move(result), platform_keys::Status::kSuccess);
......
......@@ -63,7 +63,7 @@ struct CertificateHelperForTesting {
private:
void GetCertificates(platform_keys::TokenId token_id,
const platform_keys::GetCertificatesCallback& callback);
platform_keys::GetCertificatesCallback callback);
platform_keys::MockPlatformKeysService* platform_keys_service_ = nullptr;
scoped_refptr<net::X509Certificate> template_cert_;
......
......@@ -39,14 +39,14 @@ class MockPlatformKeysService : public PlatformKeysService {
GenerateRSAKey,
(TokenId token_id,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback),
GenerateKeyCallback callback),
(override));
MOCK_METHOD(void,
GenerateECKey,
(TokenId token_id,
const std::string& named_curve,
const GenerateKeyCallback& callback),
GenerateKeyCallback callback),
(override));
MOCK_METHOD(void,
......@@ -55,7 +55,7 @@ class MockPlatformKeysService : public PlatformKeysService {
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback),
SignCallback callback),
(override));
MOCK_METHOD(void,
......@@ -63,7 +63,7 @@ class MockPlatformKeysService : public PlatformKeysService {
(base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const SignCallback& callback),
SignCallback callback),
(override));
MOCK_METHOD(void,
......@@ -72,18 +72,18 @@ class MockPlatformKeysService : public PlatformKeysService {
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback),
SignCallback callback),
(override));
MOCK_METHOD(void,
SelectClientCertificates,
(const std::vector<std::string>& certificate_authorities,
const SelectCertificatesCallback& callback),
SelectCertificatesCallback callback),
(override));
MOCK_METHOD(void,
GetCertificates,
(TokenId token_id, const GetCertificatesCallback& callback),
(TokenId token_id, GetCertificatesCallback callback),
(override));
MOCK_METHOD(void,
......@@ -95,14 +95,14 @@ class MockPlatformKeysService : public PlatformKeysService {
ImportCertificate,
(TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback),
ImportCertificateCallback callback),
(override));
MOCK_METHOD(void,
RemoveCertificate,
(TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback),
RemoveCertificateCallback callback),
(override));
MOCK_METHOD(void,
......@@ -117,7 +117,7 @@ class MockPlatformKeysService : public PlatformKeysService {
MOCK_METHOD(void,
GetKeyLocations,
(const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback),
GetKeyLocationsCallback callback),
(override));
MOCK_METHOD(void,
......
......@@ -30,24 +30,25 @@ namespace chromeos {
namespace platform_keys {
using GenerateKeyCallback =
base::Callback<void(const std::string& public_key_spki_der, Status status)>;
base::OnceCallback<void(const std::string& public_key_spki_der,
Status status)>;
using SignCallback =
base::Callback<void(const std::string& signature, Status status)>;
base::OnceCallback<void(const std::string& signature, Status status)>;
// If the certificate request could be processed successfully, |matches| will
// contain the list of matching certificates (which may be empty). If an error
// occurred, |matches| will be null.
using SelectCertificatesCallback =
base::Callback<void(std::unique_ptr<net::CertificateList> matches,
Status status)>;
base::OnceCallback<void(std::unique_ptr<net::CertificateList> matches,
Status status)>;
// If the list of certificates could be successfully retrieved, |certs| will
// contain the list of available certificates (maybe empty). If an error
// occurred, |certs| will be empty.
using GetCertificatesCallback =
base::Callback<void(std::unique_ptr<net::CertificateList> certs,
Status status)>;
base::OnceCallback<void(std::unique_ptr<net::CertificateList> certs,
Status status)>;
// If the list of key pairs could be successfully retrieved,
// |public_key_spki_der_list| will contain the list of available key pairs (may
......@@ -77,11 +78,9 @@ using GetTokensCallback =
// user has access to. Note that this is also the case if the key exists on the
// system token, but the current user does not have access to the system token.
// If an error occurred during processing, |token_ids| will be empty.
// TODO(pmarko): This is currently a RepeatingCallback because of
// GetNSSCertDatabaseForResourceContext semantics.
using GetKeyLocationsCallback =
base::RepeatingCallback<void(const std::vector<TokenId>& token_ids,
Status status)>;
base::OnceCallback<void(const std::vector<TokenId>& token_ids,
Status status)>;
using SetAttributeForKeyCallback = base::OnceCallback<void(Status status)>;
......@@ -130,14 +129,14 @@ class PlatformKeysService : public KeyedService {
// resulting public key or an error status.
virtual void GenerateRSAKey(TokenId token_id,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback) = 0;
GenerateKeyCallback callback) = 0;
// Generates a EC key pair with |named_curve|. |token_id| specifies the token
// to store the key pair on. |callback| will be invoked with the resulting
// public key or an error status.
virtual void GenerateECKey(TokenId token_id,
const std::string& named_curve,
const GenerateKeyCallback& callback) = 0;
GenerateKeyCallback callback) = 0;
// Digests |data|, applies PKCS1 padding and afterwards signs the data with
// the private key matching |public_key_spki_der|. If the key is not found in
......@@ -148,7 +147,7 @@ class PlatformKeysService : public KeyedService {
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) = 0;
SignCallback callback) = 0;
// Applies PKCS1 padding and afterwards signs the data with the private key
// matching |public_key_spki_der|. |data| is not digested. If the key is not
......@@ -159,7 +158,7 @@ class PlatformKeysService : public KeyedService {
virtual void SignRSAPKCS1Raw(base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const SignCallback& callback) = 0;
SignCallback callback) = 0;
// Digests |data| and afterwards signs the data with the private key matching
// |public_key_spki_der|. If the key is not found in that |token_id| (or in
......@@ -170,7 +169,7 @@ class PlatformKeysService : public KeyedService {
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) = 0;
SignCallback callback) = 0;
// Returns the list of all certificates that were issued by one of the
// |certificate_authorities|. If |certificate_authorities| is empty, all
......@@ -178,14 +177,14 @@ class PlatformKeysService : public KeyedService {
// or an error status.
virtual void SelectClientCertificates(
const std::vector<std::string>& certificate_authorities,
const SelectCertificatesCallback& callback) = 0;
const SelectCertificatesCallback callback) = 0;
// Returns the list of all certificates with stored private key available from
// the given token. Only certificates from the specified |token_id| are
// listed. |callback| will be invoked with the list of available certificates
// or an error status.
virtual void GetCertificates(TokenId token_id,
const GetCertificatesCallback& callback) = 0;
const GetCertificatesCallback callback) = 0;
// Returns the list of all keys available from the given |token_id| as a list
// of der-encoded SubjectPublicKeyInfo strings. |callback| will be invoked on
......@@ -201,7 +200,7 @@ class PlatformKeysService : public KeyedService {
virtual void ImportCertificate(
TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback) = 0;
ImportCertificateCallback callback) = 0;
// Removes |certificate| from the given token. Any intermediate of
// |certificate| will be ignored. |token_id| specifies the token to remove the
......@@ -210,7 +209,7 @@ class PlatformKeysService : public KeyedService {
virtual void RemoveCertificate(
TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback) = 0;
RemoveCertificateCallback callback) = 0;
// Removes the key pair if no matching certificates exist. Only keys in the
// given |token_id| are considered. |callback| will be invoked on the UI
......@@ -229,7 +228,7 @@ class PlatformKeysService : public KeyedService {
// ids are determined, possibly with an error status. Calls |callback| on the
// UI thread.
virtual void GetKeyLocations(const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback) = 0;
GetKeyLocationsCallback callback) = 0;
// Sets |attribute_type| for the private key corresponding to
// |public_key_spki_der| to |attribute_value| only if the key is in
......@@ -314,42 +313,42 @@ class PlatformKeysServiceImpl final : public PlatformKeysService {
void RemoveObserver(PlatformKeysServiceObserver* observer) override;
void GenerateRSAKey(TokenId token_id,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback) override;
GenerateKeyCallback callback) override;
void GenerateECKey(TokenId token_id,
const std::string& named_curve,
const GenerateKeyCallback& callback) override;
GenerateKeyCallback callback) override;
void SignRSAPKCS1Digest(base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) override;
SignCallback callback) override;
void SignRSAPKCS1Raw(base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const SignCallback& callback) override;
SignCallback callback) override;
void SignECDSADigest(base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) override;
SignCallback callback) override;
void SelectClientCertificates(
const std::vector<std::string>& certificate_authorities,
const SelectCertificatesCallback& callback) override;
SelectCertificatesCallback callback) override;
void GetCertificates(TokenId token_id,
const GetCertificatesCallback& callback) override;
GetCertificatesCallback callback) override;
void GetAllKeys(TokenId token_id, GetAllKeysCallback callback) override;
void ImportCertificate(TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback) override;
ImportCertificateCallback callback) override;
void RemoveCertificate(TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback) override;
RemoveCertificateCallback callback) override;
void RemoveKey(TokenId token_id,
const std::string& public_key_spki_der,
RemoveKeyCallback callback) override;
void GetTokens(GetTokensCallback callback) override;
void GetKeyLocations(const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback) override;
const GetKeyLocationsCallback callback) override;
void SetAttributeForKey(TokenId token_id,
const std::string& public_key_spki_der,
KeyAttributeType attribute_type,
......
......@@ -165,7 +165,7 @@ class GenerateRSAKeyState : public NSSOperationState {
public:
GenerateRSAKeyState(ServiceWeakPtr weak_ptr,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback);
GenerateKeyCallback callback);
~GenerateRSAKeyState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -186,7 +186,7 @@ class GenerateRSAKeyState : public NSSOperationState {
UMA_HISTOGRAM_BOOLEAN("ChromeOS.PlatformKeysService.GenerateKey.RSA",
status == Status::kSuccess);
auto bound_callback =
base::BindOnce(callback_, public_key_spki_der, status);
base::BindOnce(std::move(callback_), public_key_spki_der, status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -200,7 +200,7 @@ class GenerateECKeyState : public NSSOperationState {
public:
GenerateECKeyState(ServiceWeakPtr weak_ptr,
const std::string& named_curve,
const GenerateKeyCallback& callback);
GenerateKeyCallback callback);
~GenerateECKeyState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -221,7 +221,7 @@ class GenerateECKeyState : public NSSOperationState {
UMA_HISTOGRAM_BOOLEAN("ChromeOS.PlatformKeysService.GenerateKey.EC",
status == Status::kSuccess);
auto bound_callback =
base::BindOnce(callback_, public_key_spki_der, status);
base::BindOnce(std::move(callback_), public_key_spki_der, status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -239,7 +239,7 @@ class SignState : public NSSOperationState {
bool raw_pkcs1,
HashAlgorithm hash_algorithm,
const KeyType key_type,
const SignCallback& callback);
SignCallback callback);
~SignState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -276,7 +276,8 @@ class SignState : public NSSOperationState {
const std::string& signature,
Status status) {
EmitOperationStatusToHistogram(status == Status::kSuccess);
auto bound_callback = base::BindOnce(callback_, signature, status);
auto bound_callback =
base::BindOnce(std::move(callback_), signature, status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -304,7 +305,7 @@ class SelectCertificatesState : public NSSOperationState {
explicit SelectCertificatesState(
ServiceWeakPtr weak_ptr,
const scoped_refptr<net::SSLCertRequestInfo>& request,
const SelectCertificatesCallback& callback);
SelectCertificatesCallback callback);
~SelectCertificatesState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -324,7 +325,8 @@ class SelectCertificatesState : public NSSOperationState {
void CallBack(const base::Location& from,
std::unique_ptr<net::CertificateList> matches,
Status status) {
auto bound_callback = base::BindOnce(callback_, std::move(matches), status);
auto bound_callback =
base::BindOnce(std::move(callback_), std::move(matches), status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -337,7 +339,7 @@ class SelectCertificatesState : public NSSOperationState {
class GetCertificatesState : public NSSOperationState {
public:
explicit GetCertificatesState(ServiceWeakPtr weak_ptr,
const GetCertificatesCallback& callback);
GetCertificatesCallback callback);
~GetCertificatesState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -357,7 +359,8 @@ class GetCertificatesState : public NSSOperationState {
void CallBack(const base::Location& from,
std::unique_ptr<net::CertificateList> certs,
Status status) {
auto bound_callback = base::BindOnce(callback_, std::move(certs), status);
auto bound_callback =
base::BindOnce(std::move(callback_), std::move(certs), status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -402,7 +405,7 @@ class ImportCertificateState : public NSSOperationState {
public:
ImportCertificateState(ServiceWeakPtr weak_ptr,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback);
ImportCertificateCallback callback);
~ImportCertificateState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -417,7 +420,7 @@ class ImportCertificateState : public NSSOperationState {
private:
void CallBack(const base::Location& from, Status status) {
auto bound_callback = base::BindOnce(callback_, status);
auto bound_callback = base::BindOnce(std::move(callback_), status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -431,7 +434,7 @@ class RemoveCertificateState : public NSSOperationState {
public:
RemoveCertificateState(ServiceWeakPtr weak_ptr,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback);
RemoveCertificateCallback callback);
~RemoveCertificateState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -446,7 +449,7 @@ class RemoveCertificateState : public NSSOperationState {
private:
void CallBack(const base::Location& from, Status status) {
auto bound_callback = base::BindOnce(callback_, status);
auto bound_callback = base::BindOnce(std::move(callback_), status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -520,7 +523,7 @@ class GetKeyLocationsState : public NSSOperationState {
public:
GetKeyLocationsState(ServiceWeakPtr weak_ptr,
const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback);
GetKeyLocationsCallback callback);
~GetKeyLocationsState() override = default;
void OnError(const base::Location& from, Status status) override {
......@@ -539,7 +542,8 @@ class GetKeyLocationsState : public NSSOperationState {
void CallBack(const base::Location& from,
const std::vector<TokenId>& token_ids,
Status status) {
auto bound_callback = base::BindOnce(callback_, token_ids, status);
auto bound_callback =
base::BindOnce(std::move(callback_), token_ids, status);
origin_task_runner_->PostTask(
from, base::BindOnce(&NSSOperationState::RunCallback,
std::move(bound_callback), service_weak_ptr_));
......@@ -625,17 +629,17 @@ NSSOperationState::NSSOperationState(ServiceWeakPtr weak_ptr)
GenerateRSAKeyState::GenerateRSAKeyState(ServiceWeakPtr weak_ptr,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback)
GenerateKeyCallback callback)
: NSSOperationState(weak_ptr),
modulus_length_bits_(modulus_length_bits),
callback_(callback) {}
callback_(std::move(callback)) {}
GenerateECKeyState::GenerateECKeyState(ServiceWeakPtr weak_ptr,
const std::string& named_curve,
const GenerateKeyCallback& callback)
GenerateKeyCallback callback)
: NSSOperationState(weak_ptr),
named_curve_(named_curve),
callback_(callback) {}
callback_(std::move(callback)) {}
SignState::SignState(ServiceWeakPtr weak_ptr,
const std::string& data,
......@@ -643,27 +647,26 @@ SignState::SignState(ServiceWeakPtr weak_ptr,
bool raw_pkcs1,
HashAlgorithm hash_algorithm,
const KeyType key_type,
const SignCallback& callback)
SignCallback callback)
: NSSOperationState(weak_ptr),
data_(data),
public_key_spki_der_(public_key_spki_der),
raw_pkcs1_(raw_pkcs1),
hash_algorithm_(hash_algorithm),
key_type_(key_type),
callback_(callback) {}
callback_(std::move(callback)) {}
SelectCertificatesState::SelectCertificatesState(
ServiceWeakPtr weak_ptr,
const scoped_refptr<net::SSLCertRequestInfo>& cert_request_info,
const SelectCertificatesCallback& callback)
SelectCertificatesCallback callback)
: NSSOperationState(weak_ptr),
cert_request_info_(cert_request_info),
callback_(callback) {}
callback_(std::move(callback)) {}
GetCertificatesState::GetCertificatesState(
ServiceWeakPtr weak_ptr,
const GetCertificatesCallback& callback)
: NSSOperationState(weak_ptr), callback_(callback) {}
GetCertificatesState::GetCertificatesState(ServiceWeakPtr weak_ptr,
GetCertificatesCallback callback)
: NSSOperationState(weak_ptr), callback_(std::move(callback)) {}
GetAllKeysState::GetAllKeysState(ServiceWeakPtr weak_ptr,
GetAllKeysCallback callback)
......@@ -672,18 +675,18 @@ GetAllKeysState::GetAllKeysState(ServiceWeakPtr weak_ptr,
ImportCertificateState::ImportCertificateState(
ServiceWeakPtr weak_ptr,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback)
ImportCertificateCallback callback)
: NSSOperationState(weak_ptr),
certificate_(certificate),
callback_(callback) {}
callback_(std::move(callback)) {}
RemoveCertificateState::RemoveCertificateState(
ServiceWeakPtr weak_ptr,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback)
RemoveCertificateCallback callback)
: NSSOperationState(weak_ptr),
certificate_(certificate),
callback_(callback) {}
callback_(std::move(callback)) {}
RemoveKeyState::RemoveKeyState(ServiceWeakPtr weak_ptr,
const std::string& public_key_spki_der,
......@@ -699,10 +702,10 @@ GetTokensState::GetTokensState(ServiceWeakPtr weak_ptr,
GetKeyLocationsState::GetKeyLocationsState(
ServiceWeakPtr weak_ptr,
const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback)
GetKeyLocationsCallback callback)
: NSSOperationState(weak_ptr),
public_key_spki_der_(public_key_spki_der),
callback_(callback) {}
callback_(std::move(callback)) {}
SetAttributeForKeyState::SetAttributeForKeyState(
ServiceWeakPtr weak_ptr,
......@@ -1418,13 +1421,12 @@ void GetAttributeForKeyWithDb(std::unique_ptr<GetAttributeForKeyState> state,
} // namespace
void PlatformKeysServiceImpl::GenerateRSAKey(
TokenId token_id,
unsigned int modulus_length_bits,
const GenerateKeyCallback& callback) {
void PlatformKeysServiceImpl::GenerateRSAKey(TokenId token_id,
unsigned int modulus_length_bits,
GenerateKeyCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<GenerateRSAKeyState>(
weak_factory_.GetWeakPtr(), modulus_length_bits, callback);
weak_factory_.GetWeakPtr(), modulus_length_bits, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1441,13 +1443,12 @@ void PlatformKeysServiceImpl::GenerateRSAKey(
delegate_.get(), state_ptr);
}
void PlatformKeysServiceImpl::GenerateECKey(
TokenId token_id,
const std::string& named_curve,
const GenerateKeyCallback& callback) {
void PlatformKeysServiceImpl::GenerateECKey(TokenId token_id,
const std::string& named_curve,
GenerateKeyCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<GenerateECKeyState>(weak_factory_.GetWeakPtr(),
named_curve, callback);
auto state = std::make_unique<GenerateECKeyState>(
weak_factory_.GetWeakPtr(), named_curve, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1464,12 +1465,12 @@ void PlatformKeysServiceImpl::SignRSAPKCS1Digest(
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) {
SignCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<SignState>(
weak_factory_.GetWeakPtr(), data, public_key_spki_der,
/*raw_pkcs1=*/false, hash_algorithm,
/*key_type=*/KeyType::kRsassaPkcs1V15, callback);
/*key_type=*/KeyType::kRsassaPkcs1V15, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1489,12 +1490,12 @@ void PlatformKeysServiceImpl::SignRSAPKCS1Raw(
base::Optional<TokenId> token_id,
const std::string& data,
const std::string& public_key_spki_der,
const SignCallback& callback) {
SignCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<SignState>(
weak_factory_.GetWeakPtr(), data, public_key_spki_der,
/*raw_pkcs1=*/true, HASH_ALGORITHM_NONE,
/*key_type=*/KeyType::kRsassaPkcs1V15, callback);
/*key_type=*/KeyType::kRsassaPkcs1V15, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1515,12 +1516,12 @@ void PlatformKeysServiceImpl::SignECDSADigest(
const std::string& data,
const std::string& public_key_spki_der,
HashAlgorithm hash_algorithm,
const SignCallback& callback) {
SignCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<SignState>(
weak_factory_.GetWeakPtr(), data, public_key_spki_der,
/*raw_pkcs1=*/false, hash_algorithm,
/*key_type=*/KeyType::kEcdsa, callback);
/*key_type=*/KeyType::kEcdsa, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1538,7 +1539,7 @@ void PlatformKeysServiceImpl::SignECDSADigest(
void PlatformKeysServiceImpl::SelectClientCertificates(
const std::vector<std::string>& certificate_authorities,
const SelectCertificatesCallback& callback) {
SelectCertificatesCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto cert_request_info = base::MakeRefCounted<net::SSLCertRequestInfo>();
......@@ -1550,7 +1551,7 @@ void PlatformKeysServiceImpl::SelectClientCertificates(
cert_request_info->cert_authorities = certificate_authorities;
auto state = std::make_unique<SelectCertificatesState>(
weak_factory_.GetWeakPtr(), cert_request_info, callback);
weak_factory_.GetWeakPtr(), cert_request_info, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1693,10 +1694,10 @@ bool GetPublicKeyBySpki(const std::string& spki,
void PlatformKeysServiceImpl::GetCertificates(
TokenId token_id,
const GetCertificatesCallback& callback) {
GetCertificatesCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<GetCertificatesState>(
weak_factory_.GetWeakPtr(), callback);
weak_factory_.GetWeakPtr(), std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1728,10 +1729,10 @@ void PlatformKeysServiceImpl::GetAllKeys(TokenId token_id,
void PlatformKeysServiceImpl::ImportCertificate(
TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const ImportCertificateCallback& callback) {
ImportCertificateCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<ImportCertificateState>(
weak_factory_.GetWeakPtr(), certificate, callback);
weak_factory_.GetWeakPtr(), certificate, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1750,10 +1751,10 @@ void PlatformKeysServiceImpl::ImportCertificate(
void PlatformKeysServiceImpl::RemoveCertificate(
TokenId token_id,
const scoped_refptr<net::X509Certificate>& certificate,
const RemoveCertificateCallback& callback) {
RemoveCertificateCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<RemoveCertificateState>(
weak_factory_.GetWeakPtr(), certificate, callback);
weak_factory_.GetWeakPtr(), certificate, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......@@ -1807,10 +1808,10 @@ void PlatformKeysServiceImpl::GetTokens(GetTokensCallback callback) {
void PlatformKeysServiceImpl::GetKeyLocations(
const std::string& public_key_spki_der,
const GetKeyLocationsCallback& callback) {
GetKeyLocationsCallback callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
auto state = std::make_unique<GetKeyLocationsState>(
weak_factory_.GetWeakPtr(), public_key_spki_der, callback);
weak_factory_.GetWeakPtr(), public_key_spki_der, std::move(callback));
if (delegate_->IsShutDown()) {
state->OnError(FROM_HERE, Status::kErrorShutDown);
return;
......
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