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_type::kEthernet, |
pneubeck (no reviews)
2013/01/18 10:27:41
the second arg has to be a field name, thus
netw
Greg Spencer (Chromium)
2013/01/18 22:27:44
Done.
| |
160 RemoveEntryUnless(network, kVPN, type == kVPN); | 160 type == network_type::kEthernet); |
161 RemoveEntryUnless(network, kWiFi, type == kWiFi); | 161 RemoveEntryUnless(network, network_type::kVPN, type == network_type::kVPN); |
162 RemoveEntryUnless(network, network_type::kWiFi, type == network_type::kWiFi); | |
162 } | 163 } |
163 | 164 |
164 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { | 165 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { |
165 using namespace vpn; | 166 using namespace vpn; |
166 | 167 |
167 std::string clientcert_type; | 168 std::string clientcert_type; |
168 openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); | 169 openvpn->GetStringWithoutPathExpansion(kClientCertType, &clientcert_type); |
169 RemoveEntryUnless(openvpn, kClientCertPattern, | 170 RemoveEntryUnless(openvpn, kClientCertPattern, |
170 clientcert_type == certificate::kPattern); | 171 clientcert_type == certificate::kPattern); |
171 RemoveEntryUnless(openvpn, kClientCertRef, | 172 RemoveEntryUnless(openvpn, kClientCertRef, |
(...skipping 25 matching lines...) Expand all Loading... | |
197 | 198 |
198 std::string security; | 199 std::string security; |
199 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); | 200 wifi->GetStringWithoutPathExpansion(wifi::kSecurity, &security); |
200 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); | 201 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); |
201 RemoveEntryUnless(wifi, kPassphrase, | 202 RemoveEntryUnless(wifi, kPassphrase, |
202 security == kWEP_PSK || security == kWPA_PSK); | 203 security == kWEP_PSK || security == kWPA_PSK); |
203 } | 204 } |
204 | 205 |
205 } // namespace onc | 206 } // namespace onc |
206 } // namespace chromeos | 207 } // namespace chromeos |
OLD | NEW |