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

Side by Side Diff: chrome/browser/chromeos/cros/onc_network_parser.cc

Issue 8480033: CrOs: Remove 29 exit time destructors and 8 static initializers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reupload 2 Created 9 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/chromeos/cros/onc_network_parser.h" 5 #include "chrome/browser/chromeos/cros/onc_network_parser.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/json/json_value_serializer.h" 8 #include "base/json/json_value_serializer.h"
9 #include "base/stringprintf.h" 9 #include "base/stringprintf.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 28 matching lines...) Expand all
39 { "ServerCARef", PROPERTY_INDEX_EAP_CA_CERT }, 39 { "ServerCARef", PROPERTY_INDEX_EAP_CA_CERT },
40 { "ClientCARef", PROPERTY_INDEX_EAP_CLIENT_CERT }, 40 { "ClientCARef", PROPERTY_INDEX_EAP_CLIENT_CERT },
41 { "ClientCertPattern", PROPERTY_INDEX_EAP_CLIENT_CERT_PATTERN }, 41 { "ClientCertPattern", PROPERTY_INDEX_EAP_CLIENT_CERT_PATTERN },
42 { "Identity", PROPERTY_INDEX_EAP_IDENTITY }, 42 { "Identity", PROPERTY_INDEX_EAP_IDENTITY },
43 { "Password", PROPERTY_INDEX_EAP_PASSWORD }, 43 { "Password", PROPERTY_INDEX_EAP_PASSWORD },
44 { "AnonymousIdentity", PROPERTY_INDEX_EAP_ANONYMOUS_IDENTITY }, 44 { "AnonymousIdentity", PROPERTY_INDEX_EAP_ANONYMOUS_IDENTITY },
45 }; 45 };
46 46
47 // Serve the singleton mapper instance. 47 // Serve the singleton mapper instance.
48 const EnumMapper<PropertyIndex>* get_onc_mapper() { 48 const EnumMapper<PropertyIndex>* get_onc_mapper() {
49 static const EnumMapper<PropertyIndex> mapper(property_index_table, 49 CR_DEFINE_STATIC_LOCAL(const EnumMapper<PropertyIndex>, mapper,
50 arraysize(property_index_table), 50 (property_index_table,
51 PROPERTY_INDEX_UNKNOWN); 51 arraysize(property_index_table),
52 PROPERTY_INDEX_UNKNOWN));
52 return &mapper; 53 return &mapper;
53 } 54 }
54 55
55 ConnectionType ParseNetworkType(const std::string& type) { 56 ConnectionType ParseNetworkType(const std::string& type) {
56 static EnumMapper<ConnectionType>::Pair table[] = { 57 static EnumMapper<ConnectionType>::Pair table[] = {
57 { "WiFi", TYPE_WIFI }, 58 { "WiFi", TYPE_WIFI },
58 { "VPN", TYPE_VPN }, 59 { "VPN", TYPE_VPN },
59 }; 60 };
60 static EnumMapper<ConnectionType> parser( 61 CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionType>, parser,
61 table, arraysize(table), TYPE_UNKNOWN); 62 (table, arraysize(table), TYPE_UNKNOWN));
62 return parser.Get(type); 63 return parser.Get(type);
63 } 64 }
64 65
65 } // namespace 66 } // namespace
66 67
67 // -------------------- OncNetworkParser -------------------- 68 // -------------------- OncNetworkParser --------------------
68 69
69 OncNetworkParser::OncNetworkParser(const std::string& onc_blob) 70 OncNetworkParser::OncNetworkParser(const std::string& onc_blob)
70 : NetworkParser(get_onc_mapper()), 71 : NetworkParser(get_onc_mapper()),
71 network_configs_(NULL), 72 network_configs_(NULL),
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 } 463 }
463 464
464 ConnectionSecurity OncWifiNetworkParser::ParseSecurity( 465 ConnectionSecurity OncWifiNetworkParser::ParseSecurity(
465 const std::string& security) { 466 const std::string& security) {
466 static EnumMapper<ConnectionSecurity>::Pair table[] = { 467 static EnumMapper<ConnectionSecurity>::Pair table[] = {
467 { "None", SECURITY_NONE }, 468 { "None", SECURITY_NONE },
468 { "WEP", SECURITY_WEP }, 469 { "WEP", SECURITY_WEP },
469 { "WPA", SECURITY_WPA }, 470 { "WPA", SECURITY_WPA },
470 { "WPA2", SECURITY_8021X }, 471 { "WPA2", SECURITY_8021X },
471 }; 472 };
472 static EnumMapper<ConnectionSecurity> parser( 473 CR_DEFINE_STATIC_LOCAL(EnumMapper<ConnectionSecurity>, parser,
473 table, arraysize(table), SECURITY_UNKNOWN); 474 (table, arraysize(table), SECURITY_UNKNOWN));
474 return parser.Get(security); 475 return parser.Get(security);
475 } 476 }
476 477
477 EAPMethod OncWifiNetworkParser::ParseEAPMethod(const std::string& method) { 478 EAPMethod OncWifiNetworkParser::ParseEAPMethod(const std::string& method) {
478 static EnumMapper<EAPMethod>::Pair table[] = { 479 static EnumMapper<EAPMethod>::Pair table[] = {
479 { "PEAP", EAP_METHOD_PEAP }, 480 { "PEAP", EAP_METHOD_PEAP },
480 { "EAP-TLS", EAP_METHOD_TLS }, 481 { "EAP-TLS", EAP_METHOD_TLS },
481 { "EAP-TTLS", EAP_METHOD_TTLS }, 482 { "EAP-TTLS", EAP_METHOD_TTLS },
482 { "LEAP", EAP_METHOD_LEAP }, 483 { "LEAP", EAP_METHOD_LEAP },
483 }; 484 };
484 static EnumMapper<EAPMethod> parser( 485 CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPMethod>, parser,
485 table, arraysize(table), EAP_METHOD_UNKNOWN); 486 (table, arraysize(table), EAP_METHOD_UNKNOWN));
486 return parser.Get(method); 487 return parser.Get(method);
487 } 488 }
488 489
489 EAPPhase2Auth OncWifiNetworkParser::ParseEAPPhase2Auth( 490 EAPPhase2Auth OncWifiNetworkParser::ParseEAPPhase2Auth(
490 const std::string& auth) { 491 const std::string& auth) {
491 static EnumMapper<EAPPhase2Auth>::Pair table[] = { 492 static EnumMapper<EAPPhase2Auth>::Pair table[] = {
492 { "MD5", EAP_PHASE_2_AUTH_MD5 }, 493 { "MD5", EAP_PHASE_2_AUTH_MD5 },
493 { "MSCHAPV2", EAP_PHASE_2_AUTH_MSCHAPV2 }, 494 { "MSCHAPV2", EAP_PHASE_2_AUTH_MSCHAPV2 },
494 { "MSCHAP", EAP_PHASE_2_AUTH_MSCHAP }, 495 { "MSCHAP", EAP_PHASE_2_AUTH_MSCHAP },
495 { "PAP", EAP_PHASE_2_AUTH_PAP }, 496 { "PAP", EAP_PHASE_2_AUTH_PAP },
496 }; 497 };
497 static EnumMapper<EAPPhase2Auth> parser( 498 CR_DEFINE_STATIC_LOCAL(EnumMapper<EAPPhase2Auth>, parser,
498 table, arraysize(table), EAP_PHASE_2_AUTH_AUTO); 499 (table, arraysize(table), EAP_PHASE_2_AUTH_AUTO));
499 return parser.Get(auth); 500 return parser.Get(auth);
500 } 501 }
501 502
502 // -------------------- OncVirtualNetworkParser -------------------- 503 // -------------------- OncVirtualNetworkParser --------------------
503 504
504 505
505 OncVirtualNetworkParser::OncVirtualNetworkParser() {} 506 OncVirtualNetworkParser::OncVirtualNetworkParser() {}
506 OncVirtualNetworkParser::~OncVirtualNetworkParser() {} 507 OncVirtualNetworkParser::~OncVirtualNetworkParser() {}
507 508
508 bool OncVirtualNetworkParser::UpdateNetworkFromInfo( 509 bool OncVirtualNetworkParser::UpdateNetworkFromInfo(
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 } 627 }
627 return false; 628 return false;
628 } 629 }
629 630
630 ProviderType OncVirtualNetworkParser::ParseProviderType( 631 ProviderType OncVirtualNetworkParser::ParseProviderType(
631 const std::string& type) { 632 const std::string& type) {
632 static EnumMapper<ProviderType>::Pair table[] = { 633 static EnumMapper<ProviderType>::Pair table[] = {
633 { flimflam::kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK }, 634 { flimflam::kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK },
634 { flimflam::kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN }, 635 { flimflam::kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN },
635 }; 636 };
636 static EnumMapper<ProviderType> parser( 637 CR_DEFINE_STATIC_LOCAL(EnumMapper<ProviderType>, parser,
637 table, arraysize(table), PROVIDER_TYPE_MAX); 638 (table, arraysize(table), PROVIDER_TYPE_MAX));
638 return parser.Get(type); 639 return parser.Get(type);
639 } 640 }
640 641
641 } // namespace chromeos 642 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/cros/network_library.cc ('k') | chrome/browser/chromeos/dbus/power_manager_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698