OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROMEOS_CERT_LOADER_H_ | 5 #ifndef CHROMEOS_CERT_LOADER_H_ |
6 #define CHROMEOS_CERT_LOADER_H_ | 6 #define CHROMEOS_CERT_LOADER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 // This will be empty until certificates_loaded() is true. | 86 // This will be empty until certificates_loaded() is true. |
87 const net::CertificateList& cert_list() const { return *cert_list_; } | 87 const net::CertificateList& cert_list() const { return *cert_list_; } |
88 | 88 |
89 // Called in tests if |IsCertificateHardwareBacked()| should always return | 89 // Called in tests if |IsCertificateHardwareBacked()| should always return |
90 // true. | 90 // true. |
91 static void ForceHardwareBackedForTesting(); | 91 static void ForceHardwareBackedForTesting(); |
92 | 92 |
93 private: | 93 private: |
94 CertLoader(); | 94 CertLoader(); |
95 virtual ~CertLoader(); | 95 ~CertLoader() override; |
96 | 96 |
97 // Trigger a certificate load. If a certificate loading task is already in | 97 // Trigger a certificate load. If a certificate loading task is already in |
98 // progress, will start a reload once the current task is finished. | 98 // progress, will start a reload once the current task is finished. |
99 void LoadCertificates(); | 99 void LoadCertificates(); |
100 | 100 |
101 // Called if a certificate load task is finished. | 101 // Called if a certificate load task is finished. |
102 void UpdateCertificates(scoped_ptr<net::CertificateList> cert_list); | 102 void UpdateCertificates(scoped_ptr<net::CertificateList> cert_list); |
103 | 103 |
104 void NotifyCertificatesLoaded(bool initial_load); | 104 void NotifyCertificatesLoaded(bool initial_load); |
105 | 105 |
106 // net::CertDatabase::Observer | 106 // net::CertDatabase::Observer |
107 virtual void OnCACertChanged(const net::X509Certificate* cert) override; | 107 void OnCACertChanged(const net::X509Certificate* cert) override; |
108 virtual void OnCertAdded(const net::X509Certificate* cert) override; | 108 void OnCertAdded(const net::X509Certificate* cert) override; |
109 virtual void OnCertRemoved(const net::X509Certificate* cert) override; | 109 void OnCertRemoved(const net::X509Certificate* cert) override; |
110 | 110 |
111 ObserverList<Observer> observers_; | 111 ObserverList<Observer> observers_; |
112 | 112 |
113 // Flags describing current CertLoader state. | 113 // Flags describing current CertLoader state. |
114 bool certificates_loaded_; | 114 bool certificates_loaded_; |
115 bool certificates_update_required_; | 115 bool certificates_update_required_; |
116 bool certificates_update_running_; | 116 bool certificates_update_running_; |
117 | 117 |
118 // The user-specific NSS certificate database from which the certificates | 118 // The user-specific NSS certificate database from which the certificates |
119 // should be loaded. | 119 // should be loaded. |
120 net::NSSCertDatabase* database_; | 120 net::NSSCertDatabase* database_; |
121 | 121 |
122 // Cached Certificates loaded from the database. | 122 // Cached Certificates loaded from the database. |
123 scoped_ptr<net::CertificateList> cert_list_; | 123 scoped_ptr<net::CertificateList> cert_list_; |
124 | 124 |
125 base::ThreadChecker thread_checker_; | 125 base::ThreadChecker thread_checker_; |
126 | 126 |
127 base::WeakPtrFactory<CertLoader> weak_factory_; | 127 base::WeakPtrFactory<CertLoader> weak_factory_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(CertLoader); | 129 DISALLOW_COPY_AND_ASSIGN(CertLoader); |
130 }; | 130 }; |
131 | 131 |
132 } // namespace chromeos | 132 } // namespace chromeos |
133 | 133 |
134 #endif // CHROMEOS_CERT_LOADER_H_ | 134 #endif // CHROMEOS_CERT_LOADER_H_ |
OLD | NEW |