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

Unified Diff: content/browser/ssl/ssl_host_state.cc

Issue 418133012: Add button to page info to revoke user certificate decisions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: 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) {

Powered by Google App Engine
This is Rietveld 408576698