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

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: Alywas use empty dictionary to clear StaticIPConfig properties Created 5 years, 11 months 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
« no previous file with comments | « chromeos/network/onc/onc_merger.cc ('k') | chromeos/network/onc/onc_normalizer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 std::string type; 166 std::string type;
167 network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type); 167 network->GetStringWithoutPathExpansion(::onc::network_config::kType, &type);
168 RemoveEntryUnless(network, 168 RemoveEntryUnless(network,
169 ::onc::network_config::kEthernet, 169 ::onc::network_config::kEthernet,
170 type == ::onc::network_type::kEthernet); 170 type == ::onc::network_type::kEthernet);
171 RemoveEntryUnless( 171 RemoveEntryUnless(
172 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN); 172 network, ::onc::network_config::kVPN, type == ::onc::network_type::kVPN);
173 RemoveEntryUnless(network, 173 RemoveEntryUnless(network,
174 ::onc::network_config::kWiFi, 174 ::onc::network_config::kWiFi,
175 type == ::onc::network_type::kWiFi); 175 type == ::onc::network_type::kWiFi);
176
177 std::string ip_address_config_type, name_servers_config_type;
178 network->GetStringWithoutPathExpansion(
179 ::onc::network_config::kIPAddressConfigType, &ip_address_config_type);
180 network->GetStringWithoutPathExpansion(
181 ::onc::network_config::kNameServersConfigType, &name_servers_config_type);
182 RemoveEntryUnless(
183 network, ::onc::network_config::kStaticIPConfig,
184 (ip_address_config_type == ::onc::network_config::kIPConfigTypeStatic) ||
185 (name_servers_config_type ==
186 ::onc::network_config::kIPConfigTypeStatic));
187 // TODO(pneubeck): Remove fields from StaticIPConfig not specified by
188 // IP[Address|Nameservers]ConfigType.
176 } 189 }
177 190
178 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) { 191 void Normalizer::NormalizeOpenVPN(base::DictionaryValue* openvpn) {
179 std::string clientcert_type; 192 std::string clientcert_type;
180 openvpn->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType, 193 openvpn->GetStringWithoutPathExpansion(::onc::client_cert::kClientCertType,
181 &clientcert_type); 194 &clientcert_type);
182 RemoveEntryUnless(openvpn, 195 RemoveEntryUnless(openvpn,
183 ::onc::client_cert::kClientCertPattern, 196 ::onc::client_cert::kClientCertPattern,
184 clientcert_type == ::onc::client_cert::kPattern); 197 clientcert_type == ::onc::client_cert::kPattern);
185 RemoveEntryUnless(openvpn, 198 RemoveEntryUnless(openvpn,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 std::string security; 240 std::string security;
228 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security); 241 wifi->GetStringWithoutPathExpansion(::onc::wifi::kSecurity, &security);
229 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP); 242 RemoveEntryUnless(wifi, kEAP, security == kWEP_8021X || security == kWPA_EAP);
230 RemoveEntryUnless(wifi, kPassphrase, 243 RemoveEntryUnless(wifi, kPassphrase,
231 security == kWEP_PSK || security == kWPA_PSK); 244 security == kWEP_PSK || security == kWPA_PSK);
232 FillInHexSSIDField(wifi); 245 FillInHexSSIDField(wifi);
233 } 246 }
234 247
235 } // namespace onc 248 } // namespace onc
236 } // namespace chromeos 249 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/network/onc/onc_merger.cc ('k') | chromeos/network/onc/onc_normalizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698