| 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" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 ApplyNetworkConfiguration(chromeos::onc::ONC_SOURCE_DEVICE_POLICY); | 43 ApplyNetworkConfiguration(chromeos::onc::ONC_SOURCE_DEVICE_POLICY); |
| 44 } | 44 } |
| 45 | 45 |
| 46 NetworkConfigurationUpdaterImpl::~NetworkConfigurationUpdaterImpl() { | 46 NetworkConfigurationUpdaterImpl::~NetworkConfigurationUpdaterImpl() { |
| 47 } | 47 } |
| 48 | 48 |
| 49 void NetworkConfigurationUpdaterImpl::OnUserPolicyInitialized( | 49 void NetworkConfigurationUpdaterImpl::OnUserPolicyInitialized( |
| 50 bool allow_trusted_certs_from_policy, | 50 bool allow_trusted_certs_from_policy, |
| 51 const std::string& hashed_username) { | 51 const std::string& hashed_username) { |
| 52 VLOG(1) << "User policy initialized."; | 52 VLOG(1) << "User policy initialized."; |
| 53 hashed_username_ = hashed_username; |
| 53 if (allow_trusted_certs_from_policy) | 54 if (allow_trusted_certs_from_policy) |
| 54 SetAllowTrustedCertsFromPolicy(); | 55 SetAllowTrustedCertsFromPolicy(); |
| 55 ApplyNetworkConfiguration(chromeos::onc::ONC_SOURCE_USER_POLICY); | 56 ApplyNetworkConfiguration(chromeos::onc::ONC_SOURCE_USER_POLICY); |
| 56 } | 57 } |
| 57 | 58 |
| 58 void NetworkConfigurationUpdaterImpl::OnPolicyChanged( | 59 void NetworkConfigurationUpdaterImpl::OnPolicyChanged( |
| 59 chromeos::onc::ONCSource onc_source, | 60 chromeos::onc::ONCSource onc_source, |
| 60 const base::Value* previous, | 61 const base::Value* previous, |
| 61 const base::Value* current) { | 62 const base::Value* current) { |
| 62 VLOG(1) << "Policy for ONC source " | 63 VLOG(1) << "Policy for ONC source " |
| (...skipping 23 matching lines...) Expand all Loading... |
| 86 } else { | 87 } else { |
| 87 VLOG(2) << "The policy is not set."; | 88 VLOG(2) << "The policy is not set."; |
| 88 } | 89 } |
| 89 VLOG(2) << "The policy contains this ONC: " << onc_blob; | 90 VLOG(2) << "The policy contains this ONC: " << onc_blob; |
| 90 | 91 |
| 91 base::ListValue network_configs; | 92 base::ListValue network_configs; |
| 92 base::ListValue certificates; | 93 base::ListValue certificates; |
| 93 ParseAndValidateOncForImport( | 94 ParseAndValidateOncForImport( |
| 94 onc_blob, onc_source, "", &network_configs, &certificates); | 95 onc_blob, onc_source, "", &network_configs, &certificates); |
| 95 | 96 |
| 96 network_config_handler_->SetPolicy(onc_source, network_configs); | 97 std::string userhash = onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY ? |
| 98 hashed_username_ : std::string(); |
| 99 network_config_handler_->SetPolicy(onc_source, userhash, network_configs); |
| 97 | 100 |
| 98 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); | 101 scoped_ptr<net::CertificateList> web_trust_certs(new net::CertificateList); |
| 99 certificate_handler_->ImportCertificates( | 102 certificate_handler_->ImportCertificates( |
| 100 certificates, onc_source, web_trust_certs.get()); | 103 certificates, onc_source, web_trust_certs.get()); |
| 101 | 104 |
| 102 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) | 105 if (onc_source == chromeos::onc::ONC_SOURCE_USER_POLICY) |
| 103 SetTrustAnchors(web_trust_certs.Pass()); | 106 SetTrustAnchors(web_trust_certs.Pass()); |
| 104 } | 107 } |
| 105 | 108 |
| 106 } // namespace policy | 109 } // namespace policy |
| OLD | NEW |