diff options
Diffstat (limited to 'content/browser/ssl/ssl_host_state.cc')
-rw-r--r-- | content/browser/ssl/ssl_host_state.cc | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/content/browser/ssl/ssl_host_state.cc b/content/browser/ssl/ssl_host_state.cc index 67f3fd8..e0ceea4 100644 --- a/content/browser/ssl/ssl_host_state.cc +++ b/content/browser/ssl/ssl_host_state.cc @@ -6,25 +6,20 @@ #include "base/logging.h" #include "base/lazy_instance.h" -#include "content/public/browser/notification_details.h" -#include "content/public/browser/notification_source.h" -#include "content/public/browser/notification_types.h" +#include "content/public/browser/browser_context.h" -namespace { -typedef std::map<content::BrowserContext*, SSLHostState*> HostStateMap; -static base::LazyInstance<HostStateMap> g_host_state_map = - LAZY_INSTANCE_INITIALIZER; -} +static const char* kKeyName = "content_ssl_host_state"; -SSLHostState* SSLHostState::GetFor(content::BrowserContext* browser_context) { - if (!g_host_state_map.Get().count(browser_context)) - g_host_state_map.Get()[browser_context] = new SSLHostState(browser_context); - return g_host_state_map.Get()[browser_context]; +SSLHostState* SSLHostState::GetFor(content::BrowserContext* context) { + SSLHostState* rv = static_cast<SSLHostState*>(context->GetUserData(kKeyName)); + if (!rv) { + rv = new SSLHostState(); + context->SetUserData(kKeyName, rv); + } + return rv; } -SSLHostState::SSLHostState(content::BrowserContext* browser_context) { - registrar_.Add(this, content::NOTIFICATION_BROWSER_CONTEXT_DESTRUCTION, - content::Source<content::BrowserContext>(browser_context)); +SSLHostState::SSLHostState() { } SSLHostState::~SSLHostState() { @@ -61,9 +56,3 @@ net::CertPolicy::Judgment SSLHostState::QueryPolicy( return cert_policy_for_host_[host].Check(cert); } - -void SSLHostState::Observe(int type, - const content::NotificationSource& source, - const content::NotificationDetails& details) { - delete this; -} |