| 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 <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 // CertDatabase::AddObserver, and can un-register with | 36 // CertDatabase::AddObserver, and can un-register with |
| 37 // CertDatabase::RemoveObserver. | 37 // CertDatabase::RemoveObserver. |
| 38 class NET_EXPORT Observer { | 38 class NET_EXPORT Observer { |
| 39 public: | 39 public: |
| 40 virtual ~Observer() {} | 40 virtual ~Observer() {} |
| 41 | 41 |
| 42 // Called whenever the Cert Database is known to have changed. | 42 // Called whenever the Cert Database is known to have changed. |
| 43 // Typically, this will be in response to a CA certificate being added, | 43 // Typically, this will be in response to a CA certificate being added, |
| 44 // removed, or its trust changed, but may also signal on client | 44 // removed, or its trust changed, but may also signal on client |
| 45 // certificate events when they can be reliably detected. | 45 // certificate events when they can be reliably detected. |
| 46 virtual void OnCertDBChanged(const X509Certificate* cert) {} | 46 virtual void OnCertDBChanged() {} |
| 47 | 47 |
| 48 protected: | 48 protected: |
| 49 Observer() {} | 49 Observer() {} |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 DISALLOW_COPY_AND_ASSIGN(Observer); | 52 DISALLOW_COPY_AND_ASSIGN(Observer); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 // Returns the CertDatabase singleton. | 55 // Returns the CertDatabase singleton. |
| 56 static CertDatabase* GetInstance(); | 56 static CertDatabase* GetInstance(); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 79 void OnAndroidKeyStoreChanged(); | 79 void OnAndroidKeyStoreChanged(); |
| 80 | 80 |
| 81 // On Android, the system database is used. When the system notifies the | 81 // On Android, the system database is used. When the system notifies the |
| 82 // application that the certificates changed, the observers must be notified. | 82 // application that the certificates changed, the observers must be notified. |
| 83 void OnAndroidKeyChainChanged(); | 83 void OnAndroidKeyChainChanged(); |
| 84 #endif | 84 #endif |
| 85 | 85 |
| 86 // Synthetically injects notifications to all observers. In general, this | 86 // Synthetically injects notifications to all observers. In general, this |
| 87 // should only be called by the creator of the CertDatabase. Used to inject | 87 // should only be called by the creator of the CertDatabase. Used to inject |
| 88 // notifcations from other DB interfaces. | 88 // notifcations from other DB interfaces. |
| 89 void NotifyObserversCertDBChanged(const X509Certificate* cert); | 89 void NotifyObserversCertDBChanged(); |
| 90 | 90 |
| 91 private: | 91 private: |
| 92 friend struct base::DefaultSingletonTraits<CertDatabase>; | 92 friend struct base::DefaultSingletonTraits<CertDatabase>; |
| 93 | 93 |
| 94 CertDatabase(); | 94 CertDatabase(); |
| 95 ~CertDatabase(); | 95 ~CertDatabase(); |
| 96 | 96 |
| 97 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; | 97 const scoped_refptr<base::ObserverListThreadSafe<Observer>> observer_list_; |
| 98 | 98 |
| 99 #if defined(OS_MACOSX) && !defined(OS_IOS) | 99 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 100 class Notifier; | 100 class Notifier; |
| 101 friend class Notifier; | 101 friend class Notifier; |
| 102 std::unique_ptr<Notifier> notifier_; | 102 std::unique_ptr<Notifier> notifier_; |
| 103 #endif | 103 #endif |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(CertDatabase); | 105 DISALLOW_COPY_AND_ASSIGN(CertDatabase); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace net | 108 } // namespace net |
| 109 | 109 |
| 110 #endif // NET_CERT_CERT_DATABASE_H_ | 110 #endif // NET_CERT_CERT_DATABASE_H_ |
| OLD | NEW |