Skip to content

Commit

Permalink
Rename ServerBoundCert => ChannelID to reflect the current name
Browse files Browse the repository at this point in the history
of this feature.

TBR=darin

Review URL: https://codereview.chromium.org/356713005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@285432 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
rch@chromium.org committed Jul 25, 2014
1 parent 1442d7f commit 6b8a3c7
Show file tree
Hide file tree
Showing 113 changed files with 2,827 additions and 2,825 deletions.
13 changes: 6 additions & 7 deletions android_webview/browser/net/aw_url_request_context_getter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "net/http/http_stream_factory.h"
#include "net/proxy/proxy_service.h"
#include "net/socket/next_proto.h"
#include "net/ssl/default_server_bound_cert_store.h"
#include "net/ssl/default_channel_id_store.h"
#include "net/url_request/data_protocol_handler.h"
#include "net/url_request/file_protocol_handler.h"
#include "net/url_request/url_request_context_builder.h"
Expand Down Expand Up @@ -85,7 +85,7 @@ void PopulateNetworkSessionParams(
net::HttpNetworkSession::Params* params) {
params->host_resolver = context->host_resolver();
params->cert_verifier = context->cert_verifier();
params->server_bound_cert_service = context->server_bound_cert_service();
params->channel_id_service = context->channel_id_service();
params->transport_security_state = context->transport_security_state();
params->proxy_service = context->proxy_service();
params->ssl_config_service = context->ssl_config_service();
Expand Down Expand Up @@ -199,12 +199,11 @@ void AwURLRequestContextGetter::InitializeURLRequestContext() {
ApplyCmdlineOverridesToURLRequestContextBuilder(&builder);

url_request_context_.reset(builder.Build());
server_bound_cert_service_.reset(
new net::ServerBoundCertService(
new net::DefaultServerBoundCertStore(NULL),
channel_id_service_.reset(
new net::ChannelIDService(
new net::DefaultChannelIDStore(NULL),
base::WorkerPool::GetTaskRunner(true)));
url_request_context_->set_server_bound_cert_service(
server_bound_cert_service_.get());
url_request_context_->set_channel_id_service(channel_id_service_.get());
// TODO(mnaganov): Fix URLRequestContextBuilder to use proper threads.
net::HttpNetworkSession::Params network_session_params;

Expand Down
4 changes: 2 additions & 2 deletions android_webview/browser/net/aw_url_request_context_getter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "content/public/browser/content_browser_client.h"
#include "net/http/http_network_session.h"
#include "net/ssl/server_bound_cert_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_job_factory.h"

Expand Down Expand Up @@ -69,7 +69,7 @@ class AwURLRequestContextGetter : public net::URLRequestContextGetter {
scoped_ptr<DataReductionProxyConfigService> proxy_config_service_;
scoped_ptr<net::URLRequestJobFactory> job_factory_;
scoped_ptr<net::HttpTransactionFactory> main_http_factory_;
scoped_ptr<net::ServerBoundCertService> server_bound_cert_service_;
scoped_ptr<net::ChannelIDService> channel_id_service_;

// ProtocolHandlers and interceptors are stored here between
// SetHandlersAndInterceptors() and the first GetURLRequestContext() call.
Expand Down
12 changes: 6 additions & 6 deletions chrome/app/generated_resources.grd
Original file line number Diff line number Diff line change
Expand Up @@ -10970,22 +10970,22 @@ Chrome ran out of memory.
<message name="IDS_COOKIES_LAST_ACCESSED_LABEL" desc="The last access date label">
Last accessed:
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERT" desc="The text shown when there is a channel id in the Cookies table">
<message name="IDS_COOKIES_CHANNEL_ID" desc="The text shown when there is a channel id in the Cookies table">
Channel ID
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERTS" desc="Label for the folder under which a list of TLS Channel IDs (name of an internet standard) are displayed">
<message name="IDS_COOKIES_CHANNEL_IDS" desc="Label for the folder under which a list of TLS Channel IDs (name of an internet standard) are displayed">
Channel IDs
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERT_ORIGIN_LABEL" desc="The channel id label for the server domain">
<message name="IDS_COOKIES_CHANNEL_ID_ORIGIN_LABEL" desc="The channel id label for the server domain">
Domain:
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERT_TYPE_LABEL" desc="The channel id Type label">
<message name="IDS_COOKIES_CHANNEL_ID_TYPE_LABEL" desc="The channel id Type label">
Certificate Type:
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERT_CREATED_LABEL" desc="The channel id Created label">
<message name="IDS_COOKIES_CHANNEL_ID_CREATED_LABEL" desc="The channel id Created label">
Created:
</message>
<message name="IDS_COOKIES_SERVER_BOUND_CERT_EXPIRES_LABEL" desc="The channel id Expires label">
<message name="IDS_COOKIES_CHANNEL_ID_EXPIRES_LABEL" desc="The channel id Expires label">
Expires:
</message>
<message name="IDS_CLIENT_CERT_RSA_SIGN" translateable="false" desc="">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "chrome/browser/browsing_data/browsing_data_server_bound_cert_helper.h"
#include "chrome/browser/browsing_data/browsing_data_channel_id_helper.h"

#include "base/bind.h"
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "chrome/browser/profiles/profile.h"
#include "content/public/browser/browser_thread.h"
#include "net/ssl/server_bound_cert_service.h"
#include "net/ssl/channel_id_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_getter.h"

namespace {

class BrowsingDataServerBoundCertHelperImpl
: public BrowsingDataServerBoundCertHelper {
class BrowsingDataChannelIDHelperImpl
: public BrowsingDataChannelIDHelper {
public:
explicit BrowsingDataServerBoundCertHelperImpl(Profile* profile);
explicit BrowsingDataChannelIDHelperImpl(Profile* profile);

// BrowsingDataServerBoundCertHelper methods.
// BrowsingDataChannelIDHelper methods.
virtual void StartFetching(const FetchResultCallback& callback) OVERRIDE;
virtual void DeleteServerBoundCert(const std::string& server_id) OVERRIDE;
virtual void DeleteChannelID(const std::string& server_id) OVERRIDE;

private:
virtual ~BrowsingDataServerBoundCertHelperImpl();
virtual ~BrowsingDataChannelIDHelperImpl();

// Fetch the certs. This must be called in the IO thread.
void FetchOnIOThread();

void OnFetchComplete(
const net::ServerBoundCertStore::ServerBoundCertList& cert_list);
const net::ChannelIDStore::ChannelIDList& channel_id_list);

// Notifies the completion callback. This must be called in the UI thread.
void NotifyInUIThread(
const net::ServerBoundCertStore::ServerBoundCertList& cert_list);
const net::ChannelIDStore::ChannelIDList& channel_id_list);

// Delete a single cert. This must be called in IO thread.
void DeleteOnIOThread(const std::string& server_id);
Expand All @@ -55,21 +55,21 @@ class BrowsingDataServerBoundCertHelperImpl
// This only mutates on the UI thread.
FetchResultCallback completion_callback_;

DISALLOW_COPY_AND_ASSIGN(BrowsingDataServerBoundCertHelperImpl);
DISALLOW_COPY_AND_ASSIGN(BrowsingDataChannelIDHelperImpl);
};

BrowsingDataServerBoundCertHelperImpl::
BrowsingDataServerBoundCertHelperImpl(Profile* profile)
BrowsingDataChannelIDHelperImpl::
BrowsingDataChannelIDHelperImpl(Profile* profile)
: is_fetching_(false),
request_context_getter_(profile->GetRequestContext()) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
}

BrowsingDataServerBoundCertHelperImpl::
~BrowsingDataServerBoundCertHelperImpl() {
BrowsingDataChannelIDHelperImpl::
~BrowsingDataChannelIDHelperImpl() {
}

void BrowsingDataServerBoundCertHelperImpl::StartFetching(
void BrowsingDataChannelIDHelperImpl::StartFetching(
const FetchResultCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(!is_fetching_);
Expand All @@ -79,65 +79,65 @@ void BrowsingDataServerBoundCertHelperImpl::StartFetching(
completion_callback_ = callback;
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&BrowsingDataServerBoundCertHelperImpl::FetchOnIOThread,
base::Bind(&BrowsingDataChannelIDHelperImpl::FetchOnIOThread,
this));
}

void BrowsingDataServerBoundCertHelperImpl::DeleteServerBoundCert(
void BrowsingDataChannelIDHelperImpl::DeleteChannelID(
const std::string& server_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
content::BrowserThread::PostTask(
content::BrowserThread::IO, FROM_HERE,
base::Bind(&BrowsingDataServerBoundCertHelperImpl::DeleteOnIOThread,
base::Bind(&BrowsingDataChannelIDHelperImpl::DeleteOnIOThread,
this, server_id));
}

void BrowsingDataServerBoundCertHelperImpl::FetchOnIOThread() {
void BrowsingDataChannelIDHelperImpl::FetchOnIOThread() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
net::ServerBoundCertStore* cert_store =
net::ChannelIDStore* cert_store =
request_context_getter_->GetURLRequestContext()->
server_bound_cert_service()->GetCertStore();
channel_id_service()->GetChannelIDStore();
if (cert_store) {
cert_store->GetAllServerBoundCerts(base::Bind(
&BrowsingDataServerBoundCertHelperImpl::OnFetchComplete, this));
cert_store->GetAllChannelIDs(base::Bind(
&BrowsingDataChannelIDHelperImpl::OnFetchComplete, this));
} else {
OnFetchComplete(net::ServerBoundCertStore::ServerBoundCertList());
OnFetchComplete(net::ChannelIDStore::ChannelIDList());
}
}

void BrowsingDataServerBoundCertHelperImpl::OnFetchComplete(
const net::ServerBoundCertStore::ServerBoundCertList& cert_list) {
void BrowsingDataChannelIDHelperImpl::OnFetchComplete(
const net::ChannelIDStore::ChannelIDList& channel_id_list) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
content::BrowserThread::PostTask(
content::BrowserThread::UI, FROM_HERE,
base::Bind(&BrowsingDataServerBoundCertHelperImpl::NotifyInUIThread,
this, cert_list));
base::Bind(&BrowsingDataChannelIDHelperImpl::NotifyInUIThread,
this, channel_id_list));
}

void BrowsingDataServerBoundCertHelperImpl::NotifyInUIThread(
const net::ServerBoundCertStore::ServerBoundCertList& cert_list) {
void BrowsingDataChannelIDHelperImpl::NotifyInUIThread(
const net::ChannelIDStore::ChannelIDList& channel_id_list) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
DCHECK(is_fetching_);
is_fetching_ = false;
completion_callback_.Run(cert_list);
completion_callback_.Run(channel_id_list);
completion_callback_.Reset();
}

void BrowsingDataServerBoundCertHelperImpl::DeleteOnIOThread(
void BrowsingDataChannelIDHelperImpl::DeleteOnIOThread(
const std::string& server_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
net::ServerBoundCertStore* cert_store =
net::ChannelIDStore* cert_store =
request_context_getter_->GetURLRequestContext()->
server_bound_cert_service()->GetCertStore();
channel_id_service()->GetChannelIDStore();
if (cert_store) {
cert_store->DeleteServerBoundCert(
cert_store->DeleteChannelID(
server_id,
base::Bind(&BrowsingDataServerBoundCertHelperImpl::DeleteCallback,
base::Bind(&BrowsingDataChannelIDHelperImpl::DeleteCallback,
this));
}
}

void BrowsingDataServerBoundCertHelperImpl::DeleteCallback() {
void BrowsingDataChannelIDHelperImpl::DeleteCallback() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
// Need to close open SSL connections which may be using the channel ids we
// are deleting.
Expand All @@ -150,48 +150,48 @@ void BrowsingDataServerBoundCertHelperImpl::DeleteCallback() {
} // namespace

// static
BrowsingDataServerBoundCertHelper*
BrowsingDataServerBoundCertHelper::Create(Profile* profile) {
return new BrowsingDataServerBoundCertHelperImpl(profile);
BrowsingDataChannelIDHelper*
BrowsingDataChannelIDHelper::Create(Profile* profile) {
return new BrowsingDataChannelIDHelperImpl(profile);
}

CannedBrowsingDataServerBoundCertHelper::
CannedBrowsingDataServerBoundCertHelper() {}
CannedBrowsingDataChannelIDHelper::
CannedBrowsingDataChannelIDHelper() {}

CannedBrowsingDataServerBoundCertHelper::
~CannedBrowsingDataServerBoundCertHelper() {}
CannedBrowsingDataChannelIDHelper::
~CannedBrowsingDataChannelIDHelper() {}

CannedBrowsingDataServerBoundCertHelper*
CannedBrowsingDataServerBoundCertHelper::Clone() {
CannedBrowsingDataChannelIDHelper*
CannedBrowsingDataChannelIDHelper::Clone() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
CannedBrowsingDataServerBoundCertHelper* clone =
new CannedBrowsingDataServerBoundCertHelper();
CannedBrowsingDataChannelIDHelper* clone =
new CannedBrowsingDataChannelIDHelper();

clone->server_bound_cert_map_ = server_bound_cert_map_;
clone->channel_id_map_ = channel_id_map_;
return clone;
}

void CannedBrowsingDataServerBoundCertHelper::AddServerBoundCert(
const net::ServerBoundCertStore::ServerBoundCert& server_bound_cert) {
void CannedBrowsingDataChannelIDHelper::AddChannelID(
const net::ChannelIDStore::ChannelID& channel_id) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
server_bound_cert_map_[server_bound_cert.server_identifier()] =
server_bound_cert;
channel_id_map_[channel_id.server_identifier()] =
channel_id;
}

void CannedBrowsingDataServerBoundCertHelper::Reset() {
server_bound_cert_map_.clear();
void CannedBrowsingDataChannelIDHelper::Reset() {
channel_id_map_.clear();
}

bool CannedBrowsingDataServerBoundCertHelper::empty() const {
return server_bound_cert_map_.empty();
bool CannedBrowsingDataChannelIDHelper::empty() const {
return channel_id_map_.empty();
}

size_t CannedBrowsingDataServerBoundCertHelper::GetCertCount() const {
size_t CannedBrowsingDataChannelIDHelper::GetChannelIDCount() const {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
return server_bound_cert_map_.size();
return channel_id_map_.size();
}

void CannedBrowsingDataServerBoundCertHelper::StartFetching(
void CannedBrowsingDataChannelIDHelper::StartFetching(
const FetchResultCallback& callback) {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
if (callback.is_null())
Expand All @@ -200,20 +200,20 @@ void CannedBrowsingDataServerBoundCertHelper::StartFetching(
completion_callback_ = callback;
base::MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&CannedBrowsingDataServerBoundCertHelper::FinishFetching,
base::Bind(&CannedBrowsingDataChannelIDHelper::FinishFetching,
this));
}

void CannedBrowsingDataServerBoundCertHelper::FinishFetching() {
void CannedBrowsingDataChannelIDHelper::FinishFetching() {
DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
net::ServerBoundCertStore::ServerBoundCertList cert_list;
for (ServerBoundCertMap::iterator i = server_bound_cert_map_.begin();
i != server_bound_cert_map_.end(); ++i)
cert_list.push_back(i->second);
completion_callback_.Run(cert_list);
net::ChannelIDStore::ChannelIDList channel_id_list;
for (ChannelIDMap::iterator i = channel_id_map_.begin();
i != channel_id_map_.end(); ++i)
channel_id_list.push_back(i->second);
completion_callback_.Run(channel_id_list);
}

void CannedBrowsingDataServerBoundCertHelper::DeleteServerBoundCert(
void CannedBrowsingDataChannelIDHelper::DeleteChannelID(
const std::string& server_id) {
NOTREACHED();
}
Loading

0 comments on commit 6b8a3c7

Please sign in to comment.