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