OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/network_configuration_updater_impl.h" | 5 #include "chrome/browser/chromeos/policy/network_configuration_updater_impl.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/policy/policy_map.h" | 13 #include "chrome/browser/policy/policy_map.h" |
14 #include "chromeos/network/certificate_handler.h" | 14 #include "chromeos/network/certificate_handler.h" |
15 #include "chromeos/network/managed_network_configuration_handler.h" | 15 #include "chromeos/network/managed_network_configuration_handler.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 NetworkConfigurationUpdaterImpl::NetworkConfigurationUpdaterImpl( | 22 NetworkConfigurationUpdaterImpl::NetworkConfigurationUpdaterImpl( |
23 PolicyService* policy_service, | 23 PolicyService* policy_service, |
24 chromeos::ManagedNetworkConfigurationHandler* network_config_handler, | |
pneubeck (no reviews)
2013/05/13 09:17:06
What is the improvement here? How will it make wri
stevenjb
2013/05/13 23:49:35
See meta comment
| |
25 scoped_ptr<chromeos::CertificateHandler> certificate_handler) | 24 scoped_ptr<chromeos::CertificateHandler> certificate_handler) |
26 : policy_change_registrar_( | 25 : policy_change_registrar_( |
27 policy_service, PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())), | 26 policy_service, PolicyNamespace(POLICY_DOMAIN_CHROME, std::string())), |
28 policy_service_(policy_service), | 27 policy_service_(policy_service), |
29 network_config_handler_(network_config_handler), | |
30 certificate_handler_(certificate_handler.Pass()) { | 28 certificate_handler_(certificate_handler.Pass()) { |
31 policy_change_registrar_.Observe( | 29 policy_change_registrar_.Observe( |
32 key::kDeviceOpenNetworkConfiguration, | 30 key::kDeviceOpenNetworkConfiguration, |
33 base::Bind(&NetworkConfigurationUpdaterImpl::OnPolicyChanged, | 31 base::Bind(&NetworkConfigurationUpdaterImpl::OnPolicyChanged, |
34 base::Unretained(this), | 32 base::Unretained(this), |
35 chromeos::onc::ONC_SOURCE_DEVICE_POLICY)); | 33 chromeos::onc::ONC_SOURCE_DEVICE_POLICY)); |
36 policy_change_registrar_.Observe( | 34 policy_change_registrar_.Observe( |
37 key::kOpenNetworkConfiguration, | 35 key::kOpenNetworkConfiguration, |
38 base::Bind(&NetworkConfigurationUpdaterImpl::OnPolicyChanged, | 36 base::Bind(&NetworkConfigurationUpdaterImpl::OnPolicyChanged, |
39 base::Unretained(this), | 37 base::Unretained(this), |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
89 } | 87 } |
90 VLOG(2) << "The policy contains this ONC: " << onc_blob; | 88 VLOG(2) << "The policy contains this ONC: " << onc_blob; |
91 | 89 |
92 base::ListValue network_configs; | 90 base::ListValue network_configs; |
93 base::ListValue certificates; | 91 base::ListValue certificates; |
94 ParseAndValidateOncForImport( | 92 ParseAndValidateOncForImport( |
95 onc_blob, onc_source, "", &network_configs, &certificates); | 93 onc_blob, onc_source, "", &network_configs, &certificates); |
96 | 94 |
97 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? | 95 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? |
98 hashed_username_ : std::string(); | 96 hashed_username_ : std::string(); |
99 network_config_handler_->SetPolicy(onc_source, userhash, network_configs); | 97 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()-> |
98 SetPolicy(onc_source, userhash, network_configs); | |
100 | 99 |
101 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); | 100 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); |
102 certificate_handler_->ImportCertificates( | 101 certificate_handler_->ImportCertificates( |
103 certificates, onc_source, web_trust_certs.get()); | 102 certificates, onc_source, web_trust_certs.get()); |
104 | 103 |
105 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) | 104 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) |
106 SetTrustAnchors(web_trust_certs.Pass()); | 105 SetTrustAnchors(web_trust_certs.Pass()); |
107 } | 106 } |
108 | 107 |
109 } // namespace policy | 108 } // namespace policy |
OLD | NEW |