| 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/policy/network_configuration_updater.h" | 5 #include "chrome/browser/policy/network_configuration_updater.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 "chrome/browser/chromeos/cros/network_library.h" | 11 #include "chrome/browser/chromeos/cros/network_library.h" |
| 12 #include "chrome/browser/policy/policy_map.h" | 12 #include "chrome/browser/policy/policy_map.h" |
| 13 #include "chromeos/network/onc/onc_constants.h" | 13 #include "chromeos/network/onc/onc_constants.h" |
| 14 #include "chromeos/network/onc/onc_utils.h" |
| 14 #include "policy/policy_constants.h" | 15 #include "policy/policy_constants.h" |
| 15 | 16 |
| 16 namespace policy { | 17 namespace policy { |
| 17 | 18 |
| 18 const char NetworkConfigurationUpdater::kEmptyConfiguration[] = | |
| 19 "{\"NetworkConfigurations\":[],\"Certificates\":[]}"; | |
| 20 | |
| 21 NetworkConfigurationUpdater::NetworkConfigurationUpdater( | 19 NetworkConfigurationUpdater::NetworkConfigurationUpdater( |
| 22 PolicyService* policy_service, | 20 PolicyService* policy_service, |
| 23 chromeos::NetworkLibrary* network_library) | 21 chromeos::NetworkLibrary* network_library) |
| 24 : policy_change_registrar_( | 22 : policy_change_registrar_( |
| 25 policy_service, POLICY_DOMAIN_CHROME, std::string()), | 23 policy_service, POLICY_DOMAIN_CHROME, std::string()), |
| 26 network_library_(network_library), | 24 network_library_(network_library), |
| 27 user_policy_initialized_(false), | 25 user_policy_initialized_(false), |
| 28 allow_web_trust_(false), | 26 allow_web_trust_(false), |
| 29 policy_service_(policy_service) { | 27 policy_service_(policy_service) { |
| 30 DCHECK(network_library_); | 28 DCHECK(network_library_); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 if (policy_value != NULL) { | 87 if (policy_value != NULL) { |
| 90 // If the policy is not a string, we issue a warning, but still clear the | 88 // If the policy is not a string, we issue a warning, but still clear the |
| 91 // network configuration. | 89 // network configuration. |
| 92 if (!policy_value->GetAsString(&new_network_config)) | 90 if (!policy_value->GetAsString(&new_network_config)) |
| 93 LOG(WARNING) << "ONC policy is not a string value."; | 91 LOG(WARNING) << "ONC policy is not a string value."; |
| 94 } | 92 } |
| 95 | 93 |
| 96 // An empty string is not a valid ONC and generates warnings and | 94 // An empty string is not a valid ONC and generates warnings and |
| 97 // errors. Replace by a valid empty configuration. | 95 // errors. Replace by a valid empty configuration. |
| 98 if (new_network_config.empty()) | 96 if (new_network_config.empty()) |
| 99 new_network_config = kEmptyConfiguration; | 97 new_network_config = chromeos::onc::kEmptyUnencryptedConfiguration; |
| 100 | 98 |
| 101 network_library_->LoadOncNetworks(new_network_config, "", onc_source, | 99 network_library_->LoadOncNetworks(new_network_config, "", onc_source, |
| 102 allow_web_trust_); | 100 allow_web_trust_); |
| 103 } | 101 } |
| 104 | 102 |
| 105 } // namespace policy | 103 } // namespace policy |
| OLD | NEW |