#ifndef CHROMEOS_COMPONENTS_CERTIFICATE_PROVIDER_CERTIFICATE_REQUESTS_H_
#define CHROMEOS_COMPONENTS_CERTIFICATE_PROVIDER_CERTIFICATE_REQUESTS_H_
#include <map>
#include <memory>
#include <string>
#include <vector>
#include "base/component_export.h"
#include "base/functional/callback_forward.h"
#include "net/ssl/client_cert_identity.h"
namespace chromeos {
namespace certificate_provider {
class COMPONENT_EXPORT(CERTIFICATE_PROVIDER) CertificateRequests {
public:
CertificateRequests();
CertificateRequests(const CertificateRequests&) = delete;
CertificateRequests& operator=(const CertificateRequests&) = delete;
~CertificateRequests();
int AddRequest(const std::vector<std::string>& extension_ids,
base::OnceCallback<void(net::ClientCertIdentityList)> callback,
base::OnceCallback<void(int)> timeout_callback);
bool SetExtensionReplyReceived(const std::string& extension_id,
int request_id,
bool* completed);
bool RemoveRequest(
int request_id,
base::OnceCallback<void(net::ClientCertIdentityList)>* callback);
std::vector<int> DropExtension(const std::string& extension_id);
private:
struct CertificateRequestState;
std::map<int, std::unique_ptr<CertificateRequestState>> requests_;
int next_free_request_id_ = 0;
};
}
}
#endif