summaryrefslogtreecommitdiffstats
path: root/chromeos/network/onc/onc_certificate_importer.h
diff options
context:
space:
mode:
authorpneubeck <pneubeck@chromium.org>2014-09-19 04:05:49 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-19 11:06:01 +0000
commit3b4ba221657f6b27e2156818bc445c885d87fc0e (patch)
tree82681a911c2a9a3692cfc3e51142e5e31b8842da /chromeos/network/onc/onc_certificate_importer.h
parentc6ccc77dc9c080d83e400dc12205bb805a25ac71 (diff)
downloadchromium_src-3b4ba221657f6b27e2156818bc445c885d87fc0e.zip
chromium_src-3b4ba221657f6b27e2156818bc445c885d87fc0e.tar.gz
chromium_src-3b4ba221657f6b27e2156818bc445c885d87fc0e.tar.bz2
Make ONCCertificateImporter async.
This prepares for the new CertDatabase keyed service, which will have stricter threading restrictions. https://codereview.chromium.org/419013003/ Before, ONCCertificateImporter accessed the NSSCertDatabase from the UI thread and blocked on certificate store operations. Now, the import itself is asychronous and calls back on completion. While there, this also removes the GMock of the importer. This is a reland of f08303014b165f6013fe33198cd798ebd9a4e925 refs/heads/master@{#295534} with the fixed destruction order in ONCCertificateImporterImplTest. The fix was reviewed in https://codereview.chromium.org/589443002/ TBR=eroman@chromium.org BUG=413219 Review URL: https://codereview.chromium.org/582413002 Cr-Commit-Position: refs/heads/master@{#295687}
Diffstat (limited to 'chromeos/network/onc/onc_certificate_importer.h')
-rw-r--r--chromeos/network/onc/onc_certificate_importer.h28
1 files changed, 17 insertions, 11 deletions
diff --git a/chromeos/network/onc/onc_certificate_importer.h b/chromeos/network/onc/onc_certificate_importer.h
index c691f74..5c2678d 100644
--- a/chromeos/network/onc/onc_certificate_importer.h
+++ b/chromeos/network/onc/onc_certificate_importer.h
@@ -6,6 +6,7 @@
#define CHROMEOS_NETWORK_ONC_ONC_CERTIFICATE_IMPORTER_H_
#include "base/basictypes.h"
+#include "base/callback_forward.h"
#include "chromeos/chromeos_export.h"
#include "components/onc/onc_constants.h"
#include "net/cert/x509_certificate.h"
@@ -19,20 +20,25 @@ namespace onc {
class CHROMEOS_EXPORT CertificateImporter {
public:
+ typedef base::Callback<
+ void(bool success, const net::CertificateList& onc_trusted_certificates)>
+ DoneCallback;
+
CertificateImporter() {}
virtual ~CertificateImporter() {}
- // Import the |certificates|, which must be a list of ONC Certificate objects.
- // Certificates are only imported with web trust for user imports. If
- // |onc_trusted_certificates| is not NULL, it will be filled with the list
- // of certificates that requested the TrustBit "Web". If the "Remove" field of
- // a certificate is enabled, then removes the certificate from the store
- // instead of importing. Returns true if all certificates were imported
- // successfully.
- virtual bool ImportCertificates(
- const base::ListValue& certificates,
- ::onc::ONCSource source,
- net::CertificateList* onc_trusted_certificates) = 0;
+ // Import |certificates|, which must be a list of ONC Certificate objects.
+ // Certificates are only imported with web trust for user imports. If the
+ // "Remove" field of a certificate is enabled, then removes the certificate
+ // from the store instead of importing.
+ // When the import is completed, |done_callback| will be called with |success|
+ // equal to true if all certificates were imported successfully.
+ // |onc_trusted_certificates| will contain the list of certificates that
+ // were imported and requested the TrustBit "Web".
+ // Never calls |done_callback| after this importer is destructed.
+ virtual void ImportCertificates(const base::ListValue& certificates,
+ ::onc::ONCSource source,
+ const DoneCallback& done_callback) = 0;
private:
DISALLOW_COPY_AND_ASSIGN(CertificateImporter);