Chromium Code Reviews| 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 49c2552ded99d32337fc11d173e004524e360862..ad30d791b28125ca8897630891989b73d86a4f5c 100644 |
| --- a/chrome/browser/chromeos/policy/user_network_configuration_updater.cc |
| +++ b/chrome/browser/chromeos/policy/user_network_configuration_updater.cc |
| @@ -18,7 +18,9 @@ |
| namespace policy { |
| -UserNetworkConfigurationUpdater::~UserNetworkConfigurationUpdater() {} |
| +UserNetworkConfigurationUpdater::~UserNetworkConfigurationUpdater() { |
| + DCHECK(cert_verifiers_.empty()); |
| +} |
| // static |
| scoped_ptr<UserNetworkConfigurationUpdater> |
| @@ -50,15 +52,21 @@ UserNetworkConfigurationUpdater::UserNetworkConfigurationUpdater( |
| policy_service, |
| network_config_handler), |
| allow_trusted_certificates_from_policy_(allow_trusted_certs_from_policy), |
| - user_(&user), |
| - cert_verifier_(NULL) {} |
| + user_(&user) {} |
| -void UserNetworkConfigurationUpdater::SetPolicyCertVerifier( |
| +void UserNetworkConfigurationUpdater::AddPolicyCertVerifier( |
| PolicyCertVerifier* cert_verifier) { |
| - cert_verifier_ = cert_verifier; |
| + DCHECK(cert_verifiers_.find(cert_verifier) == cert_verifiers_.end()); |
| + cert_verifiers_.insert(cert_verifier); |
| SetTrustAnchors(); |
| } |
| +void UserNetworkConfigurationUpdater::RemovePolicyCertVerifier( |
| + PolicyCertVerifier* cert_verifier) { |
| + size_t count = cert_verifiers_.erase(cert_verifier); |
| + DCHECK(count > 0); |
| +} |
| + |
| void UserNetworkConfigurationUpdater::GetWebTrustedCertificates( |
| net::CertificateList* certs) const { |
| *certs = web_trust_certs_; |
| @@ -88,14 +96,17 @@ void UserNetworkConfigurationUpdater::ApplyNetworkPolicy( |
| } |
| void UserNetworkConfigurationUpdater::SetTrustAnchors() { |
| - if (!cert_verifier_) |
| - return; |
| - content::BrowserThread::PostTask( |
| - content::BrowserThread::IO, |
| - FROM_HERE, |
| - base::Bind(&PolicyCertVerifier::SetTrustAnchors, |
| - base::Unretained(cert_verifier_), |
| - web_trust_certs_)); |
| + for (std::set<PolicyCertVerifier*>::const_iterator it = |
| + cert_verifiers_.begin(); |
| + it != cert_verifiers_.end(); |
| + ++it) { |
| + content::BrowserThread::PostTask( |
| + content::BrowserThread::IO, |
| + FROM_HERE, |
| + base::Bind(&PolicyCertVerifier::SetTrustAnchors, |
| + base::Unretained(*it), |
| + web_trust_certs_)); |
|
Joao da Silva
2013/10/25 11:57:10
Leave a comment here explaining why it's safe to p
pneubeck (no reviews)
2013/10/25 12:17:00
Done.
|
| + } |
| } |
| } // namespace policy |