Chromium Code Reviews| 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: should be guarded by #if defined(OS_CHROMEOS) | |
|
Nico
2017/05/02 20:49:21
TODOs should be annotated with a name: TODO(wychen
wychen
2017/05/02 21:57:24
Done.
| |
| 28 #include "chrome/browser/chromeos/certificate_provider/certificate_provider.h" | |
| 29 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv ice.h" | |
| 30 #include "chrome/browser/chromeos/certificate_provider/certificate_provider_serv ice_factory.h" | |
| 31 | |
| 30 using content::BrowserThread; | 32 using content::BrowserThread; |
| 31 | 33 |
| 32 // CertificateManagerModel is created on the UI thread. It needs a | 34 // CertificateManagerModel is created on the UI thread. It needs a |
| 33 // NSSCertDatabase handle (and on ChromeOS it needs to get the TPM status) which | 35 // NSSCertDatabase handle (and on ChromeOS it needs to get the TPM status) which |
| 34 // needs to be done on the IO thread. | 36 // needs to be done on the IO thread. |
| 35 // | 37 // |
| 36 // The initialization flow is roughly: | 38 // The initialization flow is roughly: |
| 37 // | 39 // |
| 38 // UI thread IO Thread | 40 // UI thread IO Thread |
| 39 // | 41 // |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 319 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( | 321 net::NSSCertDatabase* cert_db = GetNSSCertDatabaseForResourceContext( |
| 320 context, did_get_cert_db_callback); | 322 context, did_get_cert_db_callback); |
| 321 | 323 |
| 322 // The callback is run here instead of the actual function call because of | 324 // The callback is run here instead of the actual function call because of |
| 323 // extension_certificate_provider ownership semantics, ie. ownership can only | 325 // extension_certificate_provider ownership semantics, ie. ownership can only |
| 324 // be released once. The callback will only be run once (either inside the | 326 // be released once. The callback will only be run once (either inside the |
| 325 // function above or here). | 327 // function above or here). |
| 326 if (cert_db) | 328 if (cert_db) |
| 327 did_get_cert_db_callback.Run(cert_db); | 329 did_get_cert_db_callback.Run(cert_db); |
| 328 } | 330 } |
| OLD | NEW |