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

Unified Diff: net/base/x509_certificate.h

Issue 2815048: Minor clean-up tasks that were TODO(snej) (Closed)
Patch Set: Rebase on trunk prior to landing Created 10 years, 5 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 | « net/base/x509_cert_types.h ('k') | net/base/x509_certificate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/x509_certificate.h
diff --git a/net/base/x509_certificate.h b/net/base/x509_certificate.h
index b9621541396ef6b99f1c84b3772fbe8f19b89ab2..d6b3447d92867dfc7dd5a05cf262b7bbf8468663 100644
--- a/net/base/x509_certificate.h
+++ b/net/base/x509_certificate.h
@@ -7,13 +7,10 @@
#include <string.h>
-#include <map>
-#include <set>
#include <string>
#include <vector>
#include "base/ref_counted.h"
-#include "base/singleton.h"
#include "base/time.h"
#include "net/base/x509_cert_types.h"
#include "testing/gtest/include/gtest/gtest_prod.h"
@@ -54,13 +51,6 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
typedef std::vector<OSCertHandle> OSCertHandles;
- // Legacy names for types now defined in x509_cert_types.h.
- // TODO(snej): Clean up existing code using these names to use the new names.
- typedef CertPrincipal Principal;
- typedef CertPolicy Policy;
- typedef SHA1Fingerprint Fingerprint;
- typedef SHA1FingerprintLessThan FingerprintLessThan;
-
// Predicate functor used in maps when X509Certificate is used as the key.
class LessThan
: public std::binary_function<X509Certificate*, X509Certificate*, bool> {
@@ -120,10 +110,10 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
// The subject of the certificate. For HTTPS server certificates, this
// represents the web server. The common name of the subject should match
// the host name of the web server.
- const Principal& subject() const { return subject_; }
+ const CertPrincipal& subject() const { return subject_; }
// The issuer of the certificate.
- const Principal& issuer() const { return issuer_; }
+ const CertPrincipal& issuer() const { return issuer_; }
// Time period during which the certificate is valid. More precisely, this
// certificate is invalid before the |valid_start| date and invalid after
@@ -134,7 +124,7 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
const base::Time& valid_expiry() const { return valid_expiry_; }
// The fingerprint of this certificate.
- const Fingerprint& fingerprint() const { return fingerprint_; }
+ const SHA1Fingerprint& fingerprint() const { return fingerprint_; }
// Gets the DNS names in the certificate. Pursuant to RFC 2818, Section 3.1
// Server Identity, if the certificate has a subjectAltName extension of
@@ -224,31 +214,7 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
FRIEND_TEST(X509CertificateTest, Cache);
FRIEND_TEST(X509CertificateTest, IntermediateCertificates);
- // A cache of X509Certificate objects.
- class Cache {
- public:
- static Cache* GetInstance();
- void Insert(X509Certificate* cert);
- void Remove(X509Certificate* cert);
- X509Certificate* Find(const Fingerprint& fingerprint);
-
- private:
- typedef std::map<Fingerprint, X509Certificate*, FingerprintLessThan>
- CertMap;
-
- // Obtain an instance of X509Certificate::Cache via GetInstance().
- Cache() { }
- friend struct DefaultSingletonTraits<Cache>;
-
- // You must acquire this lock before using any private data of this object.
- // You must not block while holding this lock.
- Lock lock_;
-
- // The certificate cache. You must acquire |lock_| before using |cache_|.
- CertMap cache_;
-
- DISALLOW_COPY_AND_ASSIGN(Cache);
- };
+ class Cache;
// Construct an X509Certificate from a handle to the certificate object
// in the underlying crypto library.
@@ -264,13 +230,13 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
// Calculates the SHA-1 fingerprint of the certificate. Returns an empty
// (all zero) fingerprint on failure.
- static Fingerprint CalculateFingerprint(OSCertHandle cert_handle);
+ static SHA1Fingerprint CalculateFingerprint(OSCertHandle cert_handle);
// The subject of the certificate.
- Principal subject_;
+ CertPrincipal subject_;
// The issuer of the certificate.
- Principal issuer_;
+ CertPrincipal issuer_;
// This certificate is not valid before |valid_start_|
base::Time valid_start_;
@@ -279,7 +245,7 @@ class X509Certificate : public base::RefCountedThreadSafe<X509Certificate> {
base::Time valid_expiry_;
// The fingerprint of this certificate.
- Fingerprint fingerprint_;
+ SHA1Fingerprint fingerprint_;
// A handle to the certificate object in the underlying crypto library.
OSCertHandle cert_handle_;
« no previous file with comments | « net/base/x509_cert_types.h ('k') | net/base/x509_certificate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698