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

Side by Side Diff: net/cert/cert_database.h

Issue 370633003: Break cyclic dependency between CertDatabase and NSSCertDatabase. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | net/cert/cert_database_nss.cc » ('j') | net/cert/nss_cert_database.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_CERT_CERT_DATABASE_H_ 5 #ifndef NET_CERT_CERT_DATABASE_H_
6 #define NET_CERT_CERT_DATABASE_H_ 6 #define NET_CERT_CERT_DATABASE_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/cert/x509_certificate.h" 12 #include "net/cert/x509_certificate.h"
13 13
14 template <typename T> struct DefaultSingletonTraits; 14 template <typename T> struct DefaultSingletonTraits;
15 template <class ObserverType> class ObserverListThreadSafe; 15 template <class ObserverType> class ObserverListThreadSafe;
16 16
17 namespace net { 17 namespace net {
18 18
19 class NSSCertDatabase;
20
21 // This class provides cross-platform functions to verify and add user 19 // This class provides cross-platform functions to verify and add user
22 // certificates, and to observe changes to the underlying certificate stores. 20 // certificates, and to observe changes to the underlying certificate stores.
23 21
24 // TODO(gauravsh): This class could be augmented with methods 22 // TODO(gauravsh): This class could be augmented with methods
25 // for all operations that manipulate the underlying system 23 // for all operations that manipulate the underlying system
26 // certificate store. 24 // certificate store.
27 25
28 class NET_EXPORT CertDatabase { 26 class NET_EXPORT CertDatabase {
29 public: 27 public:
30 // A CertDatabase::Observer will be notified on certificate database changes. 28 // A CertDatabase::Observer will be notified on certificate database changes.
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 // the KeyStore used for client certificates, notifies the observers as if a 85 // the KeyStore used for client certificates, notifies the observers as if a
88 // new client certificate was added. 86 // new client certificate was added.
89 void OnAndroidKeyStoreChanged(); 87 void OnAndroidKeyStoreChanged();
90 88
91 // On Android, the system database is used. When the system notifies the 89 // On Android, the system database is used. When the system notifies the
92 // application that the certificates changed, the observers must be notified. 90 // application that the certificates changed, the observers must be notified.
93 void OnAndroidKeyChainChanged(); 91 void OnAndroidKeyChainChanged();
94 #endif 92 #endif
95 93
96 #if defined(USE_NSS) 94 #if defined(USE_NSS)
97 // Observe events from the |source| and forward them to observers of this 95 // Returns an Observer which can be used to forward certificate events from
98 // CertDatabase. 96 // another certificate database (currently NSSCertDatabase) to this database.
99 void ObserveNSSCertDatabase(NSSCertDatabase* source); 97 // Any On* method call on the observer triggers the same event on all
98 // observers of this database. The Observer is owned by this database.
99 Observer* GetObserver();
100 #endif 100 #endif
101 101
102 private: 102 private:
103 friend struct DefaultSingletonTraits<CertDatabase>; 103 friend struct DefaultSingletonTraits<CertDatabase>;
104 104
105 CertDatabase(); 105 CertDatabase();
106 ~CertDatabase(); 106 ~CertDatabase();
107 107
108 // Broadcasts notifications to all registered observers. 108 // Broadcasts notifications to all registered observers.
109 void NotifyObserversOfCertAdded(const X509Certificate* cert); 109 void NotifyObserversOfCertAdded(const X509Certificate* cert);
110 void NotifyObserversOfCertRemoved(const X509Certificate* cert); 110 void NotifyObserversOfCertRemoved(const X509Certificate* cert);
111 void NotifyObserversOfCACertChanged(const X509Certificate* cert); 111 void NotifyObserversOfCACertChanged(const X509Certificate* cert);
112 112
113 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; 113 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_;
114 114
115 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS)) 115 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS))
116 class Notifier; 116 class Notifier;
117 friend class Notifier; 117 friend class Notifier;
118 scoped_ptr<Notifier> notifier_; 118 scoped_ptr<Notifier> notifier_;
119 #endif 119 #endif
120 120
121 DISALLOW_COPY_AND_ASSIGN(CertDatabase); 121 DISALLOW_COPY_AND_ASSIGN(CertDatabase);
122 }; 122 };
123 123
124 } // namespace net 124 } // namespace net
125 125
126 #endif // NET_CERT_CERT_DATABASE_H_ 126 #endif // NET_CERT_CERT_DATABASE_H_
OLDNEW
« no previous file with comments | « no previous file | net/cert/cert_database_nss.cc » ('j') | net/cert/nss_cert_database.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698