| 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/stl_util.h" | 12 #include "base/stl_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
| 15 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" | |
| 16 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv
ice.h" | |
| 17 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv
ice_factory.h" | |
| 18 #include "chrome/browser/net/nss_context.h" | 15 #include "chrome/browser/net/nss_context.h" |
| 19 #include "chrome/browser/ui/crypto_module_password_dialog_nss.h" | 16 #include "chrome/browser/ui/crypto_module_password_dialog_nss.h" |
| 20 #include "chrome/common/net/x509_certificate_model.h" | 17 #include "chrome/common/net/x509_certificate_model.h" |
| 21 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 22 #include "content/public/browser/browser_context.h" | 19 #include "content/public/browser/browser_context.h" |
| 23 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 24 #include "content/public/browser/resource_context.h" | 21 #include "content/public/browser/resource_context.h" |
| 25 #include "crypto/nss_util.h" | 22 #include "crypto/nss_util.h" |
| 26 #include "net/base/net_errors.h" | 23 #include "net/base/net_errors.h" |
| 27 #include "net/cert/x509_certificate.h" | 24 #include "net/cert/x509_certificate.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 25 #include "ui/base/l10n/l10n_util.h" |
| 29 | 26 |
| 27 // TODO(wychen): ChromeOS headers should only be included when building |
| 28 // ChromeOS, and the following headers should be guarded by |
| 29 // #if defined(OS_CHROMEOS). However, the types are actually |
| 30 // used, and it takes another CL to clean them up. |
| 31 // Reference: crbug.com/720159 |
| 32 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" |
| 33 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv
ice.h" |
| 34 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv
ice_factory.h" |
| 35 |
| 30 using content::BrowserThread; | 36 using content::BrowserThread; |
| 31 | 37 |
| 32 // CertificateManagerModel is created on the UI thread. It needs a | 38 // CertificateManagerModel is created on the UI thread. It needs a |
| 33 // NSSCertDatabase handle (and on ChromeOS it needs to get the TPM status) which | 39 // NSSCertDatabase handle (and on ChromeOS it needs to get the TPM status) which |
| 34 // needs to be done on the IO thread. | 40 // needs to be done on the IO thread. |
| 35 // | 41 // |
| 36 // The initialization flow is roughly: | 42 // The initialization flow is roughly: |
| 37 // | 43 // |
| 38 // UI thread IO Thread | 44 // UI thread IO Thread |
| 39 // | 45 // |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( | 325 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( |
| 320 context, did_get_cert_db_callback); | 326 context, did_get_cert_db_callback); |
| 321 | 327 |
| 322 // The callback is run here instead of the actual function call because of | 328 // The callback is run here instead of the actual function call because of |
| 323 // extension_certificate_provider ownership semantics, ie. ownership can only | 329 // extension_certificate_provider ownership semantics, ie. ownership can only |
| 324 // be released once. The callback will only be run once (either inside the | 330 // be released once. The callback will only be run once (either inside the |
| 325 // function above or here). | 331 // function above or here). |
| 326 if (cert_db) | 332 if (cert_db) |
| 327 did_get_cert_db_callback.Run(cert_db); | 333 did_get_cert_db_callback.Run(cert_db); |
| 328 } | 334 } |
| OLD | NEW |