| 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_signature.h" | 5 #include "chromeos/network/onc/onc_signature.h" |
| 6 | 6 |
| 7 #include "components/onc/onc_constants.h" | 7 #include "components/onc/onc_constants.h" |
| 8 #include "third_party/cros_system_api/dbus/service_constants.h" | 8 #include "third_party/cros_system_api/dbus/service_constants.h" |
| 9 | 9 |
| 10 using base::Value; | 10 using base::Value; |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 { ::onc::wifi::kSecurity, &kStringSignature}, | 209 { ::onc::wifi::kSecurity, &kStringSignature}, |
| 210 {NULL}}; | 210 {NULL}}; |
| 211 | 211 |
| 212 const OncFieldSignature wifi_with_state_fields[] = { | 212 const OncFieldSignature wifi_with_state_fields[] = { |
| 213 { ::onc::wifi::kBSSID, &kStringSignature}, | 213 { ::onc::wifi::kBSSID, &kStringSignature}, |
| 214 { ::onc::wifi::kFrequency, &kIntegerSignature}, | 214 { ::onc::wifi::kFrequency, &kIntegerSignature}, |
| 215 { ::onc::wifi::kFrequencyList, &kIntegerListSignature}, | 215 { ::onc::wifi::kFrequencyList, &kIntegerListSignature}, |
| 216 { ::onc::wifi::kSignalStrength, &kIntegerSignature}, | 216 { ::onc::wifi::kSignalStrength, &kIntegerSignature}, |
| 217 {NULL}}; | 217 {NULL}}; |
| 218 | 218 |
| 219 const OncFieldSignature wimax_fields[] = { |
| 220 { ::onc::kRecommended, &kRecommendedSignature}, |
| 221 { ::onc::wimax::kAutoConnect, &kBoolSignature}, |
| 222 { ::onc::wimax::kEAP, &kEAPSignature}, |
| 223 {NULL}}; |
| 224 |
| 225 const OncFieldSignature wimax_with_state_fields[] = { |
| 226 { ::onc::wimax::kSignalStrength, &kIntegerSignature}, |
| 227 {NULL}}; |
| 228 |
| 219 const OncFieldSignature cellular_provider_fields[] = { | 229 const OncFieldSignature cellular_provider_fields[] = { |
| 220 { ::onc::cellular_provider::kCode, &kStringSignature}, | 230 { ::onc::cellular_provider::kCode, &kStringSignature}, |
| 221 { ::onc::cellular_provider::kCountry, &kStringSignature}, | 231 { ::onc::cellular_provider::kCountry, &kStringSignature}, |
| 222 { ::onc::cellular_provider::kName, &kStringSignature}, | 232 { ::onc::cellular_provider::kName, &kStringSignature}, |
| 223 {NULL}}; | 233 {NULL}}; |
| 224 | 234 |
| 225 const OncFieldSignature cellular_apn_fields[] = { | 235 const OncFieldSignature cellular_apn_fields[] = { |
| 226 { ::onc::cellular_apn::kAccessPointName, &kStringSignature}, | 236 { ::onc::cellular_apn::kAccessPointName, &kStringSignature}, |
| 227 { ::onc::cellular_apn::kName, &kStringSignature}, | 237 { ::onc::cellular_apn::kName, &kStringSignature}, |
| 228 { ::onc::cellular_apn::kUsername, &kStringSignature}, | 238 { ::onc::cellular_apn::kUsername, &kStringSignature}, |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 { ::onc::kRecommended, &kRecommendedSignature}, | 308 { ::onc::kRecommended, &kRecommendedSignature}, |
| 299 { ::onc::kRemove, &kBoolSignature}, | 309 { ::onc::kRemove, &kBoolSignature}, |
| 300 | 310 |
| 301 // Not supported, yet. | 311 // Not supported, yet. |
| 302 { ::onc::network_config::kSearchDomains, &kStringListSignature}, | 312 { ::onc::network_config::kSearchDomains, &kStringListSignature}, |
| 303 | 313 |
| 304 { ::onc::network_config::kStaticIPConfig, &kStaticIPConfigSignature}, | 314 { ::onc::network_config::kStaticIPConfig, &kStaticIPConfigSignature}, |
| 305 { ::onc::network_config::kType, &kStringSignature}, | 315 { ::onc::network_config::kType, &kStringSignature}, |
| 306 { ::onc::network_config::kVPN, &kVPNSignature}, | 316 { ::onc::network_config::kVPN, &kVPNSignature}, |
| 307 { ::onc::network_config::kWiFi, &kWiFiSignature}, | 317 { ::onc::network_config::kWiFi, &kWiFiSignature}, |
| 318 { ::onc::network_config::kWimax, &kWiMAXSignature}, |
| 308 {NULL}}; | 319 {NULL}}; |
| 309 | 320 |
| 310 const OncFieldSignature network_with_state_fields[] = { | 321 const OncFieldSignature network_with_state_fields[] = { |
| 311 { ::onc::network_config::kCellular, &kCellularWithStateSignature}, | 322 { ::onc::network_config::kCellular, &kCellularWithStateSignature}, |
| 312 { ::onc::network_config::kConnectionState, &kStringSignature}, | 323 { ::onc::network_config::kConnectionState, &kStringSignature}, |
| 313 { ::onc::network_config::kConnectable, &kBoolSignature}, | 324 { ::onc::network_config::kConnectable, &kBoolSignature}, |
| 314 { ::onc::network_config::kErrorState, &kStringSignature}, | 325 { ::onc::network_config::kErrorState, &kStringSignature}, |
| 315 { ::onc::network_config::kIPConfigs, &kIPConfigListSignature}, | 326 { ::onc::network_config::kIPConfigs, &kIPConfigListSignature}, |
| 316 { ::onc::network_config::kMacAddress, &kStringSignature}, | 327 { ::onc::network_config::kMacAddress, &kStringSignature}, |
| 317 { ::onc::network_config::kRestrictedConnectivity, &kBoolSignature}, | 328 { ::onc::network_config::kRestrictedConnectivity, &kBoolSignature}, |
| 318 { ::onc::network_config::kSavedIPConfig, &kSavedIPConfigSignature}, | 329 { ::onc::network_config::kSavedIPConfig, &kSavedIPConfigSignature}, |
| 319 { ::onc::network_config::kSource, &kStringSignature}, | 330 { ::onc::network_config::kSource, &kStringSignature}, |
| 320 { ::onc::network_config::kWiFi, &kWiFiWithStateSignature}, | 331 { ::onc::network_config::kWiFi, &kWiFiWithStateSignature}, |
| 332 { ::onc::network_config::kWimax, &kWiMAXWithStateSignature}, |
| 321 {NULL}}; | 333 {NULL}}; |
| 322 | 334 |
| 323 const OncFieldSignature global_network_configuration_fields[] = { | 335 const OncFieldSignature global_network_configuration_fields[] = { |
| 324 { ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect, | 336 { ::onc::global_network_config::kAllowOnlyPolicyNetworksToAutoconnect, |
| 325 &kBoolSignature}, | 337 &kBoolSignature}, |
| 326 {NULL}}; | 338 {NULL}}; |
| 327 | 339 |
| 328 const OncFieldSignature certificate_fields[] = { | 340 const OncFieldSignature certificate_fields[] = { |
| 329 { ::onc::certificate::kGUID, &kStringSignature}, | 341 { ::onc::certificate::kGUID, &kStringSignature}, |
| 330 { ::onc::certificate::kPKCS12, &kStringSignature}, | 342 { ::onc::certificate::kPKCS12, &kStringSignature}, |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 }; | 411 }; |
| 400 const OncValueSignature kProxyManualSignature = { | 412 const OncValueSignature kProxyManualSignature = { |
| 401 base::Value::TYPE_DICTIONARY, proxy_manual_fields, NULL | 413 base::Value::TYPE_DICTIONARY, proxy_manual_fields, NULL |
| 402 }; | 414 }; |
| 403 const OncValueSignature kProxySettingsSignature = { | 415 const OncValueSignature kProxySettingsSignature = { |
| 404 base::Value::TYPE_DICTIONARY, proxy_settings_fields, NULL | 416 base::Value::TYPE_DICTIONARY, proxy_settings_fields, NULL |
| 405 }; | 417 }; |
| 406 const OncValueSignature kWiFiSignature = { | 418 const OncValueSignature kWiFiSignature = { |
| 407 base::Value::TYPE_DICTIONARY, wifi_fields, NULL | 419 base::Value::TYPE_DICTIONARY, wifi_fields, NULL |
| 408 }; | 420 }; |
| 421 const OncValueSignature kWiMAXSignature = { |
| 422 base::Value::TYPE_DICTIONARY, wimax_fields, NULL |
| 423 }; |
| 409 const OncValueSignature kCertificateSignature = { | 424 const OncValueSignature kCertificateSignature = { |
| 410 base::Value::TYPE_DICTIONARY, certificate_fields, NULL | 425 base::Value::TYPE_DICTIONARY, certificate_fields, NULL |
| 411 }; | 426 }; |
| 412 const OncValueSignature kNetworkConfigurationSignature = { | 427 const OncValueSignature kNetworkConfigurationSignature = { |
| 413 base::Value::TYPE_DICTIONARY, network_configuration_fields, NULL | 428 base::Value::TYPE_DICTIONARY, network_configuration_fields, NULL |
| 414 }; | 429 }; |
| 415 const OncValueSignature kGlobalNetworkConfigurationSignature = { | 430 const OncValueSignature kGlobalNetworkConfigurationSignature = { |
| 416 base::Value::TYPE_DICTIONARY, global_network_configuration_fields, NULL | 431 base::Value::TYPE_DICTIONARY, global_network_configuration_fields, NULL |
| 417 }; | 432 }; |
| 418 const OncValueSignature kCertificateListSignature = { | 433 const OncValueSignature kCertificateListSignature = { |
| 419 base::Value::TYPE_LIST, NULL, &kCertificateSignature | 434 base::Value::TYPE_LIST, NULL, &kCertificateSignature |
| 420 }; | 435 }; |
| 421 const OncValueSignature kNetworkConfigurationListSignature = { | 436 const OncValueSignature kNetworkConfigurationListSignature = { |
| 422 base::Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature | 437 base::Value::TYPE_LIST, NULL, &kNetworkConfigurationSignature |
| 423 }; | 438 }; |
| 424 const OncValueSignature kToplevelConfigurationSignature = { | 439 const OncValueSignature kToplevelConfigurationSignature = { |
| 425 base::Value::TYPE_DICTIONARY, toplevel_configuration_fields, NULL | 440 base::Value::TYPE_DICTIONARY, toplevel_configuration_fields, NULL |
| 426 }; | 441 }; |
| 427 | 442 |
| 428 // Derived "ONC with State" signatures. | 443 // Derived "ONC with State" signatures. |
| 429 const OncValueSignature kNetworkWithStateSignature = { | 444 const OncValueSignature kNetworkWithStateSignature = { |
| 430 base::Value::TYPE_DICTIONARY, network_with_state_fields, NULL, | 445 base::Value::TYPE_DICTIONARY, network_with_state_fields, NULL, |
| 431 &kNetworkConfigurationSignature | 446 &kNetworkConfigurationSignature |
| 432 }; | 447 }; |
| 433 const OncValueSignature kWiFiWithStateSignature = { | 448 const OncValueSignature kWiFiWithStateSignature = { |
| 434 base::Value::TYPE_DICTIONARY, wifi_with_state_fields, NULL, &kWiFiSignature | 449 base::Value::TYPE_DICTIONARY, wifi_with_state_fields, NULL, &kWiFiSignature |
| 435 }; | 450 }; |
| 451 const OncValueSignature kWiMAXWithStateSignature = { |
| 452 base::Value::TYPE_DICTIONARY, wimax_with_state_fields, NULL, &kWiMAXSignature |
| 453 }; |
| 436 const OncValueSignature kCellularSignature = { | 454 const OncValueSignature kCellularSignature = { |
| 437 base::Value::TYPE_DICTIONARY, cellular_fields, NULL | 455 base::Value::TYPE_DICTIONARY, cellular_fields, NULL |
| 438 }; | 456 }; |
| 439 const OncValueSignature kCellularWithStateSignature = { | 457 const OncValueSignature kCellularWithStateSignature = { |
| 440 base::Value::TYPE_DICTIONARY, cellular_with_state_fields, NULL, | 458 base::Value::TYPE_DICTIONARY, cellular_with_state_fields, NULL, |
| 441 &kCellularSignature | 459 &kCellularSignature |
| 442 }; | 460 }; |
| 443 const OncValueSignature kCellularProviderSignature = { | 461 const OncValueSignature kCellularProviderSignature = { |
| 444 base::Value::TYPE_DICTIONARY, cellular_provider_fields, NULL | 462 base::Value::TYPE_DICTIONARY, cellular_provider_fields, NULL |
| 445 }; | 463 }; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 if (&signature == entry->value_signature && | 512 if (&signature == entry->value_signature && |
| 495 onc_field_name == entry->field_name) { | 513 onc_field_name == entry->field_name) { |
| 496 return true; | 514 return true; |
| 497 } | 515 } |
| 498 } | 516 } |
| 499 return false; | 517 return false; |
| 500 } | 518 } |
| 501 | 519 |
| 502 } // namespace onc | 520 } // namespace onc |
| 503 } // namespace chromeos | 521 } // namespace chromeos |
| OLD | NEW |