summaryrefslogtreecommitdiffstats
path: root/net/base/server_bound_cert_store.h
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 03:57:30 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-25 03:57:30 +0000
commit646a620d85405183eb7de2613ff3ed64223a8dc0 (patch)
tree5859a208f1ded78c16db6d824553aef2f60274ec /net/base/server_bound_cert_store.h
parente0f104c61c526fc9d0a09bc221ec393acabd3c8f (diff)
downloadchromium_src-646a620d85405183eb7de2613ff3ed64223a8dc0.zip
chromium_src-646a620d85405183eb7de2613ff3ed64223a8dc0.tar.gz
chromium_src-646a620d85405183eb7de2613ff3ed64223a8dc0.tar.bz2
Make ServerBoundCertStore interface async, move SQLiteServerBoundCertStore load onto DB thread.
Fix chromeos::ProfileAuthData::Transfer to only transfer server bound certs when cookies are being transferred. BUG=89665,166919 Review URL: https://chromiumcodereview.appspot.com/11742037 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@178742 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/server_bound_cert_store.h')
-rw-r--r--net/base/server_bound_cert_store.h45
1 files changed, 28 insertions, 17 deletions
diff --git a/net/base/server_bound_cert_store.h b/net/base/server_bound_cert_store.h
index 7a6f866..85e1035 100644
--- a/net/base/server_bound_cert_store.h
+++ b/net/base/server_bound_cert_store.h
@@ -8,6 +8,7 @@
#include <list>
#include <string>
+#include "base/callback.h"
#include "base/threading/non_thread_safe.h"
#include "base/time.h"
#include "net/base/net_export.h"
@@ -65,23 +66,29 @@ class NET_EXPORT ServerBoundCertStore
typedef std::list<ServerBoundCert> ServerBoundCertList;
+ typedef base::Callback<void(
+ const std::string&,
+ SSLClientCertType,
+ base::Time,
+ const std::string&,
+ const std::string&)> GetCertCallback;
+ typedef base::Callback<void(const ServerBoundCertList&)> GetCertListCallback;
+
virtual ~ServerBoundCertStore() {}
- // TODO(rkn): File I/O may be required, so this should have an asynchronous
- // interface.
- // Returns true on success. |private_key_result| stores a DER-encoded
- // PrivateKeyInfo struct, |cert_result| stores a DER-encoded certificate,
- // |type| is the ClientCertificateType of the returned certificate,
- // |creation_time| stores the start of the validity period of the certificate
- // and |expiration_time| is the expiration time of the certificate.
- // Returns false if no server bound cert exists for the specified server.
+ // GetServerBoundCert may return the result synchronously through the
+ // output parameters, in which case it will return true. Otherwise it will
+ // return false and the callback will be called with the result
+ // asynchronously.
+ // In either case, the type will be CLIENT_CERT_INVALID_TYPE if no cert
+ // existed for the given |server_identifier|.
virtual bool GetServerBoundCert(
const std::string& server_identifier,
SSLClientCertType* type,
- base::Time* creation_time,
base::Time* expiration_time,
std::string* private_key_result,
- std::string* cert_result) = 0;
+ std::string* cert_result,
+ const GetCertCallback& callback) = 0;
// Adds a server bound cert and the corresponding private key to the store.
virtual void SetServerBoundCert(
@@ -94,26 +101,30 @@ class NET_EXPORT ServerBoundCertStore
// Removes a server bound cert and the corresponding private key from the
// store.
- virtual void DeleteServerBoundCert(const std::string& server_identifier) = 0;
+ virtual void DeleteServerBoundCert(
+ const std::string& server_identifier,
+ const base::Closure& completion_callback) = 0;
// Deletes all of the server bound certs that have a creation_date greater
// than or equal to |delete_begin| and less than |delete_end|. If a
// base::Time value is_null, that side of the comparison is unbounded.
- virtual void DeleteAllCreatedBetween(base::Time delete_begin,
- base::Time delete_end) = 0;
+ virtual void DeleteAllCreatedBetween(
+ base::Time delete_begin,
+ base::Time delete_end,
+ const base::Closure& completion_callback) = 0;
// Removes all server bound certs and the corresponding private keys from
// the store.
- virtual void DeleteAll() = 0;
+ virtual void DeleteAll(const base::Closure& completion_callback) = 0;
// Returns all server bound certs and the corresponding private keys.
- virtual void GetAllServerBoundCerts(
- ServerBoundCertList* server_bound_certs) = 0;
+ virtual void GetAllServerBoundCerts(const GetCertListCallback& callback) = 0;
// Helper function that adds all certs from |list| into this instance.
void InitializeFrom(const ServerBoundCertList& list);
- // Returns the number of certs in the store.
+ // Returns the number of certs in the store. May return 0 if the backing
+ // store is not loaded yet.
// Public only for unit testing.
virtual int GetCertCount() = 0;