Index: net/ssl/channel_id_service.cc |
diff --git a/net/ssl/server_bound_cert_service.cc b/net/ssl/channel_id_service.cc |
similarity index 74% |
rename from net/ssl/server_bound_cert_service.cc |
rename to net/ssl/channel_id_service.cc |
index b6b67c2fce73486be54e35207e0b984c7649e84c..f728a9e043e2d18f783744920f13c8c10eeb1050 100644 |
--- a/net/ssl/server_bound_cert_service.cc |
+++ b/net/ssl/channel_id_service.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/server_bound_cert_service.h" |
+#include "net/ssl/channel_id_service.h" |
#include <algorithm> |
#include <limits> |
@@ -41,8 +41,8 @@ const int kValidityPeriodInDays = 365; |
// while. |
const int kSystemTimeValidityBufferInDays = 90; |
-// Used by the GetDomainBoundCertResult histogram to record the final |
-// outcome of each GetDomainBoundCert or GetOrCreateDomainBoundCert call. |
+// Used by the GetChannelIDResult histogram to record the final |
wtc
2014/07/01 19:50:54
The histogram should NOT be renamed, right?
Ryan Hamilton
2014/07/21 19:12:10
Right. Fixed the comment to reflect that the histo
|
+// outcome of each GetChannelID or GetOrCreateDomainBoundCert call. |
wtc
2014/07/01 19:50:53
GetOrCreateDomainBoundCert => GetOrCreateChannelID
Ryan Hamilton
2014/07/21 19:12:10
Done.
|
// Do not re-use values. |
enum GetCertResult { |
wtc
2014/07/01 19:50:53
This enum type should be renamed "GetChannelIDResu
Ryan Hamilton
2014/07/21 19:12:10
Done.
|
// Synchronously found and returned an existing domain bound cert. |
@@ -57,7 +57,7 @@ enum GetCertResult { |
ASYNC_FAILURE_CREATE_CERT = 4, |
ASYNC_FAILURE_EXPORT_KEY = 5, |
ASYNC_FAILURE_UNKNOWN = 6, |
- // GetDomainBoundCert or GetOrCreateDomainBoundCert was called with |
+ // GetChannelID or GetOrCreateDomainBoundCert was called with |
// invalid arguments. |
INVALID_ARGUMENT = 7, |
// We don't support any of the cert types the server requested. |
@@ -69,7 +69,7 @@ enum GetCertResult { |
GET_CERT_RESULT_MAX |
wtc
2014/07/01 19:50:54
This should be renamed "GET_CHANNEL_ID_RESULT_MAX"
Ryan Hamilton
2014/07/21 19:12:09
Done.
|
}; |
-void RecordGetDomainBoundCertResult(GetCertResult result) { |
+void RecordGetChannelIDResult(GetCertResult result) { |
UMA_HISTOGRAM_ENUMERATION("DomainBoundCerts.GetDomainBoundCertResult", result, |
GET_CERT_RESULT_MAX); |
} |
@@ -82,15 +82,15 @@ void RecordGetCertTime(base::TimeDelta request_time) { |
50); |
} |
-// On success, returns a ServerBoundCert object and sets |*error| to OK. |
+// On success, returns a ChannelID object and sets |*error| to OK. |
// Otherwise, returns NULL, and |*error| will be set to a net error code. |
// |serial_number| is passed in because base::RandInt cannot be called from an |
// unjoined thread, due to relying on a non-leaked LazyInstance |
-scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert( |
+scoped_ptr<ChannelIDStore::ChannelID> GenerateCert( |
wtc
2014/07/01 19:50:53
This function probably should be renamed, but it s
Ryan Hamilton
2014/07/21 19:12:10
Done.
|
const std::string& server_identifier, |
uint32 serial_number, |
int* error) { |
- scoped_ptr<ServerBoundCertStore::ServerBoundCert> result; |
+ scoped_ptr<ChannelIDStore::ChannelID> result; |
base::TimeTicks start = base::TimeTicks::Now(); |
base::Time not_valid_before = base::Time::Now(); |
@@ -99,7 +99,7 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert( |
std::string der_cert; |
std::vector<uint8> private_key_info; |
scoped_ptr<crypto::ECPrivateKey> key; |
- if (!x509_util::CreateKeyAndDomainBoundCertEC(server_identifier, |
+ if (!x509_util::CreateKeyAndChannelIDEC(server_identifier, |
serial_number, |
not_valid_before, |
not_valid_after, |
@@ -110,7 +110,7 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert( |
return result.Pass(); |
} |
- if (!key->ExportEncryptedPrivateKey(ServerBoundCertService::kEPKIPassword, |
+ if (!key->ExportEncryptedPrivateKey(ChannelIDService::kEPKIPassword, |
1, &private_key_info)) { |
DLOG(ERROR) << "Unable to export private key"; |
*error = ERR_PRIVATE_KEY_EXPORT_FAILED; |
@@ -121,7 +121,7 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert( |
// std::string* to prevent this copying. |
std::string key_out(private_key_info.begin(), private_key_info.end()); |
- result.reset(new ServerBoundCertStore::ServerBoundCert( |
+ result.reset(new ChannelIDStore::ChannelID( |
server_identifier, |
not_valid_before, |
not_valid_after, |
@@ -139,12 +139,12 @@ scoped_ptr<ServerBoundCertStore::ServerBoundCert> GenerateCert( |
} // namespace |
// Represents the output and result callback of a request. |
-class ServerBoundCertServiceRequest { |
+class ChannelIDServiceRequest { |
public: |
- ServerBoundCertServiceRequest(base::TimeTicks request_start, |
- const CompletionCallback& callback, |
- std::string* private_key, |
- std::string* cert) |
+ ChannelIDServiceRequest(base::TimeTicks request_start, |
+ const CompletionCallback& callback, |
+ std::string* private_key, |
+ std::string* cert) |
: request_start_(request_start), |
callback_(callback), |
private_key_(private_key), |
@@ -153,7 +153,7 @@ class ServerBoundCertServiceRequest { |
// Ensures that the result callback will never be made. |
void Cancel() { |
- RecordGetDomainBoundCertResult(ASYNC_CANCELLED); |
+ RecordGetChannelIDResult(ASYNC_CANCELLED); |
callback_.Reset(); |
private_key_ = NULL; |
cert_ = NULL; |
@@ -173,23 +173,23 @@ class ServerBoundCertServiceRequest { |
base::TimeDelta::FromMinutes(5), |
50); |
RecordGetCertTime(request_time); |
- RecordGetDomainBoundCertResult(ASYNC_SUCCESS); |
+ RecordGetChannelIDResult(ASYNC_SUCCESS); |
break; |
} |
case ERR_KEY_GENERATION_FAILED: |
- RecordGetDomainBoundCertResult(ASYNC_FAILURE_KEYGEN); |
+ RecordGetChannelIDResult(ASYNC_FAILURE_KEYGEN); |
break; |
case ERR_ORIGIN_BOUND_CERT_GENERATION_FAILED: |
- RecordGetDomainBoundCertResult(ASYNC_FAILURE_CREATE_CERT); |
+ RecordGetChannelIDResult(ASYNC_FAILURE_CREATE_CERT); |
break; |
case ERR_PRIVATE_KEY_EXPORT_FAILED: |
- RecordGetDomainBoundCertResult(ASYNC_FAILURE_EXPORT_KEY); |
+ RecordGetChannelIDResult(ASYNC_FAILURE_EXPORT_KEY); |
break; |
case ERR_INSUFFICIENT_RESOURCES: |
- RecordGetDomainBoundCertResult(WORKER_FAILURE); |
+ RecordGetChannelIDResult(WORKER_FAILURE); |
break; |
default: |
- RecordGetDomainBoundCertResult(ASYNC_FAILURE_UNKNOWN); |
+ RecordGetChannelIDResult(ASYNC_FAILURE_UNKNOWN); |
break; |
} |
if (!callback_.is_null()) { |
@@ -209,17 +209,17 @@ class ServerBoundCertServiceRequest { |
std::string* cert_; |
}; |
-// ServerBoundCertServiceWorker runs on a worker thread and takes care of the |
+// ChannelIDServiceWorker runs on a worker thread and takes care of the |
// blocking process of performing key generation. Will take care of deleting |
// itself once Start() is called. |
-class ServerBoundCertServiceWorker { |
+class ChannelIDServiceWorker { |
public: |
typedef base::Callback<void( |
const std::string&, |
int, |
- scoped_ptr<ServerBoundCertStore::ServerBoundCert>)> WorkerDoneCallback; |
+ scoped_ptr<ChannelIDStore::ChannelID>)> WorkerDoneCallback; |
- ServerBoundCertServiceWorker( |
+ ChannelIDServiceWorker( |
const std::string& server_identifier, |
const WorkerDoneCallback& callback) |
: server_identifier_(server_identifier), |
@@ -236,14 +236,14 @@ class ServerBoundCertServiceWorker { |
return task_runner->PostTask( |
FROM_HERE, |
- base::Bind(&ServerBoundCertServiceWorker::Run, base::Owned(this))); |
+ base::Bind(&ChannelIDServiceWorker::Run, base::Owned(this))); |
} |
private: |
void Run() { |
// Runs on a worker thread. |
int error = ERR_FAILED; |
- scoped_ptr<ServerBoundCertStore::ServerBoundCert> cert = |
+ scoped_ptr<ChannelIDStore::ChannelID> cert = |
GenerateCert(server_identifier_, serial_number_, &error); |
DVLOG(1) << "GenerateCert " << server_identifier_ << " returned " << error; |
#if defined(USE_NSS) |
@@ -268,24 +268,24 @@ class ServerBoundCertServiceWorker { |
scoped_refptr<base::SequencedTaskRunner> origin_loop_; |
WorkerDoneCallback callback_; |
- DISALLOW_COPY_AND_ASSIGN(ServerBoundCertServiceWorker); |
+ DISALLOW_COPY_AND_ASSIGN(ChannelIDServiceWorker); |
}; |
-// A ServerBoundCertServiceJob is a one-to-one counterpart of an |
-// ServerBoundCertServiceWorker. It lives only on the ServerBoundCertService's |
+// A ChannelIDServiceJob is a one-to-one counterpart of an |
+// ChannelIDServiceWorker. It lives only on the ChannelIDService's |
// origin message loop. |
-class ServerBoundCertServiceJob { |
+class ChannelIDServiceJob { |
public: |
- ServerBoundCertServiceJob(bool create_if_missing) |
+ ChannelIDServiceJob(bool create_if_missing) |
: create_if_missing_(create_if_missing) { |
} |
- ~ServerBoundCertServiceJob() { |
+ ~ChannelIDServiceJob() { |
if (!requests_.empty()) |
DeleteAllCanceled(); |
} |
- void AddRequest(ServerBoundCertServiceRequest* request, |
+ void AddRequest(ChannelIDServiceRequest* request, |
bool create_if_missing = false) { |
create_if_missing_ |= create_if_missing; |
requests_.push_back(request); |
@@ -303,43 +303,43 @@ class ServerBoundCertServiceJob { |
void PostAll(int error, |
const std::string& private_key, |
const std::string& cert) { |
- std::vector<ServerBoundCertServiceRequest*> requests; |
+ std::vector<ChannelIDServiceRequest*> requests; |
requests_.swap(requests); |
- for (std::vector<ServerBoundCertServiceRequest*>::iterator |
+ for (std::vector<ChannelIDServiceRequest*>::iterator |
i = requests.begin(); i != requests.end(); i++) { |
(*i)->Post(error, private_key, cert); |
- // Post() causes the ServerBoundCertServiceRequest to delete itself. |
+ // Post() causes the ChannelIDServiceRequest to delete itself. |
} |
} |
void DeleteAllCanceled() { |
- for (std::vector<ServerBoundCertServiceRequest*>::iterator |
+ for (std::vector<ChannelIDServiceRequest*>::iterator |
i = requests_.begin(); i != requests_.end(); i++) { |
if ((*i)->canceled()) { |
delete *i; |
} else { |
- LOG(DFATAL) << "ServerBoundCertServiceRequest leaked!"; |
+ LOG(DFATAL) << "ChannelIDServiceRequest leaked!"; |
} |
} |
} |
- std::vector<ServerBoundCertServiceRequest*> requests_; |
+ std::vector<ChannelIDServiceRequest*> requests_; |
bool create_if_missing_; |
}; |
// static |
-const char ServerBoundCertService::kEPKIPassword[] = ""; |
+const char ChannelIDService::kEPKIPassword[] = ""; |
-ServerBoundCertService::RequestHandle::RequestHandle() |
+ChannelIDService::RequestHandle::RequestHandle() |
: service_(NULL), |
request_(NULL) {} |
-ServerBoundCertService::RequestHandle::~RequestHandle() { |
+ChannelIDService::RequestHandle::~RequestHandle() { |
Cancel(); |
} |
-void ServerBoundCertService::RequestHandle::Cancel() { |
+void ChannelIDService::RequestHandle::Cancel() { |
if (request_) { |
service_->CancelRequest(request_); |
request_ = NULL; |
@@ -347,9 +347,9 @@ void ServerBoundCertService::RequestHandle::Cancel() { |
} |
} |
-void ServerBoundCertService::RequestHandle::RequestStarted( |
- ServerBoundCertService* service, |
- ServerBoundCertServiceRequest* request, |
+void ChannelIDService::RequestHandle::RequestStarted( |
+ ChannelIDService* service, |
+ ChannelIDServiceRequest* request, |
const CompletionCallback& callback) { |
DCHECK(request_ == NULL); |
service_ = service; |
@@ -357,17 +357,17 @@ void ServerBoundCertService::RequestHandle::RequestStarted( |
callback_ = callback; |
} |
-void ServerBoundCertService::RequestHandle::OnRequestComplete(int result) { |
+void ChannelIDService::RequestHandle::OnRequestComplete(int result) { |
request_ = NULL; |
// Running the callback might delete |this|, so we can't touch any of our |
// members afterwards. Reset callback_ first. |
base::ResetAndReturn(&callback_).Run(result); |
} |
-ServerBoundCertService::ServerBoundCertService( |
- ServerBoundCertStore* server_bound_cert_store, |
+ChannelIDService::ChannelIDService( |
+ ChannelIDStore* channel_id_store, |
const scoped_refptr<base::TaskRunner>& task_runner) |
- : server_bound_cert_store_(server_bound_cert_store), |
+ : channel_id_store_(channel_id_store), |
task_runner_(task_runner), |
requests_(0), |
cert_store_hits_(0), |
@@ -380,12 +380,12 @@ ServerBoundCertService::ServerBoundCertService( |
is_system_time_valid_ = x509_util::IsSupportedValidityRange(start, end); |
} |
-ServerBoundCertService::~ServerBoundCertService() { |
+ChannelIDService::~ChannelIDService() { |
STLDeleteValues(&inflight_); |
} |
//static |
-std::string ServerBoundCertService::GetDomainForHost(const std::string& host) { |
+std::string ChannelIDService::GetDomainForHost(const std::string& host) { |
std::string domain = |
registry_controlled_domains::GetDomainAndRegistry( |
host, registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES); |
@@ -394,7 +394,7 @@ std::string ServerBoundCertService::GetDomainForHost(const std::string& host) { |
return domain; |
} |
-int ServerBoundCertService::GetOrCreateDomainBoundCert( |
+int ChannelIDService::GetOrCreateChannelID( |
const std::string& host, |
std::string* private_key, |
std::string* cert, |
@@ -405,13 +405,13 @@ int ServerBoundCertService::GetOrCreateDomainBoundCert( |
base::TimeTicks request_start = base::TimeTicks::Now(); |
if (callback.is_null() || !private_key || !cert || host.empty()) { |
- RecordGetDomainBoundCertResult(INVALID_ARGUMENT); |
+ RecordGetChannelIDResult(INVALID_ARGUMENT); |
return ERR_INVALID_ARGUMENT; |
} |
std::string domain = GetDomainForHost(host); |
if (domain.empty()) { |
- RecordGetDomainBoundCertResult(INVALID_ARGUMENT); |
+ RecordGetChannelIDResult(INVALID_ARGUMENT); |
return ERR_INVALID_ARGUMENT; |
} |
@@ -424,27 +424,27 @@ int ServerBoundCertService::GetOrCreateDomainBoundCert( |
return ERR_IO_PENDING; |
} |
- int err = LookupDomainBoundCert(request_start, domain, private_key, cert, |
+ int err = LookupChannelID(request_start, domain, private_key, cert, |
create_if_missing, callback, out_req); |
if (err == ERR_FILE_NOT_FOUND) { |
// Sync lookup did not find a valid cert. Start generating a new one. |
workers_created_++; |
- ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( |
+ ChannelIDServiceWorker* worker = new ChannelIDServiceWorker( |
domain, |
- base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, |
+ base::Bind(&ChannelIDService::GeneratedChannelID, |
weak_ptr_factory_.GetWeakPtr())); |
if (!worker->Start(task_runner_)) { |
// TODO(rkn): Log to the NetLog. |
- LOG(ERROR) << "ServerBoundCertServiceWorker couldn't be started."; |
- RecordGetDomainBoundCertResult(WORKER_FAILURE); |
+ LOG(ERROR) << "ChannelIDServiceWorker couldn't be started."; |
+ RecordGetChannelIDResult(WORKER_FAILURE); |
return ERR_INSUFFICIENT_RESOURCES; |
} |
// We are waiting for cert generation. Create a job & request to track it. |
- ServerBoundCertServiceJob* job = |
- new ServerBoundCertServiceJob(create_if_missing); |
+ ChannelIDServiceJob* job = |
+ new ChannelIDServiceJob(create_if_missing); |
wtc
2014/07/01 19:50:54
Nit: this should now fit on the previous line.
Al
Ryan Hamilton
2014/07/21 19:12:10
Done.
|
inflight_[domain] = job; |
- ServerBoundCertServiceRequest* request = new ServerBoundCertServiceRequest( |
+ ChannelIDServiceRequest* request = new ChannelIDServiceRequest( |
request_start, |
base::Bind(&RequestHandle::OnRequestComplete, |
base::Unretained(out_req)), |
@@ -458,7 +458,7 @@ int ServerBoundCertService::GetOrCreateDomainBoundCert( |
return err; |
} |
-int ServerBoundCertService::GetDomainBoundCert( |
+int ChannelIDService::GetChannelID( |
const std::string& host, |
std::string* private_key, |
std::string* cert, |
@@ -469,13 +469,13 @@ int ServerBoundCertService::GetDomainBoundCert( |
base::TimeTicks request_start = base::TimeTicks::Now(); |
if (callback.is_null() || !private_key || !cert || host.empty()) { |
- RecordGetDomainBoundCertResult(INVALID_ARGUMENT); |
+ RecordGetChannelIDResult(INVALID_ARGUMENT); |
return ERR_INVALID_ARGUMENT; |
} |
std::string domain = GetDomainForHost(host); |
if (domain.empty()) { |
- RecordGetDomainBoundCertResult(INVALID_ARGUMENT); |
+ RecordGetChannelIDResult(INVALID_ARGUMENT); |
return ERR_INVALID_ARGUMENT; |
} |
@@ -488,12 +488,12 @@ int ServerBoundCertService::GetDomainBoundCert( |
return ERR_IO_PENDING; |
} |
- int err = LookupDomainBoundCert(request_start, domain, private_key, cert, |
+ int err = LookupChannelID(request_start, domain, private_key, cert, |
create_if_missing, callback, out_req); |
wtc
2014/07/01 19:50:53
Fix the indentation.
Ryan Hamilton
2014/07/21 19:12:10
Done.
|
return err; |
} |
-void ServerBoundCertService::GotServerBoundCert( |
+void ChannelIDService::GotChannelID( |
int err, |
const std::string& server_identifier, |
base::Time expiration_time, |
@@ -501,7 +501,7 @@ void ServerBoundCertService::GotServerBoundCert( |
const std::string& cert) { |
DCHECK(CalledOnValidThread()); |
- std::map<std::string, ServerBoundCertServiceJob*>::iterator j; |
+ std::map<std::string, ChannelIDServiceJob*>::iterator j; |
j = inflight_.find(server_identifier); |
if (j == inflight_.end()) { |
NOTREACHED(); |
@@ -512,7 +512,7 @@ void ServerBoundCertService::GotServerBoundCert( |
// Async DB lookup found a valid cert. |
DVLOG(1) << "Cert store had valid cert for " << server_identifier; |
cert_store_hits_++; |
- // ServerBoundCertServiceRequest::Post will do the histograms and stuff. |
+ // ChannelIDServiceRequest::Post will do the histograms and stuff. |
HandleResult(OK, server_identifier, key, cert); |
return; |
} |
@@ -525,13 +525,13 @@ void ServerBoundCertService::GotServerBoundCert( |
} |
// At least one request asked to create a cert => start generating a new one. |
workers_created_++; |
- ServerBoundCertServiceWorker* worker = new ServerBoundCertServiceWorker( |
+ ChannelIDServiceWorker* worker = new ChannelIDServiceWorker( |
server_identifier, |
- base::Bind(&ServerBoundCertService::GeneratedServerBoundCert, |
+ base::Bind(&ChannelIDService::GeneratedChannelID, |
weak_ptr_factory_.GetWeakPtr())); |
if (!worker->Start(task_runner_)) { |
// TODO(rkn): Log to the NetLog. |
- LOG(ERROR) << "ServerBoundCertServiceWorker couldn't be started."; |
+ LOG(ERROR) << "ChannelIDServiceWorker couldn't be started."; |
HandleResult(ERR_INSUFFICIENT_RESOURCES, |
server_identifier, |
std::string(), |
@@ -539,25 +539,25 @@ void ServerBoundCertService::GotServerBoundCert( |
} |
} |
-ServerBoundCertStore* ServerBoundCertService::GetCertStore() { |
- return server_bound_cert_store_.get(); |
+ChannelIDStore* ChannelIDService::GetCertStore() { |
+ return channel_id_store_.get(); |
} |
-void ServerBoundCertService::CancelRequest(ServerBoundCertServiceRequest* req) { |
+void ChannelIDService::CancelRequest(ChannelIDServiceRequest* req) { |
DCHECK(CalledOnValidThread()); |
req->Cancel(); |
} |
-void ServerBoundCertService::GeneratedServerBoundCert( |
+void ChannelIDService::GeneratedChannelID( |
const std::string& server_identifier, |
int error, |
- scoped_ptr<ServerBoundCertStore::ServerBoundCert> cert) { |
+ scoped_ptr<ChannelIDStore::ChannelID> cert) { |
DCHECK(CalledOnValidThread()); |
if (error == OK) { |
// TODO(mattm): we should just Pass() the cert object to |
- // SetServerBoundCert(). |
- server_bound_cert_store_->SetServerBoundCert( |
+ // SetChannelID(). |
+ channel_id_store_->SetChannelID( |
cert->server_identifier(), |
cert->creation_time(), |
cert->expiration_time(), |
@@ -570,27 +570,27 @@ void ServerBoundCertService::GeneratedServerBoundCert( |
} |
} |
-void ServerBoundCertService::HandleResult( |
+void ChannelIDService::HandleResult( |
int error, |
const std::string& server_identifier, |
const std::string& private_key, |
const std::string& cert) { |
DCHECK(CalledOnValidThread()); |
- std::map<std::string, ServerBoundCertServiceJob*>::iterator j; |
+ std::map<std::string, ChannelIDServiceJob*>::iterator j; |
j = inflight_.find(server_identifier); |
if (j == inflight_.end()) { |
NOTREACHED(); |
return; |
} |
- ServerBoundCertServiceJob* job = j->second; |
+ ChannelIDServiceJob* job = j->second; |
inflight_.erase(j); |
job->HandleResult(error, private_key, cert); |
delete job; |
} |
-bool ServerBoundCertService::JoinToInFlightRequest( |
+bool ChannelIDService::JoinToInFlightRequest( |
const base::TimeTicks& request_start, |
const std::string& domain, |
std::string* private_key, |
@@ -598,8 +598,8 @@ bool ServerBoundCertService::JoinToInFlightRequest( |
bool create_if_missing, |
const CompletionCallback& callback, |
RequestHandle* out_req) { |
- ServerBoundCertServiceJob* job = NULL; |
- std::map<std::string, ServerBoundCertServiceJob*>::const_iterator j = |
+ ChannelIDServiceJob* job = NULL; |
+ std::map<std::string, ChannelIDServiceJob*>::const_iterator j = |
inflight_.find(domain); |
if (j != inflight_.end()) { |
// A request for the same domain is in flight already. We'll attach our |
@@ -607,7 +607,7 @@ bool ServerBoundCertService::JoinToInFlightRequest( |
job = j->second; |
inflight_joins_++; |
- ServerBoundCertServiceRequest* request = new ServerBoundCertServiceRequest( |
+ ChannelIDServiceRequest* request = new ChannelIDServiceRequest( |
request_start, |
base::Bind(&RequestHandle::OnRequestComplete, |
base::Unretained(out_req)), |
@@ -620,7 +620,7 @@ bool ServerBoundCertService::JoinToInFlightRequest( |
return false; |
} |
-int ServerBoundCertService::LookupDomainBoundCert( |
+int ChannelIDService::LookupChannelID( |
const base::TimeTicks& request_start, |
const std::string& domain, |
std::string* private_key, |
@@ -631,19 +631,19 @@ int ServerBoundCertService::LookupDomainBoundCert( |
// Check if a domain bound cert already exists for this domain. Note that |
// |expiration_time| is ignored, and expired certs are considered valid. |
base::Time expiration_time; |
- int err = server_bound_cert_store_->GetServerBoundCert( |
+ int err = channel_id_store_->GetChannelID( |
domain, |
&expiration_time /* ignored */, |
private_key, |
cert, |
- base::Bind(&ServerBoundCertService::GotServerBoundCert, |
+ base::Bind(&ChannelIDService::GotChannelID, |
weak_ptr_factory_.GetWeakPtr())); |
if (err == OK) { |
// Sync lookup found a valid cert. |
DVLOG(1) << "Cert store had valid cert for " << domain; |
cert_store_hits_++; |
- RecordGetDomainBoundCertResult(SYNC_SUCCESS); |
+ RecordGetChannelIDResult(SYNC_SUCCESS); |
base::TimeDelta request_time = base::TimeTicks::Now() - request_start; |
UMA_HISTOGRAM_TIMES("DomainBoundCerts.GetCertTimeSync", request_time); |
RecordGetCertTime(request_time); |
@@ -652,11 +652,11 @@ int ServerBoundCertService::LookupDomainBoundCert( |
if (err == ERR_IO_PENDING) { |
// We are waiting for async DB lookup. Create a job & request to track it. |
- ServerBoundCertServiceJob* job = |
- new ServerBoundCertServiceJob(create_if_missing); |
+ ChannelIDServiceJob* job = |
+ new ChannelIDServiceJob(create_if_missing); |
inflight_[domain] = job; |
- ServerBoundCertServiceRequest* request = new ServerBoundCertServiceRequest( |
+ ChannelIDServiceRequest* request = new ChannelIDServiceRequest( |
request_start, |
base::Bind(&RequestHandle::OnRequestComplete, |
base::Unretained(out_req)), |
@@ -670,8 +670,8 @@ int ServerBoundCertService::LookupDomainBoundCert( |
return err; |
} |
-int ServerBoundCertService::cert_count() { |
- return server_bound_cert_store_->GetCertCount(); |
+int ChannelIDService::cert_count() { |
+ return channel_id_store_->GetCertCount(); |
} |
} // namespace net |