| 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/chromeos/policy/network_configuration_updater_impl_cros
.h" | 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl_cros
.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "chrome/browser/chromeos/cros/network_library.h" | 13 #include "chrome/browser/chromeos/cros/network_library.h" |
| 14 #include "chrome/browser/policy/policy_map.h" | 14 #include "chrome/browser/policy/policy_map.h" |
| 15 #include "chromeos/network/certificate_handler.h" | 15 #include "chromeos/network/onc/onc_certificate_importer.h" |
| 16 #include "chromeos/network/onc/onc_constants.h" | 16 #include "chromeos/network/onc/onc_constants.h" |
| 17 #include "chromeos/network/onc/onc_utils.h" | 17 #include "chromeos/network/onc/onc_utils.h" |
| 18 #include "policy/policy_constants.h" | 18 #include "policy/policy_constants.h" |
| 19 | 19 |
| 20 namespace policy { | 20 namespace policy { |
| 21 | 21 |
| 22 NetworkConfigurationUpdaterImplCros::NetworkConfigurationUpdaterImplCros( | 22 NetworkConfigurationUpdaterImplCros::NetworkConfigurationUpdaterImplCros( |
| 23 PolicyService* device_policy_service, | 23 PolicyService* device_policy_service, |
| 24 chromeos::NetworkLibrary* network_library, | 24 chromeos::NetworkLibrary* network_library, |
| 25 scoped_ptr<chromeos::CertificateHandler> certificate_handler) | 25 scoped_ptr<chromeos::onc::CertificateImporter> certificate_importer) |
| 26 : policy_change_registrar_( | 26 : policy_change_registrar_( |
| 27 device_policy_service, | 27 device_policy_service, |
| 28 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())), | 28 PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())), |
| 29 network_library_(network_library), | 29 network_library_(network_library), |
| 30 certificate_handler_(certificate_handler.Pass()), | 30 certificate_importer_(certificate_importer.Pass()), |
| 31 user_policy_service_(NULL), | 31 user_policy_service_(NULL), |
| 32 device_policy_service_(device_policy_service) { | 32 device_policy_service_(device_policy_service) { |
| 33 DCHECK(network_library_); | 33 DCHECK(network_library_); |
| 34 policy_change_registrar_.Observe( | 34 policy_change_registrar_.Observe( |
| 35 key::kDeviceOpenNetworkConfiguration, | 35 key::kDeviceOpenNetworkConfiguration, |
| 36 base::Bind(&NetworkConfigurationUpdaterImplCros::OnPolicyChanged, | 36 base::Bind(&NetworkConfigurationUpdaterImplCros::OnPolicyChanged, |
| 37 base::Unretained(this), | 37 base::Unretained(this), |
| 38 chromeos::onc::ONC_SOURCE_DEVICE_POLICY)); | 38 chromeos::onc::ONC_SOURCE_DEVICE_POLICY)); |
| 39 policy_change_registrar_.Observe( | 39 policy_change_registrar_.Observe( |
| 40 key::kOpenNetworkConfiguration, | 40 key::kOpenNetworkConfiguration, |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 << " is not a string value."; | 159 << " is not a string value."; |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 base::ListValue network_configs; | 163 base::ListValue network_configs; |
| 164 base::ListValue certificates; | 164 base::ListValue certificates; |
| 165 chromeos::onc::ParseAndValidateOncForImport( | 165 chromeos::onc::ParseAndValidateOncForImport( |
| 166 onc_blob, onc_source, "", &network_configs, &certificates); | 166 onc_blob, onc_source, "", &network_configs, &certificates); |
| 167 | 167 |
| 168 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); | 168 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); |
| 169 certificate_handler_->ImportCertificates( | 169 certificate_importer_->ImportCertificates( |
| 170 certificates, onc_source, web_trust_certs.get()); | 170 certificates, onc_source, web_trust_certs.get()); |
| 171 | 171 |
| 172 network_library_->LoadOncNetworks(network_configs, onc_source); | 172 network_library_->LoadOncNetworks(network_configs, onc_source); |
| 173 | 173 |
| 174 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) | 174 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) |
| 175 SetTrustAnchors(web_trust_certs.Pass()); | 175 SetTrustAnchors(web_trust_certs.Pass()); |
| 176 } | 176 } |
| 177 | 177 |
| 178 } // namespace policy | 178 } // namespace policy |
| OLD | NEW |