diff options
Diffstat (limited to 'content/browser/ssl')
-rw-r--r-- | content/browser/ssl/ssl_host_state.cc | 8 | ||||
-rw-r--r-- | content/browser/ssl/ssl_host_state.h | 5 | ||||
-rw-r--r-- | content/browser/ssl/ssl_host_state_unittest.cc | 12 |
3 files changed, 22 insertions, 3 deletions
diff --git a/content/browser/ssl/ssl_host_state.cc b/content/browser/ssl/ssl_host_state.cc index e0ceea4..c47171f 100644 --- a/content/browser/ssl/ssl_host_state.cc +++ b/content/browser/ssl/ssl_host_state.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -50,6 +50,12 @@ void SSLHostState::AllowCertForHost(net::X509Certificate* cert, cert_policy_for_host_[host].Allow(cert); } +void SSLHostState::Clear() { + DCHECK(CalledOnValidThread()); + + cert_policy_for_host_.clear(); +} + net::CertPolicy::Judgment SSLHostState::QueryPolicy( net::X509Certificate* cert, const std::string& host) { DCHECK(CalledOnValidThread()); diff --git a/content/browser/ssl/ssl_host_state.h b/content/browser/ssl/ssl_host_state.h index b051b05..5cb1200 100644 --- a/content/browser/ssl/ssl_host_state.h +++ b/content/browser/ssl/ssl_host_state.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -51,6 +51,9 @@ class CONTENT_EXPORT SSLHostState // Records that |cert| is not permitted to be used for |host| in the future. void AllowCertForHost(net::X509Certificate* cert, const std::string& host); + // Clear all allow/deny preferences. + void Clear(); + // Queries whether |cert| is allowed or denied for |host|. net::CertPolicy::Judgment QueryPolicy( net::X509Certificate* cert, const std::string& host); diff --git a/content/browser/ssl/ssl_host_state_unittest.cc b/content/browser/ssl/ssl_host_state_unittest.cc index 08a589f..15743f1 100644 --- a/content/browser/ssl/ssl_host_state_unittest.cc +++ b/content/browser/ssl/ssl_host_state_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 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. @@ -151,4 +151,14 @@ TEST_F(SSLHostStateTest, QueryPolicy) { net::CertPolicy::UNKNOWN); EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), net::CertPolicy::DENIED); + + state.Clear(); + + EXPECT_EQ(state.QueryPolicy(google_cert.get(), "www.google.com"), + net::CertPolicy::UNKNOWN); + EXPECT_EQ(state.QueryPolicy(google_cert.get(), "google.com"), + net::CertPolicy::UNKNOWN); + EXPECT_EQ(state.QueryPolicy(google_cert.get(), "example.com"), + net::CertPolicy::UNKNOWN); + } |