summaryrefslogtreecommitdiffstats
path: root/content/browser/ssl/ssl_host_state.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 22:07:34 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-15 22:07:34 +0000
commitea8e1813f4dec2371093983e7503aae2d591c1e4 (patch)
tree102acfab138debea374a8d0e850d872bf98adcef /content/browser/ssl/ssl_host_state.cc
parentea93125d7961a09ba90d44a9c3013483399a2051 (diff)
downloadchromium_src-ea8e1813f4dec2371093983e7503aae2d591c1e4.zip
chromium_src-ea8e1813f4dec2371093983e7503aae2d591c1e4.tar.gz
chromium_src-ea8e1813f4dec2371093983e7503aae2d591c1e4.tar.bz2
Add extra data to BrowserContext so that content layer and other embedders can stash data with it that has the same lifetime. Converted SSLHostState to use it for now. I'll do the rest in a followup.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/9348109 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122164 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/ssl/ssl_host_state.cc')
-rw-r--r--content/browser/ssl/ssl_host_state.cc31
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;
-}