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

Unified Diff: chrome/browser/cert_store.h

Issue 6538100: Move core pieces of chrome\browser. I've only gone up to "g", will do the re... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: take out extra stuff from content_browser.gypi Created 9 years, 10 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
« no previous file with comments | « chrome/browser/cancelable_request.cc ('k') | chrome/browser/cert_store.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cert_store.h
===================================================================
--- chrome/browser/cert_store.h (revision 75626)
+++ chrome/browser/cert_store.h (working copy)
@@ -6,79 +6,7 @@
#define CHROME_BROWSER_CERT_STORE_H_
#pragma once
-#include <map>
+// TODO(jam): remove this file when all files have been converted.
+#include "content/browser/cert_store.h"
-#include "base/singleton.h"
-#include "base/synchronization/lock.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
-// X509Certificate objects. When stored, an X509Certificate object is
-// associated with a RenderProcessHost. If all the RenderProcessHosts
-// associated with the cert have exited, the cert is removed from the store.
-// This class is used by the SSLManager to keep track of the certs associated
-// to loaded resources.
-// It can be accessed from the UI and IO threads (it is thread-safe).
-// Note that the cert ids will overflow if we register more than 2^32 - 1 certs
-// in 1 browsing session (which is highly unlikely to happen).
-
-class CertStore : public NotificationObserver {
- public:
- // Returns the singleton instance of the CertStore.
- static CertStore* GetInstance();
-
- // Stores the specified cert and returns the id associated with it. The cert
- // is associated to the specified RenderProcessHost.
- // When all the RenderProcessHosts associated with a cert have exited, the
- // cert is removed from the store.
- // Note: ids starts at 1.
- int StoreCert(net::X509Certificate* cert, int render_process_host_id);
-
- // Tries to retrieve the previously stored cert associated with the specified
- // |cert_id|. Returns whether the cert could be found, and, if |cert| is
- // non-NULL, copies it in.
- bool RetrieveCert(int cert_id, scoped_refptr<net::X509Certificate>* cert);
-
- // NotificationObserver implementation.
- virtual void Observe(NotificationType type,
- const NotificationSource& source,
- const NotificationDetails& details);
-
- private:
- friend struct DefaultSingletonTraits<CertStore>;
-
- CertStore();
- ~CertStore();
-
- // Remove the specified cert from id_to_cert_ and cert_to_id_.
- // NOTE: the caller (RemoveCertsForRenderProcesHost) must hold cert_lock_.
- void RemoveCertInternal(int cert_id);
-
- // Removes all the certs associated with the specified process from the store.
- void RemoveCertsForRenderProcesHost(int render_process_host_id);
-
- typedef std::multimap<int, int> IDMap;
- typedef std::map<int, scoped_refptr<net::X509Certificate> > CertMap;
- typedef std::map<net::X509Certificate*, int, net::X509Certificate::LessThan>
- ReverseCertMap;
-
- NotificationRegistrar registrar_;
-
- IDMap process_id_to_cert_id_;
- IDMap cert_id_to_process_id_;
-
- CertMap id_to_cert_;
- ReverseCertMap cert_to_id_;
-
- int next_cert_id_;
-
- // This lock protects: process_to_ids_, id_to_processes_, id_to_cert_ and
- // cert_to_id_.
- base::Lock cert_lock_;
-
- DISALLOW_COPY_AND_ASSIGN(CertStore);
-};
-
#endif // CHROME_BROWSER_CERT_STORE_H_
« no previous file with comments | « chrome/browser/cancelable_request.cc ('k') | chrome/browser/cert_store.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698