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 #include "chrome/browser/certificate_manager_model.h" | 5 #include "chrome/browser/certificate_manager_model.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/i18n/time_formatting.h" | 10 #include "base/i18n/time_formatting.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 extension_certificate_provider)), | 108 extension_certificate_provider)), |
109 weak_ptr_factory_(this) { | 109 weak_ptr_factory_(this) { |
110 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
111 } | 111 } |
112 | 112 |
113 CertificateManagerModel::~CertificateManagerModel() { | 113 CertificateManagerModel::~CertificateManagerModel() { |
114 } | 114 } |
115 | 115 |
116 void CertificateManagerModel::Refresh() { | 116 void CertificateManagerModel::Refresh() { |
117 DVLOG(1) << "refresh started"; | 117 DVLOG(1) << "refresh started"; |
118 net::CryptoModuleList modules; | 118 std::vector<crypto::ScopedPK11Slot> modules; |
119 cert_db_->ListModules(&modules, false); | 119 cert_db_->ListModules(&modules, false); |
120 DVLOG(1) << "refresh waiting for unlocking..."; | 120 DVLOG(1) << "refresh waiting for unlocking..."; |
121 chrome::UnlockSlotsIfNecessary( | 121 chrome::UnlockSlotsIfNecessary( |
122 modules, | 122 std::move(modules), chrome::kCryptoModulePasswordListCerts, |
123 chrome::kCryptoModulePasswordListCerts, | |
124 net::HostPortPair(), // unused. | 123 net::HostPortPair(), // unused. |
125 NULL, // TODO(mattm): supply parent window. | 124 NULL, // TODO(mattm): supply parent window. |
126 base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, | 125 base::Bind(&CertificateManagerModel::RefreshSlotsUnlocked, |
127 base::Unretained(this))); | 126 base::Unretained(this))); |
128 | 127 |
129 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
130 extension_certificate_provider_->GetCertificates(base::Bind( | 129 extension_certificate_provider_->GetCertificates(base::Bind( |
131 &CertificateManagerModel::RefreshExtensionCertificates, | 130 &CertificateManagerModel::RefreshExtensionCertificates, |
132 weak_ptr_factory_.GetWeakPtr())); | 131 weak_ptr_factory_.GetWeakPtr())); |
133 #endif | 132 #endif |
134 } | 133 } |
135 | 134 |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( | 328 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( |
330 context, did_get_cert_db_callback); | 329 context, did_get_cert_db_callback); |
331 | 330 |
332 // The callback is run here instead of the actual function call because of | 331 // The callback is run here instead of the actual function call because of |
333 // extension_certificate_provider ownership semantics, ie. ownership can only | 332 // extension_certificate_provider ownership semantics, ie. ownership can only |
334 // be released once. The callback will only be run once (either inside the | 333 // be released once. The callback will only be run once (either inside the |
335 // function above or here). | 334 // function above or here). |
336 if (cert_db) | 335 if (cert_db) |
337 did_get_cert_db_callback.Run(cert_db); | 336 did_get_cert_db_callback.Run(cert_db); |
338 } | 337 } |
OLD | NEW |