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 #include "chromeos/cert_loader.h" | 5 #include "chromeos/cert_loader.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/bind.h" | 10 #include "base/bind.h" |
10 #include "base/location.h" | 11 #include "base/location.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/task_runner_util.h" | 13 #include "base/task_runner_util.h" |
13 #include "base/threading/worker_pool.h" | 14 #include "base/threading/worker_pool.h" |
14 #include "crypto/nss_util.h" | 15 #include "crypto/nss_util.h" |
15 #include "crypto/scoped_nss_types.h" | 16 #include "crypto/scoped_nss_types.h" |
16 #include "net/cert/nss_cert_database.h" | 17 #include "net/cert/nss_cert_database.h" |
17 #include "net/cert/nss_cert_database_chromeos.h" | 18 #include "net/cert/nss_cert_database_chromeos.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 base::Bind(&CertLoader::UpdateCertificates, weak_factory_.GetWeakPtr())); | 151 base::Bind(&CertLoader::UpdateCertificates, weak_factory_.GetWeakPtr())); |
151 } | 152 } |
152 | 153 |
153 void CertLoader::UpdateCertificates( | 154 void CertLoader::UpdateCertificates( |
154 scoped_ptr<net::CertificateList> cert_list) { | 155 scoped_ptr<net::CertificateList> cert_list) { |
155 CHECK(thread_checker_.CalledOnValidThread()); | 156 CHECK(thread_checker_.CalledOnValidThread()); |
156 DCHECK(certificates_update_running_); | 157 DCHECK(certificates_update_running_); |
157 VLOG(1) << "UpdateCertificates: " << cert_list->size(); | 158 VLOG(1) << "UpdateCertificates: " << cert_list->size(); |
158 | 159 |
159 // Ignore any existing certificates. | 160 // Ignore any existing certificates. |
160 cert_list_ = cert_list.Pass(); | 161 cert_list_ = std::move(cert_list); |
161 | 162 |
162 bool initial_load = !certificates_loaded_; | 163 bool initial_load = !certificates_loaded_; |
163 certificates_loaded_ = true; | 164 certificates_loaded_ = true; |
164 NotifyCertificatesLoaded(initial_load); | 165 NotifyCertificatesLoaded(initial_load); |
165 | 166 |
166 certificates_update_running_ = false; | 167 certificates_update_running_ = false; |
167 if (certificates_update_required_) | 168 if (certificates_update_required_) |
168 LoadCertificates(); | 169 LoadCertificates(); |
169 } | 170 } |
170 | 171 |
(...skipping 13 matching lines...) Expand all Loading... |
184 VLOG(1) << "OnCertAdded"; | 185 VLOG(1) << "OnCertAdded"; |
185 LoadCertificates(); | 186 LoadCertificates(); |
186 } | 187 } |
187 | 188 |
188 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { | 189 void CertLoader::OnCertRemoved(const net::X509Certificate* cert) { |
189 VLOG(1) << "OnCertRemoved"; | 190 VLOG(1) << "OnCertRemoved"; |
190 LoadCertificates(); | 191 LoadCertificates(); |
191 } | 192 } |
192 | 193 |
193 } // namespace chromeos | 194 } // namespace chromeos |
OLD | NEW |