| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/chromeos/policy/user_network_configuration_updater.h" | 5 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "chrome/browser/chromeos/login/user.h" | 10 #include "chrome/browser/chromeos/login/user.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 network_config_handler), | 60 network_config_handler), |
| 61 allow_trusted_certificates_from_policy_(allow_trusted_certs_from_policy), | 61 allow_trusted_certificates_from_policy_(allow_trusted_certs_from_policy), |
| 62 user_(&user) {} | 62 user_(&user) {} |
| 63 | 63 |
| 64 void UserNetworkConfigurationUpdater::GetWebTrustedCertificates( | 64 void UserNetworkConfigurationUpdater::GetWebTrustedCertificates( |
| 65 net::CertificateList* certs) const { | 65 net::CertificateList* certs) const { |
| 66 *certs = web_trust_certs_; | 66 *certs = web_trust_certs_; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void UserNetworkConfigurationUpdater::ImportCertificates( | 69 void UserNetworkConfigurationUpdater::ImportCertificates( |
| 70 const base::ListValue& certificates_onc) { | 70 const base::ListValue& certificates_onc, |
| 71 net::NSSCertDatabase* target_nssdb) { |
| 71 web_trust_certs_.clear(); | 72 web_trust_certs_.clear(); |
| 72 certificate_importer_->ImportCertificates( | 73 certificate_importer_->ImportCertificates( |
| 73 certificates_onc, | 74 certificates_onc, |
| 74 onc_source_, | 75 onc_source_, |
| 76 target_nssdb, |
| 75 allow_trusted_certificates_from_policy_ ? &web_trust_certs_ : NULL); | 77 allow_trusted_certificates_from_policy_ ? &web_trust_certs_ : NULL); |
| 76 | 78 |
| 77 NotifyTrustAnchorsChanged(); | 79 NotifyTrustAnchorsChanged(); |
| 78 } | 80 } |
| 79 | 81 |
| 80 void UserNetworkConfigurationUpdater::ApplyNetworkPolicy( | 82 void UserNetworkConfigurationUpdater::ApplyNetworkPolicy( |
| 81 base::ListValue* network_configs_onc, | 83 base::ListValue* network_configs_onc, |
| 82 base::DictionaryValue* global_network_config) { | 84 base::DictionaryValue* global_network_config) { |
| 83 DCHECK(user_); | 85 DCHECK(user_); |
| 84 chromeos::onc::ExpandStringPlaceholdersInNetworksForUser(user_, | 86 chromeos::onc::ExpandStringPlaceholdersInNetworksForUser(user_, |
| 85 network_configs_onc); | 87 network_configs_onc); |
| 86 network_config_handler_->SetPolicy(onc_source_, | 88 network_config_handler_->SetPolicy(onc_source_, |
| 87 user_->username_hash(), | 89 user_->username_hash(), |
| 88 *network_configs_onc, | 90 *network_configs_onc, |
| 89 *global_network_config); | 91 *global_network_config); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void UserNetworkConfigurationUpdater::NotifyTrustAnchorsChanged() { | 94 void UserNetworkConfigurationUpdater::NotifyTrustAnchorsChanged() { |
| 93 FOR_EACH_OBSERVER(WebTrustedCertsObserver, | 95 FOR_EACH_OBSERVER(WebTrustedCertsObserver, |
| 94 observer_list_, | 96 observer_list_, |
| 95 OnTrustAnchorsChanged(web_trust_certs_)); | 97 OnTrustAnchorsChanged(web_trust_certs_)); |
| 96 } | 98 } |
| 97 | 99 |
| 98 } // namespace policy | 100 } // namespace policy |
| OLD | NEW |