Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Unified Diff: chromeos/cert_loader.cc

Issue 20799002: Fix CertLoader certificates_loaded() during notification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed build on non-chromeos. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/cert_loader.cc
diff --git a/chromeos/cert_loader.cc b/chromeos/cert_loader.cc
index ff57d36c1c2ec8a0a4e161d39bbbba38afd69091..776e95ea9a77f6264c384b31b06813705fd8417c 100644
--- a/chromeos/cert_loader.cc
+++ b/chromeos/cert_loader.cc
@@ -44,8 +44,7 @@ base::TimeDelta GetNextRequestDelayMs(base::TimeDelta last_delay) {
}
void LoadNSSCertificates(net::CertificateList* cert_list) {
- if (base::chromeos::IsRunningOnChromeOS())
- net::NSSCertDatabase::GetInstance()->ListCerts(cert_list);
+ net::NSSCertDatabase::GetInstance()->ListCerts(cert_list);
}
void CallOpenPersistentNSSDB() {
@@ -54,8 +53,7 @@ void CallOpenPersistentNSSDB() {
// Ensure we've opened the user's key/certificate database.
crypto::OpenPersistentNSSDB();
- if (base::chromeos::IsRunningOnChromeOS())
- crypto::EnableTPMTokenForNSS();
+ crypto::EnableTPMTokenForNSS();
}
} // namespace
@@ -77,8 +75,7 @@ void CertLoader::Shutdown() {
// static
CertLoader* CertLoader::Get() {
- CHECK(g_cert_loader)
- << "CertLoader::Get() called before Initialize()";
+ CHECK(g_cert_loader) << "CertLoader::Get() called before Initialize()";
return g_cert_loader;
}
@@ -151,6 +148,9 @@ void CertLoader::MaybeRequestCertificates() {
// Ensure we only initialize the TPM token once.
DCHECK_EQ(tpm_token_state_, TPM_STATE_UNKNOWN);
+ if (!base::chromeos::IsRunningOnChromeOS())
+ tpm_token_state_ = TPM_DISABLED;
+
InitializeTokenAndLoadCertificates();
}
@@ -193,16 +193,14 @@ void CertLoader::InitializeTokenAndLoadCertificates() {
return;
}
case TPM_TOKEN_INFO_RECEIVED: {
- if (base::chromeos::IsRunningOnChromeOS()) {
- base::PostTaskAndReplyWithResult(
- crypto_task_runner_.get(),
- FROM_HERE,
- base::Bind(&crypto::InitializeTPMToken,
- tpm_token_name_, tpm_user_pin_),
- base::Bind(&CertLoader::OnTPMTokenInitialized,
- initialize_token_factory_.GetWeakPtr()));
- return;
- }
+ base::PostTaskAndReplyWithResult(
+ crypto_task_runner_.get(),
+ FROM_HERE,
+ base::Bind(
+ &crypto::InitializeTPMToken, tpm_token_name_, tpm_user_pin_),
+ base::Bind(&CertLoader::OnTPMTokenInitialized,
+ initialize_token_factory_.GetWeakPtr()));
+ return;
tpm_token_state_ = TPM_TOKEN_INITIALIZED;
// FALL_THROUGH_INTENDED
}
@@ -345,8 +343,9 @@ void CertLoader::UpdateCertificates(net::CertificateList* cert_list) {
// Ignore any existing certificates.
cert_list_.swap(*cert_list);
- NotifyCertificatesLoaded(!certificates_loaded_);
+ bool initial_load = !certificates_loaded_;
certificates_loaded_ = true;
+ NotifyCertificatesLoaded(initial_load);
certificates_update_running_ = false;
if (certificates_update_required_)
« no previous file with comments | « chrome/browser/ui/webui/options/certificate_manager_browsertest.cc ('k') | chromeos/dbus/cryptohome_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698