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" |
(...skipping 25 matching lines...) Expand all Loading... | |
36 | 36 |
37 // Will be called when a new certificate is added. | 37 // Will be called when a new certificate is added. |
38 virtual void OnCertAdded(const X509Certificate* cert) {} | 38 virtual void OnCertAdded(const X509Certificate* cert) {} |
39 | 39 |
40 // Will be called when a certificate is removed. | 40 // Will be called when a certificate is removed. |
41 virtual void OnCertRemoved(const X509Certificate* cert) {} | 41 virtual void OnCertRemoved(const X509Certificate* cert) {} |
42 | 42 |
43 // Will be called when a certificate's trust is changed. | 43 // Will be called when a certificate's trust is changed. |
44 virtual void OnCertTrustChanged(const X509Certificate* cert) {} | 44 virtual void OnCertTrustChanged(const X509Certificate* cert) {} |
45 | 45 |
46 // Will be called when the database changed in a non specific manner. | |
47 virtual void OnDatabaseUpdated() {} | |
wtc
2013/10/16 15:37:34
Nit: a non specific manner => an unspecified manne
wtc
2013/10/16 15:39:31
Please mention why this broad notification is nece
qsr
2013/10/16 16:02:09
Done.
| |
48 | |
46 protected: | 49 protected: |
47 Observer() {} | 50 Observer() {} |
48 | 51 |
49 private: | 52 private: |
50 DISALLOW_COPY_AND_ASSIGN(Observer); | 53 DISALLOW_COPY_AND_ASSIGN(Observer); |
51 }; | 54 }; |
52 | 55 |
53 // Returns the CertDatabase singleton. | 56 // Returns the CertDatabase singleton. |
54 static CertDatabase* GetInstance(); | 57 static CertDatabase* GetInstance(); |
55 | 58 |
(...skipping 15 matching lines...) Expand all Loading... | |
71 // on the same thread on which AddObserver() was called. | 74 // on the same thread on which AddObserver() was called. |
72 void RemoveObserver(Observer* observer); | 75 void RemoveObserver(Observer* observer); |
73 | 76 |
74 #if defined(OS_MACOSX) && !defined(OS_IOS) | 77 #if defined(OS_MACOSX) && !defined(OS_IOS) |
75 // Configures the current message loop to observe and forward events from | 78 // Configures the current message loop to observe and forward events from |
76 // Keychain services. The MessageLoop must have an associated CFRunLoop, | 79 // Keychain services. The MessageLoop must have an associated CFRunLoop, |
77 // 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. |
78 void SetMessageLoopForKeychainEvents(); | 81 void SetMessageLoopForKeychainEvents(); |
79 #endif | 82 #endif |
80 | 83 |
84 #if defined(OS_ANDROID) | |
85 // On android, the system database is used. When the system notifies the | |
86 // application that the certificates changed, the observers must be notified. | |
87 void NotifyObserversOfDatabaseUpdated(); | |
wtc
2013/10/16 15:37:34
Can this method be declared private, along with th
qsr
2013/10/16 16:02:09
Not really. It needs to be called externally by th
wtc
2013/10/16 18:33:24
Not when I asked you that question. As a code revi
| |
88 #endif | |
89 | |
81 private: | 90 private: |
82 friend struct DefaultSingletonTraits<CertDatabase>; | 91 friend struct DefaultSingletonTraits<CertDatabase>; |
83 | 92 |
84 CertDatabase(); | 93 CertDatabase(); |
85 ~CertDatabase(); | 94 ~CertDatabase(); |
86 | 95 |
87 // Broadcasts notifications to all registered observers. | 96 // Broadcasts notifications to all registered observers. |
88 void NotifyObserversOfCertAdded(const X509Certificate* cert); | 97 void NotifyObserversOfCertAdded(const X509Certificate* cert); |
89 void NotifyObserversOfCertRemoved(const X509Certificate* cert); | 98 void NotifyObserversOfCertRemoved(const X509Certificate* cert); |
90 void NotifyObserversOfCertTrustChanged(const X509Certificate* cert); | 99 void NotifyObserversOfCertTrustChanged(const X509Certificate* cert); |
91 | 100 |
92 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; | 101 const scoped_refptr<ObserverListThreadSafe<Observer> > observer_list_; |
93 | 102 |
94 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS)) | 103 #if defined(USE_NSS) || (defined(OS_MACOSX) && !defined(OS_IOS)) |
95 class Notifier; | 104 class Notifier; |
96 friend class Notifier; | 105 friend class Notifier; |
97 scoped_ptr<Notifier> notifier_; | 106 scoped_ptr<Notifier> notifier_; |
98 #endif | 107 #endif |
99 | 108 |
100 DISALLOW_COPY_AND_ASSIGN(CertDatabase); | 109 DISALLOW_COPY_AND_ASSIGN(CertDatabase); |
101 }; | 110 }; |
102 | 111 |
103 } // namespace net | 112 } // namespace net |
104 | 113 |
105 #endif // NET_CERT_CERT_DATABASE_H_ | 114 #endif // NET_CERT_CERT_DATABASE_H_ |
OLD | NEW |