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

Unified Diff: net/ssl/default_channel_id_store.cc

Issue 356713005: Rename ServerBoundCert => ChannelID to reflect the current name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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/ssl/default_channel_id_store.cc
diff --git a/net/ssl/default_server_bound_cert_store.cc b/net/ssl/default_channel_id_store.cc
similarity index 54%
rename from net/ssl/default_server_bound_cert_store.cc
rename to net/ssl/default_channel_id_store.cc
index 6fb9180e875fbee9c293bf48638bba3371094f05..05307cba93cde06ae7caf8c98cb6ac0d01a35766 100644
--- a/net/ssl/default_server_bound_cert_store.cc
+++ b/net/ssl/default_channel_id_store.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "net/ssl/default_server_bound_cert_store.h"
+#include "net/ssl/default_channel_id_store.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
@@ -13,58 +13,58 @@ namespace net {
// --------------------------------------------------------------------------
// Task
-class DefaultServerBoundCertStore::Task {
+class DefaultChannelIDStore::Task {
public:
virtual ~Task();
// Runs the task and invokes the client callback on the thread that
// originally constructed the task.
- virtual void Run(DefaultServerBoundCertStore* store) = 0;
+ virtual void Run(DefaultChannelIDStore* store) = 0;
protected:
void InvokeCallback(base::Closure callback) const;
};
-DefaultServerBoundCertStore::Task::~Task() {
+DefaultChannelIDStore::Task::~Task() {
}
-void DefaultServerBoundCertStore::Task::InvokeCallback(
+void DefaultChannelIDStore::Task::InvokeCallback(
base::Closure callback) const {
if (!callback.is_null())
callback.Run();
}
// --------------------------------------------------------------------------
-// GetServerBoundCertTask
-class DefaultServerBoundCertStore::GetServerBoundCertTask
- : public DefaultServerBoundCertStore::Task {
+// GetChannelIDTask
+class DefaultChannelIDStore::GetChannelIDTask
+ : public DefaultChannelIDStore::Task {
public:
- GetServerBoundCertTask(const std::string& server_identifier,
+ GetChannelIDTask(const std::string& server_identifier,
const GetCertCallback& callback);
wtc 2014/07/01 19:50:55 Fix the indentation.
Ryan Hamilton 2014/07/21 19:12:12 Done.
- virtual ~GetServerBoundCertTask();
- virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE;
+ virtual ~GetChannelIDTask();
+ virtual void Run(DefaultChannelIDStore* store) OVERRIDE;
private:
std::string server_identifier_;
GetCertCallback callback_;
};
-DefaultServerBoundCertStore::GetServerBoundCertTask::GetServerBoundCertTask(
+DefaultChannelIDStore::GetChannelIDTask::GetChannelIDTask(
const std::string& server_identifier,
const GetCertCallback& callback)
: server_identifier_(server_identifier),
callback_(callback) {
}
-DefaultServerBoundCertStore::GetServerBoundCertTask::~GetServerBoundCertTask() {
+DefaultChannelIDStore::GetChannelIDTask::~GetChannelIDTask() {
}
-void DefaultServerBoundCertStore::GetServerBoundCertTask::Run(
- DefaultServerBoundCertStore* store) {
+void DefaultChannelIDStore::GetChannelIDTask::Run(
+ DefaultChannelIDStore* store) {
base::Time expiration_time;
std::string private_key_result;
std::string cert_result;
- int err = store->GetServerBoundCert(
+ int err = store->GetChannelID(
server_identifier_, &expiration_time, &private_key_result,
&cert_result, GetCertCallback());
DCHECK(err != ERR_IO_PENDING);
@@ -74,17 +74,17 @@ void DefaultServerBoundCertStore::GetServerBoundCertTask::Run(
}
// --------------------------------------------------------------------------
-// SetServerBoundCertTask
-class DefaultServerBoundCertStore::SetServerBoundCertTask
- : public DefaultServerBoundCertStore::Task {
+// SetChannelIDTask
+class DefaultChannelIDStore::SetChannelIDTask
+ : public DefaultChannelIDStore::Task {
public:
- SetServerBoundCertTask(const std::string& server_identifier,
+ SetChannelIDTask(const std::string& server_identifier,
base::Time creation_time,
base::Time expiration_time,
const std::string& private_key,
const std::string& cert);
wtc 2014/07/01 19:50:55 Fix the indentation.
Ryan Hamilton 2014/07/21 19:12:12 Done.
- virtual ~SetServerBoundCertTask();
- virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE;
+ virtual ~SetChannelIDTask();
+ virtual void Run(DefaultChannelIDStore* store) OVERRIDE;
private:
std::string server_identifier_;
@@ -94,7 +94,7 @@ class DefaultServerBoundCertStore::SetServerBoundCertTask
std::string cert_;
};
-DefaultServerBoundCertStore::SetServerBoundCertTask::SetServerBoundCertTask(
+DefaultChannelIDStore::SetChannelIDTask::SetChannelIDTask(
const std::string& server_identifier,
base::Time creation_time,
base::Time expiration_time,
@@ -107,59 +107,59 @@ DefaultServerBoundCertStore::SetServerBoundCertTask::SetServerBoundCertTask(
cert_(cert) {
}
-DefaultServerBoundCertStore::SetServerBoundCertTask::~SetServerBoundCertTask() {
+DefaultChannelIDStore::SetChannelIDTask::~SetChannelIDTask() {
}
-void DefaultServerBoundCertStore::SetServerBoundCertTask::Run(
- DefaultServerBoundCertStore* store) {
- store->SyncSetServerBoundCert(server_identifier_, creation_time_,
+void DefaultChannelIDStore::SetChannelIDTask::Run(
+ DefaultChannelIDStore* store) {
+ store->SyncSetChannelID(server_identifier_, creation_time_,
expiration_time_, private_key_, cert_);
wtc 2014/07/01 19:50:55 Fix the indentation.
Ryan Hamilton 2014/07/21 19:12:12 Done.
}
// --------------------------------------------------------------------------
-// DeleteServerBoundCertTask
-class DefaultServerBoundCertStore::DeleteServerBoundCertTask
- : public DefaultServerBoundCertStore::Task {
+// DeleteChannelIDTask
+class DefaultChannelIDStore::DeleteChannelIDTask
+ : public DefaultChannelIDStore::Task {
public:
- DeleteServerBoundCertTask(const std::string& server_identifier,
+ DeleteChannelIDTask(const std::string& server_identifier,
const base::Closure& callback);
wtc 2014/07/01 19:50:55 Fix the indentation.
Ryan Hamilton 2014/07/21 19:12:11 Done.
- virtual ~DeleteServerBoundCertTask();
- virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE;
+ virtual ~DeleteChannelIDTask();
+ virtual void Run(DefaultChannelIDStore* store) OVERRIDE;
private:
std::string server_identifier_;
base::Closure callback_;
};
-DefaultServerBoundCertStore::DeleteServerBoundCertTask::
- DeleteServerBoundCertTask(
+DefaultChannelIDStore::DeleteChannelIDTask::
+ DeleteChannelIDTask(
const std::string& server_identifier,
const base::Closure& callback)
: server_identifier_(server_identifier),
callback_(callback) {
}
-DefaultServerBoundCertStore::DeleteServerBoundCertTask::
- ~DeleteServerBoundCertTask() {
+DefaultChannelIDStore::DeleteChannelIDTask::
+ ~DeleteChannelIDTask() {
}
-void DefaultServerBoundCertStore::DeleteServerBoundCertTask::Run(
- DefaultServerBoundCertStore* store) {
- store->SyncDeleteServerBoundCert(server_identifier_);
+void DefaultChannelIDStore::DeleteChannelIDTask::Run(
+ DefaultChannelIDStore* store) {
+ store->SyncDeleteChannelID(server_identifier_);
InvokeCallback(callback_);
}
// --------------------------------------------------------------------------
// DeleteAllCreatedBetweenTask
-class DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask
- : public DefaultServerBoundCertStore::Task {
+class DefaultChannelIDStore::DeleteAllCreatedBetweenTask
+ : public DefaultChannelIDStore::Task {
public:
DeleteAllCreatedBetweenTask(base::Time delete_begin,
base::Time delete_end,
const base::Closure& callback);
virtual ~DeleteAllCreatedBetweenTask();
- virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE;
+ virtual void Run(DefaultChannelIDStore* store) OVERRIDE;
private:
base::Time delete_begin_;
@@ -167,7 +167,7 @@ class DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask
base::Closure callback_;
};
-DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::
+DefaultChannelIDStore::DeleteAllCreatedBetweenTask::
DeleteAllCreatedBetweenTask(
base::Time delete_begin,
base::Time delete_end,
@@ -177,62 +177,62 @@ DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::
callback_(callback) {
}
-DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::
+DefaultChannelIDStore::DeleteAllCreatedBetweenTask::
~DeleteAllCreatedBetweenTask() {
}
-void DefaultServerBoundCertStore::DeleteAllCreatedBetweenTask::Run(
- DefaultServerBoundCertStore* store) {
+void DefaultChannelIDStore::DeleteAllCreatedBetweenTask::Run(
+ DefaultChannelIDStore* store) {
store->SyncDeleteAllCreatedBetween(delete_begin_, delete_end_);
InvokeCallback(callback_);
}
// --------------------------------------------------------------------------
-// GetAllServerBoundCertsTask
-class DefaultServerBoundCertStore::GetAllServerBoundCertsTask
- : public DefaultServerBoundCertStore::Task {
+// GetAllChannelIDsTask
+class DefaultChannelIDStore::GetAllChannelIDsTask
+ : public DefaultChannelIDStore::Task {
public:
- explicit GetAllServerBoundCertsTask(const GetCertListCallback& callback);
- virtual ~GetAllServerBoundCertsTask();
- virtual void Run(DefaultServerBoundCertStore* store) OVERRIDE;
+ explicit GetAllChannelIDsTask(const GetCertListCallback& callback);
+ virtual ~GetAllChannelIDsTask();
+ virtual void Run(DefaultChannelIDStore* store) OVERRIDE;
private:
std::string server_identifier_;
GetCertListCallback callback_;
};
-DefaultServerBoundCertStore::GetAllServerBoundCertsTask::
- GetAllServerBoundCertsTask(const GetCertListCallback& callback)
+DefaultChannelIDStore::GetAllChannelIDsTask::
+ GetAllChannelIDsTask(const GetCertListCallback& callback)
: callback_(callback) {
}
-DefaultServerBoundCertStore::GetAllServerBoundCertsTask::
- ~GetAllServerBoundCertsTask() {
+DefaultChannelIDStore::GetAllChannelIDsTask::
+ ~GetAllChannelIDsTask() {
}
-void DefaultServerBoundCertStore::GetAllServerBoundCertsTask::Run(
- DefaultServerBoundCertStore* store) {
- ServerBoundCertList cert_list;
- store->SyncGetAllServerBoundCerts(&cert_list);
+void DefaultChannelIDStore::GetAllChannelIDsTask::Run(
+ DefaultChannelIDStore* store) {
+ ChannelIDList cert_list;
+ store->SyncGetAllChannelIDs(&cert_list);
InvokeCallback(base::Bind(callback_, cert_list));
}
// --------------------------------------------------------------------------
-// DefaultServerBoundCertStore
+// DefaultChannelIDStore
// static
-const size_t DefaultServerBoundCertStore::kMaxCerts = 3300;
+const size_t DefaultChannelIDStore::kMaxCerts = 3300;
-DefaultServerBoundCertStore::DefaultServerBoundCertStore(
+DefaultChannelIDStore::DefaultChannelIDStore(
PersistentStore* store)
: initialized_(false),
loaded_(false),
store_(store),
weak_ptr_factory_(this) {}
-int DefaultServerBoundCertStore::GetServerBoundCert(
+int DefaultChannelIDStore::GetChannelID(
const std::string& server_identifier,
base::Time* expiration_time,
std::string* private_key_result,
@@ -243,16 +243,16 @@ int DefaultServerBoundCertStore::GetServerBoundCert(
if (!loaded_) {
EnqueueTask(scoped_ptr<Task>(
- new GetServerBoundCertTask(server_identifier, callback)));
+ new GetChannelIDTask(server_identifier, callback)));
return ERR_IO_PENDING;
}
- ServerBoundCertMap::iterator it = server_bound_certs_.find(server_identifier);
+ ChannelIDMap::iterator it = channel_ids_.find(server_identifier);
- if (it == server_bound_certs_.end())
+ if (it == channel_ids_.end())
return ERR_FILE_NOT_FOUND;
- ServerBoundCert* cert = it->second;
+ ChannelID* cert = it->second;
wtc 2014/07/01 19:50:55 cert => channel_id
Ryan Hamilton 2014/07/21 19:12:12 Done.
*expiration_time = cert->expiration_time();
*private_key_result = cert->private_key();
*cert_result = cert->cert();
@@ -260,25 +260,25 @@ int DefaultServerBoundCertStore::GetServerBoundCert(
return OK;
}
-void DefaultServerBoundCertStore::SetServerBoundCert(
+void DefaultChannelIDStore::SetChannelID(
const std::string& server_identifier,
base::Time creation_time,
base::Time expiration_time,
const std::string& private_key,
const std::string& cert) {
- RunOrEnqueueTask(scoped_ptr<Task>(new SetServerBoundCertTask(
+ RunOrEnqueueTask(scoped_ptr<Task>(new SetChannelIDTask(
server_identifier, creation_time, expiration_time, private_key,
cert)));
}
-void DefaultServerBoundCertStore::DeleteServerBoundCert(
+void DefaultChannelIDStore::DeleteChannelID(
const std::string& server_identifier,
const base::Closure& callback) {
RunOrEnqueueTask(scoped_ptr<Task>(
- new DeleteServerBoundCertTask(server_identifier, callback)));
+ new DeleteChannelIDTask(server_identifier, callback)));
}
-void DefaultServerBoundCertStore::DeleteAllCreatedBetween(
+void DefaultChannelIDStore::DeleteAllCreatedBetween(
base::Time delete_begin,
base::Time delete_end,
const base::Closure& callback) {
@@ -286,23 +286,23 @@ void DefaultServerBoundCertStore::DeleteAllCreatedBetween(
new DeleteAllCreatedBetweenTask(delete_begin, delete_end, callback)));
}
-void DefaultServerBoundCertStore::DeleteAll(
+void DefaultChannelIDStore::DeleteAll(
const base::Closure& callback) {
DeleteAllCreatedBetween(base::Time(), base::Time(), callback);
}
-void DefaultServerBoundCertStore::GetAllServerBoundCerts(
+void DefaultChannelIDStore::GetAllChannelIDs(
const GetCertListCallback& callback) {
- RunOrEnqueueTask(scoped_ptr<Task>(new GetAllServerBoundCertsTask(callback)));
+ RunOrEnqueueTask(scoped_ptr<Task>(new GetAllChannelIDsTask(callback)));
}
-int DefaultServerBoundCertStore::GetCertCount() {
+int DefaultChannelIDStore::GetCertCount() {
DCHECK(CalledOnValidThread());
- return server_bound_certs_.size();
+ return channel_ids_.size();
}
-void DefaultServerBoundCertStore::SetForceKeepSessionState() {
+void DefaultChannelIDStore::SetForceKeepSessionState() {
DCHECK(CalledOnValidThread());
InitIfNecessary();
@@ -310,38 +310,38 @@ void DefaultServerBoundCertStore::SetForceKeepSessionState() {
store_->SetForceKeepSessionState();
}
-DefaultServerBoundCertStore::~DefaultServerBoundCertStore() {
+DefaultChannelIDStore::~DefaultChannelIDStore() {
DeleteAllInMemory();
}
-void DefaultServerBoundCertStore::DeleteAllInMemory() {
+void DefaultChannelIDStore::DeleteAllInMemory() {
DCHECK(CalledOnValidThread());
- for (ServerBoundCertMap::iterator it = server_bound_certs_.begin();
- it != server_bound_certs_.end(); ++it) {
+ for (ChannelIDMap::iterator it = channel_ids_.begin();
+ it != channel_ids_.end(); ++it) {
delete it->second;
}
- server_bound_certs_.clear();
+ channel_ids_.clear();
}
-void DefaultServerBoundCertStore::InitStore() {
+void DefaultChannelIDStore::InitStore() {
DCHECK(CalledOnValidThread());
DCHECK(store_.get()) << "Store must exist to initialize";
DCHECK(!loaded_);
- store_->Load(base::Bind(&DefaultServerBoundCertStore::OnLoaded,
+ store_->Load(base::Bind(&DefaultChannelIDStore::OnLoaded,
weak_ptr_factory_.GetWeakPtr()));
}
-void DefaultServerBoundCertStore::OnLoaded(
- scoped_ptr<ScopedVector<ServerBoundCert> > certs) {
+void DefaultChannelIDStore::OnLoaded(
+ scoped_ptr<ScopedVector<ChannelID> > certs) {
wtc 2014/07/01 19:50:55 certs => channel_ids
Ryan Hamilton 2014/07/21 19:12:11 Done.
DCHECK(CalledOnValidThread());
- for (std::vector<ServerBoundCert*>::const_iterator it = certs->begin();
+ for (std::vector<ChannelID*>::const_iterator it = certs->begin();
it != certs->end(); ++it) {
- DCHECK(server_bound_certs_.find((*it)->server_identifier()) ==
- server_bound_certs_.end());
- server_bound_certs_[(*it)->server_identifier()] = *it;
+ DCHECK(channel_ids_.find((*it)->server_identifier()) ==
+ channel_ids_.end());
+ channel_ids_[(*it)->server_identifier()] = *it;
}
certs->weak_clear();
@@ -366,7 +366,7 @@ void DefaultServerBoundCertStore::OnLoaded(
waiting_tasks_.clear();
}
-void DefaultServerBoundCertStore::SyncSetServerBoundCert(
+void DefaultChannelIDStore::SyncSetChannelID(
const std::string& server_identifier,
base::Time creation_time,
base::Time expiration_time,
@@ -375,51 +375,51 @@ void DefaultServerBoundCertStore::SyncSetServerBoundCert(
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
- InternalDeleteServerBoundCert(server_identifier);
- InternalInsertServerBoundCert(
+ InternalDeleteChannelID(server_identifier);
+ InternalInsertChannelID(
server_identifier,
- new ServerBoundCert(
+ new ChannelID(
server_identifier, creation_time, expiration_time, private_key,
cert));
}
-void DefaultServerBoundCertStore::SyncDeleteServerBoundCert(
+void DefaultChannelIDStore::SyncDeleteChannelID(
const std::string& server_identifier) {
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
- InternalDeleteServerBoundCert(server_identifier);
+ InternalDeleteChannelID(server_identifier);
}
-void DefaultServerBoundCertStore::SyncDeleteAllCreatedBetween(
+void DefaultChannelIDStore::SyncDeleteAllCreatedBetween(
base::Time delete_begin,
base::Time delete_end) {
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
- for (ServerBoundCertMap::iterator it = server_bound_certs_.begin();
- it != server_bound_certs_.end();) {
- ServerBoundCertMap::iterator cur = it;
+ for (ChannelIDMap::iterator it = channel_ids_.begin();
+ it != channel_ids_.end();) {
+ ChannelIDMap::iterator cur = it;
++it;
- ServerBoundCert* cert = cur->second;
+ ChannelID* cert = cur->second;
wtc 2014/07/01 19:50:55 cert => channel_id
Ryan Hamilton 2014/07/21 19:12:11 Done.
if ((delete_begin.is_null() || cert->creation_time() >= delete_begin) &&
(delete_end.is_null() || cert->creation_time() < delete_end)) {
if (store_.get())
- store_->DeleteServerBoundCert(*cert);
+ store_->DeleteChannelID(*cert);
delete cert;
- server_bound_certs_.erase(cur);
+ channel_ids_.erase(cur);
}
}
}
-void DefaultServerBoundCertStore::SyncGetAllServerBoundCerts(
- ServerBoundCertList* cert_list) {
+void DefaultChannelIDStore::SyncGetAllChannelIDs(
+ ChannelIDList* cert_list) {
wtc 2014/07/01 19:50:55 cert_list => channel_id_list
Ryan Hamilton 2014/07/21 19:12:12 Done.
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
- for (ServerBoundCertMap::iterator it = server_bound_certs_.begin();
- it != server_bound_certs_.end(); ++it)
+ for (ChannelIDMap::iterator it = channel_ids_.begin();
+ it != channel_ids_.end(); ++it)
cert_list->push_back(*it->second);
}
-void DefaultServerBoundCertStore::EnqueueTask(scoped_ptr<Task> task) {
+void DefaultChannelIDStore::EnqueueTask(scoped_ptr<Task> task) {
DCHECK(CalledOnValidThread());
DCHECK(!loaded_);
if (waiting_tasks_.empty())
@@ -427,7 +427,7 @@ void DefaultServerBoundCertStore::EnqueueTask(scoped_ptr<Task> task) {
waiting_tasks_.push_back(task.release());
}
-void DefaultServerBoundCertStore::RunOrEnqueueTask(scoped_ptr<Task> task) {
+void DefaultChannelIDStore::RunOrEnqueueTask(scoped_ptr<Task> task) {
DCHECK(CalledOnValidThread());
InitIfNecessary();
@@ -439,35 +439,35 @@ void DefaultServerBoundCertStore::RunOrEnqueueTask(scoped_ptr<Task> task) {
task->Run(this);
}
-void DefaultServerBoundCertStore::InternalDeleteServerBoundCert(
+void DefaultChannelIDStore::InternalDeleteChannelID(
const std::string& server_identifier) {
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
- ServerBoundCertMap::iterator it = server_bound_certs_.find(server_identifier);
- if (it == server_bound_certs_.end())
+ ChannelIDMap::iterator it = channel_ids_.find(server_identifier);
+ if (it == channel_ids_.end())
return; // There is nothing to delete.
- ServerBoundCert* cert = it->second;
+ ChannelID* cert = it->second;
wtc 2014/07/01 19:50:55 cert => channel_id
Ryan Hamilton 2014/07/21 19:12:11 Done.
if (store_.get())
- store_->DeleteServerBoundCert(*cert);
- server_bound_certs_.erase(it);
+ store_->DeleteChannelID(*cert);
+ channel_ids_.erase(it);
delete cert;
}
-void DefaultServerBoundCertStore::InternalInsertServerBoundCert(
+void DefaultChannelIDStore::InternalInsertChannelID(
const std::string& server_identifier,
- ServerBoundCert* cert) {
+ ChannelID* cert) {
wtc 2014/07/01 19:50:55 cert => channel_id
Ryan Hamilton 2014/07/21 19:12:12 Done.
DCHECK(CalledOnValidThread());
DCHECK(loaded_);
if (store_.get())
- store_->AddServerBoundCert(*cert);
- server_bound_certs_[server_identifier] = cert;
+ store_->AddChannelID(*cert);
+ channel_ids_[server_identifier] = cert;
}
-DefaultServerBoundCertStore::PersistentStore::PersistentStore() {}
+DefaultChannelIDStore::PersistentStore::PersistentStore() {}
-DefaultServerBoundCertStore::PersistentStore::~PersistentStore() {}
+DefaultChannelIDStore::PersistentStore::~PersistentStore() {}
} // namespace net

Powered by Google App Engine
This is Rietveld 408576698