Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chromeos/network/onc/onc_normalizer.cc

Issue 749013003: ONC: Add IPAddressConfigType and NameServersConfigType (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1); 150 RemoveEntryUnless(ipsec, kXAUTH, ike_version == 1);
151 } 151 }
152 152
153 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) { 153 void Normalizer::NormalizeNetworkConfiguration(base::DictionaryValue* network) {
154 bool remove = false; 154 bool remove = false;
155 network->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove); 155 network->GetBooleanWithoutPathExpansion(::onc::kRemove, &remove);
156 if (remove) { 156 if (remove) {
157 network->RemoveWithoutPathExpansion(::onc::network_config::kStaticIPConfig, 157 network->RemoveWithoutPathExpansion(::onc::network_config::kStaticIPConfig,
158 NULL); 158 NULL);
159 network->RemoveWithoutPathExpansion(::onc::network_config::kName, NULL); 159 network->RemoveWithoutPathExpansion(::onc::network_config::kName, NULL);
160 network->RemoveWithoutPathExpansion(::onc::network_config::kNameServers,
161 NULL);
162 network->RemoveWithoutPathExpansion(::onc::network_config::kProxySettings, 160 network->RemoveWithoutPathExpansion(::onc::network_config::kProxySettings,
163 NULL); 161 NULL);
164 network->RemoveWithoutPathExpansion(::onc::network_config::kSearchDomains, 162 network->RemoveWithoutPathExpansion(::onc::network_config::kSearchDomains,
165 NULL); 163 NULL);
166 network->RemoveWithoutPathExpansion(::onc::network_config::kType, NULL); 164 network->RemoveWithoutPathExpansion(::onc::network_config::kType, NULL);
167 // Fields dependent on kType are removed afterwards, too. 165 // Fields dependent on kType are removed afterwards, too.
168 } 166 }
169 167
170 std::string type; 168 std::string type;
171 network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type); 169 network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type);
172 RemoveEntryUnless(network, 170 RemoveEntryUnless(network,
173 ::onc::network_config::kEthernet, 171 ::onc::network_config::kEthernet,
174 type == ::onc::network_type::kEthernet); 172 type == ::onc::network_type::kEthernet);
175 RemoveEntryUnless( 173 RemoveEntryUnless(
176 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN); 174 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN);
177 RemoveEntryUnless(network, 175 RemoveEntryUnless(network,
178 ::onc::network_config::kWiFi, 176 ::onc::network_config::kWiFi,
179 type == ::onc::network_type::kWiFi); 177 type == ::onc::network_type::kWiFi);
178
179 std::string ip_address_config_type, name_servers_config_type;
180 network->GetStringWithoutPathExpansion(
181 ::onc::network_config::kIPAddressConfigType, &ip_address_config_type);
182 network->GetStringWithoutPathExpansion(
183 ::onc::network_config::kNameServersConfigType, &name_servers_config_type);
184 RemoveEntryUnless(
185 network, ::onc::network_config::kStaticIPConfig,
186 (ip_address_config_type == ::onc::network_config::kIPConfigTypeStatic) ||
187 (name_servers_config_type ==
188 ::onc::network_config::kIPConfigTypeStatic));
180 } 189 }
181 190
182 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { 191 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) {
183 std::string clientcert_type; 192 std::string clientcert_type;
184 openvpn->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType, 193 openvpn->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType,
185 &clientcert_type); 194 &clientcert_type);
186 RemoveEntryUnless(openvpn, 195 RemoveEntryUnless(openvpn,
187 ::onc::client_cert::kClientCertPattern, 196 ::onc::client_cert::kClientCertPattern,
188 clientcert_type == ::onc::client_cert::kPattern); 197 clientcert_type == ::onc::client_cert::kPattern);
189 RemoveEntryUnless(openvpn, 198 RemoveEntryUnless(openvpn,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 std::string security; 240 std::string security;
232 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security); 241 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
233 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); 242 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP);
234 RemoveEntryUnless(wifi, kPassphrase, 243 RemoveEntryUnless(wifi, kPassphrase,
235 security == kWEP_PSK || security == kWPA_PSK); 244 security == kWEP_PSK || security == kWPA_PSK);
236 FillInHexSSIDField(wifi); 245 FillInHexSSIDField(wifi);
237 } 246 }
238 247
239 } // namespace onc 248 } // namespace onc
240 } // namespace chromeos 249 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698