Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: net/base/default_origin_bound_cert_store.cc

Issue 7585037: Add functionality to OriginBoundCertStore interface and implementations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/default_origin_bound_cert_store.cc
===================================================================
--- net/base/default_origin_bound_cert_store.cc (revision 96316)
+++ net/base/default_origin_bound_cert_store.cc (working copy)
@@ -44,7 +44,7 @@
return true;
}
-bool DefaultOriginBoundCertStore::SetOriginBoundCert(
+void DefaultOriginBoundCertStore::SetOriginBoundCert(
const std::string& origin,
const std::string& private_key,
const std::string& cert) {
@@ -54,10 +54,46 @@
InternalDeleteOriginBoundCert(origin);
InternalInsertOriginBoundCert(origin,
new OriginBoundCert(origin, private_key, cert));
+}
- return true;
+void DefaultOriginBoundCertStore::DeleteOriginBoundCert(
+ const std::string& origin) {
+ base::AutoLock autolock(lock_);
+ InitIfNecessary();
+ InternalDeleteOriginBoundCert(origin);
}
+void DefaultOriginBoundCertStore::DeleteAll() {
+ base::AutoLock autolock(lock_);
+ InitIfNecessary();
+ for (OriginBoundCertMap::iterator it = origin_bound_certs_.begin();
+ it != origin_bound_certs_.end(); ++it) {
+ OriginBoundCert* cert = it->second;
+ if (store_)
+ store_->DeleteOriginBoundCert(*cert);
+ delete cert;
+ }
+ origin_bound_certs_.clear();
+}
+
+void DefaultOriginBoundCertStore::GetAllOriginBoundCerts(
+ std::vector<OriginBoundCertInfo>* origin_bound_certs) {
+ base::AutoLock autolock(lock_);
+ InitIfNecessary();
+ for (OriginBoundCertMap::iterator it = origin_bound_certs_.begin();
+ it != origin_bound_certs_.end(); ++it) {
+ OriginBoundCertInfo cert_info = {
+ it->second->origin(),
+ it->second->private_key(),
+ it->second->cert()
+ };
+ // TODO(rkn): Make changes so we can simply write
+ // origin_bound_certs->push_back(*it->second). This is probably best done
+ // by unnesting the OriginBoundCert class.
+ origin_bound_certs->push_back(cert_info);
+ }
+}
+
int DefaultOriginBoundCertStore::GetCertCount() {
base::AutoLock autolock(lock_);
InitIfNecessary();
@@ -66,14 +102,14 @@
}
DefaultOriginBoundCertStore::~DefaultOriginBoundCertStore() {
- DeleteAll();
+ DeleteAllInMemory();
}
-void DefaultOriginBoundCertStore::DeleteAll() {
+void DefaultOriginBoundCertStore::DeleteAllInMemory() {
base::AutoLock autolock(lock_);
for (OriginBoundCertMap::iterator it = origin_bound_certs_.begin();
- it != origin_bound_certs_.end(); it++) {
+ it != origin_bound_certs_.end(); ++it) {
delete it->second;
}
origin_bound_certs_.clear();

Powered by Google App Engine
This is Rietveld 408576698