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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/i18n/time_formatting.h" | 8 #include "base/i18n/time_formatting.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 const std::string& data, | 159 const std::string& data, |
160 const base::string16& password, | 160 const base::string16& password, |
161 bool is_extractable) { | 161 bool is_extractable) { |
162 int result = cert_db_->ImportFromPKCS12(module, data, password, | 162 int result = cert_db_->ImportFromPKCS12(module, data, password, |
163 is_extractable, NULL); | 163 is_extractable, NULL); |
164 if (result == net::OK) | 164 if (result == net::OK) |
165 Refresh(); | 165 Refresh(); |
166 return result; | 166 return result; |
167 } | 167 } |
168 | 168 |
| 169 int CertificateManagerModel::ImportUserCert(const std::string& data) { |
| 170 int result = cert_db_->ImportUserCert(data); |
| 171 if (result == net::OK) |
| 172 Refresh(); |
| 173 return result; |
| 174 } |
| 175 |
169 bool CertificateManagerModel::ImportCACerts( | 176 bool CertificateManagerModel::ImportCACerts( |
170 const net::CertificateList& certificates, | 177 const net::CertificateList& certificates, |
171 net::NSSCertDatabase::TrustBits trust_bits, | 178 net::NSSCertDatabase::TrustBits trust_bits, |
172 net::NSSCertDatabase::ImportCertFailureList* not_imported) { | 179 net::NSSCertDatabase::ImportCertFailureList* not_imported) { |
173 bool result = cert_db_->ImportCACerts(certificates, trust_bits, not_imported); | 180 bool result = cert_db_->ImportCACerts(certificates, trust_bits, not_imported); |
174 if (result && not_imported->size() != certificates.size()) | 181 if (result && not_imported->size() != certificates.size()) |
175 Refresh(); | 182 Refresh(); |
176 return result; | 183 return result; |
177 } | 184 } |
178 | 185 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 const CreationCallback& callback) { | 257 const CreationCallback& callback) { |
251 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 258 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
252 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( | 259 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( |
253 context, | 260 context, |
254 base::Bind(&CertificateManagerModel::DidGetCertDBOnIOThread, | 261 base::Bind(&CertificateManagerModel::DidGetCertDBOnIOThread, |
255 observer, | 262 observer, |
256 callback)); | 263 callback)); |
257 if (cert_db) | 264 if (cert_db) |
258 DidGetCertDBOnIOThread(observer, callback, cert_db); | 265 DidGetCertDBOnIOThread(observer, callback, cert_db); |
259 } | 266 } |
OLD | NEW |