| 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 "chromeos/network/onc/onc_normalizer.h" | 5 #include "chromeos/network/onc/onc_normalizer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version); | 138 ipsec->GetIntegerWithoutPathExpansion(kIKEVersion, &ike_version); |
| 139 RemoveEntryUnless(ipsec, kEAP, ike_version == 2); | 139 RemoveEntryUnless(ipsec, kEAP, ike_version == 2); |
| 140 RemoveEntryUnless(ipsec, kGroup, ike_version == 1); | 140 RemoveEntryUnless(ipsec, kGroup, ike_version == 1); |
| 141 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); | 141 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { | 144 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { |
| 145 bool remove = false; | 145 bool remove = false; |
| 146 network->GetBooleanWithoutPathExpansion(kRemove, &remove); | 146 network->GetBooleanWithoutPathExpansion(kRemove, &remove); |
| 147 if (remove) { | 147 if (remove) { |
| 148 network->RemoveWithoutPathExpansion(kIPConfigs, NULL); | 148 network->RemoveWithoutPathExpansion(network_config::kIPConfigs, NULL); |
| 149 network->RemoveWithoutPathExpansion(kName, NULL); | 149 network->RemoveWithoutPathExpansion(network_config::kName, NULL); |
| 150 network->RemoveWithoutPathExpansion(kNameServers, NULL); | 150 network->RemoveWithoutPathExpansion(network_config::kNameServers, NULL); |
| 151 network->RemoveWithoutPathExpansion(kProxySettings, NULL); | 151 network->RemoveWithoutPathExpansion(network_config::kProxySettings, NULL); |
| 152 network->RemoveWithoutPathExpansion(kSearchDomains, NULL); | 152 network->RemoveWithoutPathExpansion(network_config::kSearchDomains, NULL); |
| 153 network->RemoveWithoutPathExpansion(kType, NULL); | 153 network->RemoveWithoutPathExpansion(network_config::kType, NULL); |
| 154 // Fields dependent on kType are removed afterwards, too. | 154 // Fields dependent on kType are removed afterwards, too. |
| 155 } | 155 } |
| 156 | 156 |
| 157 std::string type; | 157 std::string type; |
| 158 network->GetStringWithoutPathExpansion(kType, &type); | 158 network->GetStringWithoutPathExpansion(network_config::kType, &type); |
| 159 RemoveEntryUnless(network, kEthernet, type == kEthernet); | 159 RemoveEntryUnless(network, network_config::kEthernet, |
| 160 RemoveEntryUnless(network, kVPN, type == kVPN); | 160 type == network_type::kEthernet); |
| 161 RemoveEntryUnless(network, kWiFi, type == kWiFi); | 161 RemoveEntryUnless(network, network_config::kVPN, type == network_type::kVPN); |
| 162 RemoveEntryUnless(network, network_config::kWiFi, |
| 163 type == network_type::kWiFi); |
| 162 } | 164 } |
| 163 | 165 |
| 164 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { | 166 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { |
| 165 using namespace vpn; | 167 using namespace vpn; |
| 166 | 168 |
| 167 std::string clientcert_type; | 169 std::string clientcert_type; |
| 168 openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); | 170 openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); |
| 169 RemoveEntryUnless(openvpn, kClientCertPattern, | 171 RemoveEntryUnless(openvpn, kClientCertPattern, |
| 170 clientcert_type == certificate::kPattern); | 172 clientcert_type == certificate::kPattern); |
| 171 RemoveEntryUnless(openvpn, kClientCertRef, | 173 RemoveEntryUnless(openvpn, kClientCertRef, |
| (...skipping 25 matching lines...) Expand all Loading... |
| 197 | 199 |
| 198 std::string security; | 200 std::string security; |
| 199 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); | 201 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); |
| 200 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); | 202 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); |
| 201 RemoveEntryUnless(wifi, kPassphrase, | 203 RemoveEntryUnless(wifi, kPassphrase, |
| 202 security == kWEP_PSK || security == kWPA_PSK); | 204 security == kWEP_PSK || security == kWPA_PSK); |
| 203 } | 205 } |
| 204 | 206 |
| 205 } // namespace onc | 207 } // namespace onc |
| 206 } // namespace chromeos | 208 } // namespace chromeos |
| OLD | NEW |