OLD | NEW |
---|---|
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 | |
19 // This class provides cross-platform functions to verify and add user | 21 // This class provides cross-platform functions to verify and add user |
20 // certificates, and to observe changes to the underlying certificate stores. | 22 // certificates, and to observe changes to the underlying certificate stores. |
21 | 23 |
22 // TODO(gauravsh): This class could be augmented with methods | 24 // TODO(gauravsh): This class could be augmented with methods |
23 // for all operations that manipulate the underlying system | 25 // for all operations that manipulate the underlying system |
24 // certificate store. | 26 // certificate store. |
25 | 27 |
26 class NET_EXPORT CertDatabase { | 28 class NET_EXPORT CertDatabase { |
27 public: | 29 public: |
28 // A CertDatabase::Observer will be notified on certificate database changes. | 30 // A CertDatabase::Observer will be notified on certificate database changes. |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
78 // which means that this must be called from a MessageLoop of TYPE_UI. | 80 // which means that this must be called from a MessageLoop of TYPE_UI. |
79 void SetMessageLoopForKeychainEvents(); | 81 void SetMessageLoopForKeychainEvents(); |
80 #endif | 82 #endif |
81 | 83 |
82 #if defined(OS_ANDROID) | 84 #if defined(OS_ANDROID) |
83 // On android, the system database is used. When the system notifies the | 85 // On android, the system database is used. When the system notifies the |
84 // application that the certificates changed, the observers must be notified. | 86 // application that the certificates changed, the observers must be notified. |
85 void OnAndroidKeyChainChanged(); | 87 void OnAndroidKeyChainChanged(); |
86 #endif | 88 #endif |
87 | 89 |
90 #if defined(USE_NSS) | |
91 // Observe events from the |source| and forward them to observers of this | |
92 // CertDatabase. | |
93 void ObserveNSSCertDatabase(NSSCertDatabase* source); | |
Ryan Sleevi
2013/12/18 21:28:32
Per our discussion, this is temporary, right?
If
mattm
2013/12/19 22:35:00
Hm, even after making CertDatabase a per-profile o
Ryan Sleevi
2013/12/20 01:35:19
Both CertDatabase and NSSCertDatabase are objects
| |
94 #endif | |
95 | |
88 private: | 96 private: |
89 friend struct DefaultSingletonTraits<CertDatabase>; | 97 friend struct DefaultSingletonTraits<CertDatabase>; |
90 | 98 |
91 CertDatabase(); | 99 CertDatabase(); |
92 ~CertDatabase(); | 100 ~CertDatabase(); |
93 | 101 |
94 // Broadcasts notifications to all registered observers. | 102 // Broadcasts notifications to all registered observers. |
95 void NotifyObserversOfCertAdded(const X509Certificate* cert); | 103 void NotifyObserversOfCertAdded(const X509Certificate* cert); |
96 void NotifyObserversOfCertRemoved(const X509Certificate* cert); | 104 void NotifyObserversOfCertRemoved(const X509Certificate* cert); |
97 void NotifyObserversOfCACertChanged(const X509Certificate* cert); | 105 void NotifyObserversOfCACertChanged(const X509Certificate* cert); |
98 | 106 |
99 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 107 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
100 | 108 |
101 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS)) | 109 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS)) |
102 class Notifier; | 110 class Notifier; |
103 friend class Notifier; | 111 friend class Notifier; |
104 scoped_ptr<Notifier> notifier_; | 112 scoped_ptr<Notifier> notifier_; |
105 #endif | 113 #endif |
106 | 114 |
107 DISALLOW_COPY_AND_ASSIGN(CertDatabase); | 115 DISALLOW_COPY_AND_ASSIGN(CertDatabase); |
108 }; | 116 }; |
109 | 117 |
110 } // namespace net | 118 } // namespace net |
111 | 119 |
112 #endif // NET_CERT_CERT_DATABASE_H_ | 120 #endif // NET_CERT_CERT_DATABASE_H_ |
OLD | NEW |