| Index: content/browser/ssl/ssl_host_state.cc
|
| diff --git a/content/browser/ssl/ssl_host_state.cc b/content/browser/ssl/ssl_host_state.cc
|
| index 06c600205fa8b1277b5252e91cbbf56580320c21..df08289e29065d482e366d94ba95a0be88308e8a 100644
|
| --- a/content/browser/ssl/ssl_host_state.cc
|
| +++ b/content/browser/ssl/ssl_host_state.cc
|
| @@ -7,15 +7,32 @@
|
| #include "base/logging.h"
|
| #include "base/lazy_instance.h"
|
| #include "content/public/browser/browser_context.h"
|
| +#include "net/http/http_transaction_factory.h"
|
| +#include "net/url_request/url_request_context.h"
|
| +#include "net/url_request/url_request_context_getter.h"
|
|
|
| const char kKeyName[] = "content_ssl_host_state";
|
|
|
| +namespace {
|
| +
|
| +void CloseIdleConnections(
|
| + const std::string& host,
|
| + scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) {
|
| + url_request_context_getter->GetURLRequestContext()
|
| + ->http_transaction_factory()
|
| + ->GetSession()
|
| + ->CloseIdleConnections();
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| namespace content {
|
|
|
| SSLHostState* SSLHostState::GetFor(BrowserContext* context) {
|
| SSLHostState* rv = static_cast<SSLHostState*>(context->GetUserData(kKeyName));
|
| if (!rv) {
|
| rv = new SSLHostState();
|
| + rv->browser_context_ = context;
|
| context->SetUserData(kKeyName, rv);
|
| }
|
| return rv;
|
| @@ -60,6 +77,23 @@ void SSLHostState::Clear() {
|
| cert_policy_for_host_.clear();
|
| }
|
|
|
| +void SSLHostState::RevokeAllowAndDenyPreferences(const std::string& host) {
|
| + DCHECK(CalledOnValidThread());
|
| +
|
| + cert_policy_for_host_.erase(cert_policy_for_host_.find(host));
|
| + scoped_refptr<net::URLRequestContextGetter> getter(
|
| + browser_context_->GetRequestContext());
|
| + browser_context_->GetRequestContext()->GetNetworkTaskRunner()->PostTask(
|
| + FROM_HERE, base::Bind(&CloseIdleConnections, host, getter));
|
| +}
|
| +
|
| +bool SSLHostState::HasAllowedOrDeniedCert(const std::string& host) {
|
| + DCHECK(CalledOnValidThread());
|
| +
|
| + return cert_policy_for_host_[host].HasAllowedCert() ||
|
| + cert_policy_for_host_[host].HasDeniedCert();
|
| +}
|
| +
|
| net::CertPolicy::Judgment SSLHostState::QueryPolicy(net::X509Certificate* cert,
|
| const std::string& host,
|
| net::CertStatus error) {
|
|
|