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

Unified Diff: chrome/browser/chromeos/policy/user_network_configuration_updater.cc

Issue 547553005: Make ONCCertificateImporter async. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nss_util_deadcode
Patch Set: Simplified NSSCertDatabase creation in unit test. Created 6 years, 3 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: chrome/browser/chromeos/policy/user_network_configuration_updater.cc
diff --git a/chrome/browser/chromeos/policy/user_network_configuration_updater.cc b/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
index 447677e70d70c142f7a400b79b8cfc6d40923ef8..3221bf1074be2be57df59f2d4b2506e6e9023020 100644
--- a/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
+++ b/chrome/browser/chromeos/policy/user_network_configuration_updater.cc
@@ -15,6 +15,7 @@
#include "chromeos/network/managed_network_configuration_handler.h"
#include "chromeos/network/onc/onc_certificate_importer_impl.h"
#include "components/user_manager/user.h"
+#include "content/public/browser/browser_thread.h"
#include "content/public/browser/notification_source.h"
#include "net/cert/x509_certificate.h"
#include "policy/policy_constants.h"
@@ -84,6 +85,15 @@ void UserNetworkConfigurationUpdater::GetWebTrustedCertificates(
*certs = web_trust_certs_;
}
+void UserNetworkConfigurationUpdater::OnCertificatesImported(
+ bool /* unused success */,
+ const net::CertificateList& onc_trusted_certificates) {
+ web_trust_certs_.clear();
+ if (allow_trusted_certificates_from_policy_)
+ web_trust_certs_ = onc_trusted_certificates;
+ NotifyTrustAnchorsChanged();
+}
+
void UserNetworkConfigurationUpdater::ImportCertificates(
const base::ListValue& certificates_onc) {
// If certificate importer is not yet set, cache the certificate onc. It will
@@ -93,13 +103,11 @@ void UserNetworkConfigurationUpdater::ImportCertificates(
return;
}
- web_trust_certs_.clear();
certificate_importer_->ImportCertificates(
certificates_onc,
onc_source_,
- allow_trusted_certificates_from_policy_ ? &web_trust_certs_ : NULL);
-
- NotifyTrustAnchorsChanged();
+ base::Bind(&UserNetworkConfigurationUpdater::OnCertificatesImported,
+ base::Unretained(this)));
}
void UserNetworkConfigurationUpdater::ApplyNetworkPolicy(
@@ -132,7 +140,10 @@ void UserNetworkConfigurationUpdater::CreateAndSetCertificateImporter(
net::NSSCertDatabase* database) {
DCHECK(database);
SetCertificateImporter(scoped_ptr<chromeos::onc::CertificateImporter>(
- new chromeos::onc::CertificateImporterImpl(database)));
+ new chromeos::onc::CertificateImporterImpl(
+ content::BrowserThread::GetMessageLoopProxyForThread(
+ content::BrowserThread::IO),
+ database)));
}
void UserNetworkConfigurationUpdater::SetCertificateImporter(

Powered by Google App Engine
This is Rietveld 408576698