summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 03:18:21 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-05-22 03:18:21 +0000
commit4517eb4e75100a8f7ebeae008c7542641ad7bcad (patch)
tree96ef1d5c6d2adacc218eb1cb3d57ee9d896bfdfb
parenteca71dae5d36be62bcf8bc12b1238e29c4099e55 (diff)
downloadchromium_src-4517eb4e75100a8f7ebeae008c7542641ad7bcad.zip
chromium_src-4517eb4e75100a8f7ebeae008c7542641ad7bcad.tar.gz
chromium_src-4517eb4e75100a8f7ebeae008c7542641ad7bcad.tar.bz2
Use a NotificationRegistrar to listen for notifications.
BUG=2381 Review URL: http://codereview.chromium.org/112051 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@16714 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/cert_store.cc12
-rw-r--r--chrome/browser/cert_store.h4
2 files changed, 7 insertions, 9 deletions
diff --git a/chrome/browser/cert_store.cc b/chrome/browser/cert_store.cc
index 09e71b8..adc7ff1 100644
--- a/chrome/browser/cert_store.cc
+++ b/chrome/browser/cert_store.cc
@@ -36,14 +36,10 @@ CertStore::CertStore() : next_cert_id_(1) {
// removed from cache, and remove the cert when we know it
// is not used anymore.
- // TODO(tc): This notification observer never gets removed because the
- // CertStore is never deleted.
- NotificationService::current()->AddObserver(this,
- NotificationType::RENDERER_PROCESS_TERMINATED,
- NotificationService::AllSources());
- NotificationService::current()->AddObserver(this,
- NotificationType::RENDERER_PROCESS_CLOSED,
- NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_TERMINATED,
+ NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::RENDERER_PROCESS_CLOSED,
+ NotificationService::AllSources());
}
CertStore::~CertStore() {
diff --git a/chrome/browser/cert_store.h b/chrome/browser/cert_store.h
index 6638a94..7ef3b3e 100644
--- a/chrome/browser/cert_store.h
+++ b/chrome/browser/cert_store.h
@@ -10,7 +10,7 @@
#include "base/lock.h"
#include "base/singleton.h"
-#include "chrome/common/notification_observer.h"
+#include "chrome/common/notification_registrar.h"
#include "net/base/x509_certificate.h"
// The purpose of the cert store is to provide an easy way to store/retrieve
@@ -63,6 +63,8 @@ class CertStore : public NotificationObserver {
typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan>
ReverseCertMap;
+ NotificationRegistrar registrar_;
+
IDMap process_id_to_cert_id_;
IDMap cert_id_to_process_id_;