diff options
author | stevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-02 20:51:23 +0000 |
---|---|---|
committer | stevenjb@google.com <stevenjb@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-02 20:51:23 +0000 |
commit | f3f2697b2ecb1d64be812e0f6e9c292b47def858 (patch) | |
tree | cba69c53b4e23bab26e2fc7604c2067e035629e1 /chrome | |
parent | 1d14f58b753c59924cef2f5bb4a0f1cb88db07d5 (diff) | |
download | chromium_src-f3f2697b2ecb1d64be812e0f6e9c292b47def858.zip chromium_src-f3f2697b2ecb1d64be812e0f6e9c292b47def858.tar.gz chromium_src-f3f2697b2ecb1d64be812e0f6e9c292b47def858.tar.bz2 |
Update network library code to use service_constants.h
I reverted some of the capitialization changes to be consistent with existing entries in service_constants.h that are being used by shill.
BUG=none
TEST=Chrome compiles
Review URL: http://codereview.chromium.org/7826024
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99448 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_constants.cc | 287 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_constants.h | 250 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/native_network_parser.cc | 400 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros/network_library.cc | 162 |
4 files changed, 320 insertions, 779 deletions
diff --git a/chrome/browser/chromeos/cros/native_network_constants.cc b/chrome/browser/chromeos/cros/native_network_constants.cc index e830a2f..29577f0 100644 --- a/chrome/browser/chromeos/cros/native_network_constants.cc +++ b/chrome/browser/chromeos/cros/native_network_constants.cc @@ -3,319 +3,70 @@ // found in the LICENSE file. #include "chrome/browser/chromeos/cros/native_network_constants.h" +#include "third_party/cros_system_api/dbus/service_constants.h" namespace chromeos { + // Format of the Carrier ID: <carrier name> (<carrier country>). const char kCarrierIdFormat[] = "%s (%s)"; // Path of the default (shared) flimflam profile. const char kSharedProfilePath[] = "/profile/default"; -// D-Bus interface string constants. - -// Flimflam manager properties. -const char kAvailableTechnologiesProperty[] = "AvailableTechnologies"; -const char kEnabledTechnologiesProperty[] = "EnabledTechnologies"; -const char kConnectedTechnologiesProperty[] = "ConnectedTechnologies"; -const char kDefaultTechnologyProperty[] = "DefaultTechnology"; -const char kOfflineModeProperty[] = "OfflineMode"; -const char kActiveProfileProperty[] = "ActiveProfile"; -const char kProfilesProperty[] = "Profiles"; -const char kServicesProperty[] = "Services"; -const char kServiceWatchListProperty[] = "ServiceWatchList"; -const char kDevicesProperty[] = "Devices"; -const char kPortalUrlProperty[] = "PortalURL"; -const char kCheckPortalListProperty[] = "CheckPortalList"; -const char kArpGatewayProperty[] = "ArpGateway"; - -// Flimflam service properties. -const char kSecurityProperty[] = "Security"; -const char kPassphraseProperty[] = "Passphrase"; -const char kIdentityProperty[] = "Identity"; -const char kPassphraseRequiredProperty[] = "PassphraseRequired"; -const char kSaveCredentialsProperty[] = "SaveCredentials"; -const char kSignalStrengthProperty[] = "Strength"; -const char kNameProperty[] = "Name"; -const char kGuidProperty[] = "GUID"; -const char kStateProperty[] = "State"; -const char kTypeProperty[] = "Type"; -const char kDeviceProperty[] = "Device"; -const char kProfileProperty[] = "Profile"; -const char kTechnologyFamilyProperty[] = "Cellular.Family"; -const char kActivationStateProperty[] = "Cellular.ActivationState"; -const char kNetworkTechnologyProperty[] = "Cellular.NetworkTechnology"; -const char kRoamingStateProperty[] = "Cellular.RoamingState"; -const char kOperatorNameProperty[] = "Cellular.OperatorName"; -const char kOperatorCodeProperty[] = "Cellular.OperatorCode"; -const char kServingOperatorProperty[] = "Cellular.ServingOperator"; -const char kPaymentUrlProperty[] = "Cellular.OlpUrl"; -const char kUsageUrlProperty[] = "Cellular.UsageUrl"; -const char kCellularApnProperty[] = "Cellular.APN"; -const char kCellularLastGoodApnProperty[] = "Cellular.LastGoodAPN"; -const char kCellularApnListProperty[] = "Cellular.APNList"; -const char kWifiHexSsid[] = "WiFi.HexSSID"; -const char kWifiFrequency[] = "WiFi.Frequency"; -const char kWifiHiddenSsid[] = "WiFi.HiddenSSID"; -const char kWifiPhyMode[] = "WiFi.PhyMode"; -const char kWifiAuthMode[] = "WiFi.AuthMode"; -const char kFavoriteProperty[] = "Favorite"; -const char kConnectableProperty[] = "Connectable"; -const char kPriorityProperty[] = "Priority"; -const char kAutoConnectProperty[] = "AutoConnect"; -const char kIsActiveProperty[] = "IsActive"; -const char kModeProperty[] = "Mode"; -const char kErrorProperty[] = "Error"; -const char kEntriesProperty[] = "Entries"; -const char kProviderProperty[] = "Provider"; -const char kHostProperty[] = "Host"; -const char kProxyConfigProperty[] = "ProxyConfig"; - -// Flimflam property names for SIMLock status. -const char kSimLockStatusProperty[] = "Cellular.SIMLockStatus"; -const char kSimLockTypeProperty[] = "LockType"; -const char kSimLockRetriesLeftProperty[] = "RetriesLeft"; - -// Flimflam property names for Cellular.FoundNetworks. -const char kLongNameProperty[] = "long_name"; -const char kStatusProperty[] = "status"; -const char kShortNameProperty[] = "short_name"; -const char kTechnologyProperty[] = "technology"; -const char kNetworkIdProperty[] = "network_id"; - -// Flimflam SIMLock status types. -const char kSimLockPin[] = "sim-pin"; -const char kSimLockPuk[] = "sim-puk"; - -// APN info property names. -const char kApnProperty[] = "apn"; -const char kApnNetworkIdProperty[] = "network_id"; -const char kApnUsernameProperty[] = "username"; -const char kApnPasswordProperty[] = "password"; -const char kApnNameProperty[] = "name"; -const char kApnLocalizedNameProperty[] = "localized_name"; -const char kApnLanguageProperty[] = "language"; - -// Operator info property names. -const char kOperatorNameKey[] = "name"; -const char kOperatorCodeKey[] = "code"; -const char kOperatorCountryKey[] = "country"; - -// Flimflam device info property names. -const char kScanningProperty[] = "Scanning"; -const char kPoweredProperty[] = "Powered"; -const char kNetworksProperty[] = "Networks"; -const char kCarrierProperty[] = "Cellular.Carrier"; -const char kCellularAllowRoamingProperty[] = "Cellular.AllowRoaming"; -const char kHomeProviderProperty[] = "Cellular.HomeProvider"; -const char kMeidProperty[] = "Cellular.MEID"; -const char kImeiProperty[] = "Cellular.IMEI"; -const char kImsiProperty[] = "Cellular.IMSI"; -const char kEsnProperty[] = "Cellular.ESN"; -const char kMdnProperty[] = "Cellular.MDN"; -const char kMinProperty[] = "Cellular.MIN"; -const char kModelIdProperty[] = "Cellular.ModelID"; -const char kManufacturerProperty[] = "Cellular.Manufacturer"; -const char kFirmwareRevisionProperty[] = "Cellular.FirmwareRevision"; -const char kHardwareRevisionProperty[] = "Cellular.HardwareRevision"; -const char kPrlVersionProperty[] = "Cellular.PRLVersion"; // (INT16) -const char kSelectedNetworkProperty[] = "Cellular.SelectedNetwork"; -const char kSupportNetworkScanProperty[] = "Cellular.SupportNetworkScan"; -const char kFoundNetworksProperty[] = "Cellular.FoundNetworks"; - -// Flimflam ip config property names. -const char kAddressProperty[] = "Address"; -const char kPrefixlenProperty[] = "Prefixlen"; -const char kGatewayProperty[] = "Gateway"; -const char kNameServersProperty[] = "NameServers"; - -// Flimflam type options. -const char kTypeEthernet[] = "ethernet"; -const char kTypeWifi[] = "wifi"; -const char kTypeWimax[] = "wimax"; -const char kTypeBluetooth[] = "bluetooth"; -const char kTypeCellular[] = "cellular"; -const char kTypeVpn[] = "vpn"; - -// Flimflam mode options. -const char kModeManaged[] = "managed"; -const char kModeAdhoc[] = "adhoc"; - -// Flimflam security options. -const char kSecurityWpa[] = "wpa"; -const char kSecurityWep[] = "wep"; -const char kSecurityRsn[] = "rsn"; -const char kSecurity8021x[] = "802_1x"; -const char kSecurityPsk[] = "psk"; -const char kSecurityNone[] = "none"; - -// Flimflam L2TPIPsec property names. -const char kL2tpIpsecCaCertNssProperty[] = "L2TPIPsec.CACertNSS"; -const char kL2tpIpsecClientCertIdProperty[] = "L2TPIPsec.ClientCertID"; -const char kL2tpIpsecClientCertSlotProp[] = "L2TPIPsec.ClientCertSlot"; -const char kL2tpIpsecPinProperty[] = "L2TPIPsec.PIN"; -const char kL2tpIpsecPskProperty[] = "L2TPIPsec.PSK"; -const char kL2tpIpsecUserProperty[] = "L2TPIPsec.User"; -const char kL2tpIpsecPasswordProperty[] = "L2TPIPsec.Password"; - -// Flimflam EAP property names. -// See src/third_party/flimflam/doc/service-api.txt. -const char kEapIdentityProperty[] = "EAP.Identity"; -const char kEapMethodProperty[] = "EAP.EAP"; -const char kEapPhase2AuthProperty[] = "EAP.InnerEAP"; -const char kEapAnonymousIdentityProperty[] = "EAP.AnonymousIdentity"; -const char kEapClientCertProperty[] = "EAP.ClientCert"; // path -const char kEapCertIdProperty[] = "EAP.CertID"; // PKCS#11 ID -const char kEapClientCertNssProperty[] = "EAP.ClientCertNSS"; // NSS nickname -const char kEapPrivateKeyProperty[] = "EAP.PrivateKey"; -const char kEapPrivateKeyPasswordProperty[] = "EAP.PrivateKeyPassword"; -const char kEapKeyIdProperty[] = "EAP.KeyID"; -const char kEapCaCertProperty[] = "EAP.CACert"; // server CA cert path -const char kEapCaCertIdProperty[] = "EAP.CACertID"; // server CA PKCS#11 ID -const char kEapCaCertNssProperty[] = "EAP.CACertNSS"; // server CA NSS nickname -const char kEapUseSystemCasProperty[] = "EAP.UseSystemCAs"; -const char kEapPinProperty[] = "EAP.PIN"; -const char kEapPasswordProperty[] = "EAP.Password"; -const char kEapKeyMgmtProperty[] = "EAP.KeyMgmt"; - -// Flimflam EAP method options. -const char kEapMethodPeap[] = "PEAP"; -const char kEapMethodTls[] = "TLS"; -const char kEapMethodTtls[] = "TTLS"; -const char kEapMethodLeap[] = "LEAP"; - -// Flimflam EAP phase 2 auth options. -const char kEapPhase2AuthPeapMd5[] = "auth=MD5"; -const char kEapPhase2AuthPeapMschap2[] = "auth=MSCHAPV2"; -const char kEapPhase2AuthTtlsMd5[] = "autheap=MD5"; -const char kEapPhase2AuthTtlsMschapV2[] = "autheap=MSCHAPV2"; -const char kEapPhase2AuthTtlsMschap[] = "autheap=MSCHAP"; -const char kEapPhase2AuthTtlsPap[] = "autheap=PAP"; -const char kEapPhase2AuthTtlsChap[] = "autheap=CHAP"; - -// Flimflam VPN provider types. -const char kProviderL2tpIpsec[] = "l2tpipsec"; -const char kProviderOpenVpn[] = "openvpn"; - -// Flimflam state options. -const char kStateIdle[] = "idle"; -const char kStateCarrier[] = "carrier"; -const char kStateAssociation[] = "association"; -const char kStateConfiguration[] = "configuration"; -const char kStateReady[] = "ready"; -const char kStatePortal[] = "portal"; -const char kStateOnline[] = "online"; -const char kStateDisconnect[] = "disconnect"; -const char kStateFailure[] = "failure"; -const char kStateActivationFailure[] = "activation-failure"; - -// Flimflam network technology options. -const char kNetworkTechnology1Xrtt[] = "1xRTT"; -const char kNetworkTechnologyEvdo[] = "EVDO"; -const char kNetworkTechnologyGprs[] = "GPRS"; -const char kNetworkTechnologyEdge[] = "EDGE"; -const char kNetworkTechnologyUmts[] = "UMTS"; -const char kNetworkTechnologyHspa[] = "HSPA"; -const char kNetworkTechnologyHspaPlus[] = "HSPA+"; -const char kNetworkTechnologyLte[] = "LTE"; -const char kNetworkTechnologyLteAdvanced[] = "LTE Advanced"; -const char kNetworkTechnologyGsm[] = "GSM"; - -// Flimflam roaming state options -const char kRoamingStateHome[] = "home"; -const char kRoamingStateRoaming[] = "roaming"; -const char kRoamingStateUnknown[] = "unknown"; - -// Flimflam activation state options -const char kActivationStateActivated[] = "activated"; -const char kActivationStateActivating[] = "activating"; -const char kActivationStateNotActivated[] = "not-activated"; -const char kActivationStatePartiallyActivated[] = "partially-activated"; -const char kActivationStateUnknown[] = "unknown"; - -// FlimFlam technology family options -const char kTechnologyFamilyCdma[] = "CDMA"; -const char kTechnologyFamilyGsm[] = "GSM"; - -// Flimflam error options. -const char kErrorOutOfRange[] = "out-of-range"; -const char kErrorPinMissing[] = "pin-missing"; -const char kErrorDhcpFailed[] = "dhcp-failed"; -const char kErrorConnectFailed[] = "connect-failed"; -const char kErrorBadPassphrase[] = "bad-passphrase"; -const char kErrorBadWepKey[] = "bad-wepkey"; -const char kErrorActivationFailed[] = "activation-failed"; -const char kErrorNeedEvdo[] = "need-evdo"; -const char kErrorNeedHomeNetwork[] = "need-home-network"; -const char kErrorOtaspFailed[] = "otasp-failed"; -const char kErrorAaaFailed[] = "aaa-failed"; -const char kErrorInternal[] = "internal-error"; -const char kErrorDnsLookupFailed[] = "dns-lookup-failed"; -const char kErrorHttpGetFailed[] = "http-get-failed"; - -// Flimflam error messages. -const char kErrorPassphraseRequiredMsg[] = "Passphrase required"; -const char kErrorIncorrectPinMsg[] = "org.chromium.flimflam.Error.IncorrectPin"; -const char kErrorPinBlockedMsg[] = "org.chromium.flimflam.Error.PinBlocked"; -const char kErrorPinRequiredMsg[] = "org.chromium.flimflam.Error.PinRequired"; - -const char kUnknownString[] = "UNKNOWN"; - -//////////////////////////////////////////////////////////////////////////// - const char* ConnectionTypeToString(ConnectionType type) { switch (type) { case TYPE_UNKNOWN: break; case TYPE_ETHERNET: - return kTypeEthernet; + return flimflam::kTypeEthernet; case TYPE_WIFI: - return kTypeWifi; + return flimflam::kTypeWifi; case TYPE_WIMAX: - return kTypeWimax; + return flimflam::kTypeWimax; case TYPE_BLUETOOTH: - return kTypeBluetooth; + return flimflam::kTypeBluetooth; case TYPE_CELLULAR: - return kTypeCellular; + return flimflam::kTypeCellular; case TYPE_VPN: - return kTypeVpn; + return flimflam::kTypeVPN; } LOG(ERROR) << "ConnectionTypeToString called with unknown type: " << type; - return kUnknownString; + return flimflam::kUnknownString; } const char* SecurityToString(ConnectionSecurity security) { switch (security) { case SECURITY_NONE: - return kSecurityNone; + return flimflam::kSecurityNone; case SECURITY_WEP: - return kSecurityWep; + return flimflam::kSecurityWep; case SECURITY_WPA: - return kSecurityWpa; + return flimflam::kSecurityWpa; case SECURITY_RSN: - return kSecurityRsn; + return flimflam::kSecurityRsn; case SECURITY_8021X: - return kSecurity8021x; + return flimflam::kSecurity8021x; case SECURITY_PSK: - return kSecurityPsk; + return flimflam::kSecurityPsk; case SECURITY_UNKNOWN: break; } LOG(ERROR) << "SecurityToString called with unknown type: " << security; - return kUnknownString; + return flimflam::kUnknownString; } const char* ProviderTypeToString(ProviderType type) { switch (type) { case PROVIDER_TYPE_L2TP_IPSEC_PSK: case PROVIDER_TYPE_L2TP_IPSEC_USER_CERT: - return kProviderL2tpIpsec; + return flimflam::kProviderL2tpIpsec; case PROVIDER_TYPE_OPEN_VPN: - return kProviderOpenVpn; + return flimflam::kProviderOpenVpn; case PROVIDER_TYPE_MAX: break; } LOG(ERROR) << "ProviderTypeToString called with unknown type: " << type; - return kUnknownString; + return flimflam::kUnknownString; } } // namespace chromeos diff --git a/chrome/browser/chromeos/cros/native_network_constants.h b/chrome/browser/chromeos/cros/native_network_constants.h index 990fa59..bbde941 100644 --- a/chrome/browser/chromeos/cros/native_network_constants.h +++ b/chrome/browser/chromeos/cros/native_network_constants.h @@ -18,256 +18,6 @@ extern const char kCarrierIdFormat[]; // Path of the default (shared) flimflam profile. extern const char kSharedProfilePath[]; -// D-Bus interface string constants, used in both the native parsing -// and network library code. - -// Flimflam manager properties. -extern const char kAvailableTechnologiesProperty[]; -extern const char kEnabledTechnologiesProperty[]; -extern const char kConnectedTechnologiesProperty[]; -extern const char kDefaultTechnologyProperty[]; -extern const char kOfflineModeProperty[]; -extern const char kActiveProfileProperty[]; -extern const char kProfilesProperty[]; -extern const char kServicesProperty[]; -extern const char kServiceWatchListProperty[]; -extern const char kDevicesProperty[]; -extern const char kPortalUrlProperty[]; -extern const char kCheckPortalListProperty[]; -extern const char kArpGatewayProperty[]; - -// Flimflam service properties. -extern const char kSecurityProperty[]; -extern const char kPassphraseProperty[]; -extern const char kIdentityProperty[]; -extern const char kPassphraseRequiredProperty[]; -extern const char kSaveCredentialsProperty[]; -extern const char kSignalStrengthProperty[]; -extern const char kNameProperty[]; -extern const char kGuidProperty[]; -extern const char kStateProperty[]; -extern const char kTypeProperty[]; -extern const char kDeviceProperty[]; -extern const char kProfileProperty[]; -extern const char kTechnologyFamilyProperty[]; -extern const char kActivationStateProperty[]; -extern const char kNetworkTechnologyProperty[]; -extern const char kRoamingStateProperty[]; -extern const char kOperatorNameProperty[]; -extern const char kOperatorCodeProperty[]; -extern const char kServingOperatorProperty[]; -extern const char kPaymentUrlProperty[]; -extern const char kUsageUrlProperty[]; -extern const char kCellularApnProperty[]; -extern const char kCellularLastGoodApnProperty[]; -extern const char kCellularApnListProperty[]; -extern const char kWifiHexSsid[]; -extern const char kWifiFrequency[]; -extern const char kWifiHiddenSsid[]; -extern const char kWifiPhyMode[]; -extern const char kWifiAuthMode[]; -extern const char kFavoriteProperty[]; -extern const char kConnectableProperty[]; -extern const char kPriorityProperty[]; -extern const char kAutoConnectProperty[]; -extern const char kIsActiveProperty[]; -extern const char kModeProperty[]; -extern const char kErrorProperty[]; -extern const char kEntriesProperty[]; -extern const char kProviderProperty[]; -extern const char kHostProperty[]; -extern const char kProxyConfigProperty[]; - -// Flimflam property names for SIMLock status. -extern const char kSimLockStatusProperty[]; -extern const char kSimLockTypeProperty[]; -extern const char kSimLockRetriesLeftProperty[]; - -// Flimflam property names for Cellular.FoundNetworks. -extern const char kLongNameProperty[]; -extern const char kStatusProperty[]; -extern const char kShortNameProperty[]; -extern const char kTechnologyProperty[]; -extern const char kNetworkIdProperty[]; - -// Flimflam SIMLock status types. -extern const char kSimLockPin[]; -extern const char kSimLockPuk[]; - -// APN info property names. -extern const char kApnProperty[]; -extern const char kApnNetworkIdProperty[]; -extern const char kApnUsernameProperty[]; -extern const char kApnPasswordProperty[]; -extern const char kApnNameProperty[]; -extern const char kApnLocalizedNameProperty[]; -extern const char kApnLanguageProperty[]; - -// Operator info property names. -extern const char kOperatorNameKey[]; -extern const char kOperatorCodeKey[]; -extern const char kOperatorCountryKey[]; - -// Flimflam device info property names. -extern const char kScanningProperty[]; -extern const char kPoweredProperty[]; -extern const char kNetworksProperty[]; -extern const char kCarrierProperty[]; -extern const char kCellularAllowRoamingProperty[]; -extern const char kHomeProviderProperty[]; -extern const char kMeidProperty[]; -extern const char kImeiProperty[]; -extern const char kImsiProperty[]; -extern const char kEsnProperty[]; -extern const char kMdnProperty[]; -extern const char kMinProperty[]; -extern const char kModelIdProperty[]; -extern const char kManufacturerProperty[]; -extern const char kFirmwareRevisionProperty[]; -extern const char kHardwareRevisionProperty[]; -extern const char kPrlVersionProperty[]; // (INT16) -extern const char kSelectedNetworkProperty[]; -extern const char kSupportNetworkScanProperty[]; -extern const char kFoundNetworksProperty[]; - -// Flimflam ip config property names. -extern const char kAddressProperty[]; -extern const char kPrefixlenProperty[]; -extern const char kGatewayProperty[]; -extern const char kNameServersProperty[]; - -// Flimflam type options. -extern const char kTypeEthernet[]; -extern const char kTypeWifi[]; -extern const char kTypeWimax[]; -extern const char kTypeBluetooth[]; -extern const char kTypeCellular[]; -extern const char kTypeVpn[]; - -// Flimflam mode options. -extern const char kModeManaged[]; -extern const char kModeAdhoc[]; - -// Flimflam security options. -extern const char kSecurityWpa[]; -extern const char kSecurityWep[]; -extern const char kSecurityRsn[]; -extern const char kSecurity8021x[]; -extern const char kSecurityPsk[]; -extern const char kSecurityNone[]; - -// Flimflam L2TPIPsec property names. -extern const char kL2tpIpsecCaCertNssProperty[]; -extern const char kL2tpIpsecClientCertIdProperty[]; -extern const char kL2tpIpsecClientCertSlotProp[]; -extern const char kL2tpIpsecPinProperty[]; -extern const char kL2tpIpsecPskProperty[]; -extern const char kL2tpIpsecUserProperty[]; -extern const char kL2tpIpsecPasswordProperty[]; - -// Flimflam EAP property names. -// See src/third_party/flimflam/doc/service-api.txt. -extern const char kEapIdentityProperty[]; -extern const char kEapMethodProperty[]; -extern const char kEapPhase2AuthProperty[]; -extern const char kEapAnonymousIdentityProperty[]; -extern const char kEapClientCertProperty[]; // path -extern const char kEapCertIdProperty[]; // PKCS#11 ID -extern const char kEapClientCertNssProperty[]; // NSS nickname -extern const char kEapPrivateKeyProperty[]; -extern const char kEapPrivateKeyPasswordProperty[]; -extern const char kEapKeyIdProperty[]; -extern const char kEapCaCertProperty[]; // server CA cert path -extern const char kEapCaCertIdProperty[]; // server CA PKCS#11 ID -extern const char kEapCaCertNssProperty[]; // server CA NSS nickname -extern const char kEapUseSystemCasProperty[]; -extern const char kEapPinProperty[]; -extern const char kEapPasswordProperty[]; -extern const char kEapKeyMgmtProperty[]; - -// Flimflam EAP method options. -extern const char kEapMethodPeap[]; -extern const char kEapMethodTls[]; -extern const char kEapMethodTtls[]; -extern const char kEapMethodLeap[]; - -// Flimflam EAP phase 2 auth options. -extern const char kEapPhase2AuthPeapMd5[]; -extern const char kEapPhase2AuthPeapMschap2[]; -extern const char kEapPhase2AuthTtlsMd5[]; -extern const char kEapPhase2AuthTtlsMschapV2[]; -extern const char kEapPhase2AuthTtlsMschap[]; -extern const char kEapPhase2AuthTtlsPap[]; -extern const char kEapPhase2AuthTtlsChap[]; - -// Flimflam VPN provider types. -extern const char kProviderL2tpIpsec[]; -extern const char kProviderOpenVpn[]; - -// Flimflam state options. -extern const char kStateIdle[]; -extern const char kStateCarrier[]; -extern const char kStateAssociation[]; -extern const char kStateConfiguration[]; -extern const char kStateReady[]; -extern const char kStatePortal[]; -extern const char kStateOnline[]; -extern const char kStateDisconnect[]; -extern const char kStateFailure[]; -extern const char kStateActivationFailure[]; - -// Flimflam network technology options. -extern const char kNetworkTechnology1Xrtt[]; -extern const char kNetworkTechnologyEvdo[]; -extern const char kNetworkTechnologyGprs[]; -extern const char kNetworkTechnologyEdge[]; -extern const char kNetworkTechnologyUmts[]; -extern const char kNetworkTechnologyHspa[]; -extern const char kNetworkTechnologyHspaPlus[]; -extern const char kNetworkTechnologyLte[]; -extern const char kNetworkTechnologyLteAdvanced[]; -extern const char kNetworkTechnologyGsm[]; - -// Flimflam roaming state options -extern const char kRoamingStateHome[]; -extern const char kRoamingStateRoaming[]; -extern const char kRoamingStateUnknown[]; - -// Flimflam activation state options -extern const char kActivationStateActivated[]; -extern const char kActivationStateActivating[]; -extern const char kActivationStateNotActivated[]; -extern const char kActivationStatePartiallyActivated[]; -extern const char kActivationStateUnknown[]; - -// FlimFlam technology family options -extern const char kTechnologyFamilyCdma[]; -extern const char kTechnologyFamilyGsm[]; - -// Flimflam error options. -extern const char kErrorOutOfRange[]; -extern const char kErrorPinMissing[]; -extern const char kErrorDhcpFailed[]; -extern const char kErrorConnectFailed[]; -extern const char kErrorBadPassphrase[]; -extern const char kErrorBadWepKey[]; -extern const char kErrorActivationFailed[]; -extern const char kErrorNeedEvdo[]; -extern const char kErrorNeedHomeNetwork[]; -extern const char kErrorOtaspFailed[]; -extern const char kErrorAaaFailed[]; -extern const char kErrorInternal[]; -extern const char kErrorDnsLookupFailed[]; -extern const char kErrorHttpGetFailed[]; - -// Flimflam error messages. -extern const char kErrorPassphraseRequiredMsg[]; -extern const char kErrorIncorrectPinMsg[]; -extern const char kErrorPinBlockedMsg[]; -extern const char kErrorPinRequiredMsg[]; - -extern const char kUnknownString[]; - extern const char* ConnectionTypeToString(ConnectionType type); extern const char* SecurityToString(ConnectionSecurity security); extern const char* ProviderTypeToString(ProviderType type); diff --git a/chrome/browser/chromeos/cros/native_network_parser.cc b/chrome/browser/chromeos/cros/native_network_parser.cc index 3172025..fd8df5e 100644 --- a/chrome/browser/chromeos/cros/native_network_parser.cc +++ b/chrome/browser/chromeos/cros/native_network_parser.cc @@ -8,6 +8,7 @@ #include "chrome/browser/chromeos/cros/native_network_constants.h" #include "chrome/browser/chromeos/cros/network_library.h" #include "chrome/browser/chromeos/login/user_manager.h" +#include "third_party/cros_system_api/dbus/service_constants.h" namespace chromeos { @@ -15,103 +16,114 @@ namespace chromeos { namespace { EnumMapper<PropertyIndex>::Pair property_index_table[] = { - { kActivationStateProperty, PROPERTY_INDEX_ACTIVATION_STATE }, - { kActiveProfileProperty, PROPERTY_INDEX_ACTIVE_PROFILE }, - { kArpGatewayProperty, PROPERTY_INDEX_ARP_GATEWAY }, - { kAutoConnectProperty, PROPERTY_INDEX_AUTO_CONNECT }, - { kAvailableTechnologiesProperty, PROPERTY_INDEX_AVAILABLE_TECHNOLOGIES }, - { kCarrierProperty, PROPERTY_INDEX_CARRIER }, - { kCellularAllowRoamingProperty, PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING }, - { kCellularApnListProperty, PROPERTY_INDEX_CELLULAR_APN_LIST }, - { kCellularApnProperty, PROPERTY_INDEX_CELLULAR_APN }, - { kCellularLastGoodApnProperty, PROPERTY_INDEX_CELLULAR_LAST_GOOD_APN }, - { kCheckPortalListProperty, PROPERTY_INDEX_CHECK_PORTAL_LIST }, - { kConnectableProperty, PROPERTY_INDEX_CONNECTABLE }, - { kConnectedTechnologiesProperty, PROPERTY_INDEX_CONNECTED_TECHNOLOGIES }, - { kDefaultTechnologyProperty, PROPERTY_INDEX_DEFAULT_TECHNOLOGY }, - { kDeviceProperty, PROPERTY_INDEX_DEVICE }, - { kDevicesProperty, PROPERTY_INDEX_DEVICES }, - { kEapAnonymousIdentityProperty, PROPERTY_INDEX_EAP_ANONYMOUS_IDENTITY }, - { kEapCaCertIdProperty, PROPERTY_INDEX_EAP_CA_CERT_ID }, - { kEapCaCertNssProperty, PROPERTY_INDEX_EAP_CA_CERT_NSS }, - { kEapCaCertProperty, PROPERTY_INDEX_EAP_CA_CERT }, - { kEapCertIdProperty, PROPERTY_INDEX_EAP_CERT_ID }, - { kEapClientCertNssProperty, PROPERTY_INDEX_EAP_CLIENT_CERT_NSS }, - { kEapClientCertProperty, PROPERTY_INDEX_EAP_CLIENT_CERT }, - { kEapIdentityProperty, PROPERTY_INDEX_EAP_IDENTITY }, - { kEapKeyIdProperty, PROPERTY_INDEX_EAP_KEY_ID }, - { kEapKeyMgmtProperty, PROPERTY_INDEX_EAP_KEY_MGMT }, - { kEapMethodProperty, PROPERTY_INDEX_EAP_METHOD }, - { kEapPasswordProperty, PROPERTY_INDEX_EAP_PASSWORD }, - { kEapPhase2AuthProperty, PROPERTY_INDEX_EAP_PHASE_2_AUTH }, - { kEapPinProperty, PROPERTY_INDEX_EAP_PIN }, - { kEapPrivateKeyPasswordProperty, PROPERTY_INDEX_EAP_PRIVATE_KEY_PASSWORD }, - { kEapPrivateKeyProperty, PROPERTY_INDEX_EAP_PRIVATE_KEY }, - { kEapUseSystemCasProperty, PROPERTY_INDEX_EAP_USE_SYSTEM_CAS }, - { kEnabledTechnologiesProperty, PROPERTY_INDEX_ENABLED_TECHNOLOGIES }, - { kErrorProperty, PROPERTY_INDEX_ERROR }, - { kEsnProperty, PROPERTY_INDEX_ESN }, - { kFavoriteProperty, PROPERTY_INDEX_FAVORITE }, - { kFirmwareRevisionProperty, PROPERTY_INDEX_FIRMWARE_REVISION }, - { kFoundNetworksProperty, PROPERTY_INDEX_FOUND_NETWORKS }, - { kGuidProperty, PROPERTY_INDEX_GUID }, - { kHardwareRevisionProperty, PROPERTY_INDEX_HARDWARE_REVISION }, - { kHomeProviderProperty, PROPERTY_INDEX_HOME_PROVIDER }, - { kHostProperty, PROPERTY_INDEX_HOST }, - { kIdentityProperty, PROPERTY_INDEX_IDENTITY }, - { kImeiProperty, PROPERTY_INDEX_IMEI }, - { kImsiProperty, PROPERTY_INDEX_IMSI }, - { kIsActiveProperty, PROPERTY_INDEX_IS_ACTIVE }, - { kL2tpIpsecCaCertNssProperty, PROPERTY_INDEX_L2TPIPSEC_CA_CERT_NSS }, - { kL2tpIpsecClientCertIdProperty, PROPERTY_INDEX_L2TPIPSEC_CLIENT_CERT_ID }, - { kL2tpIpsecClientCertSlotProp, PROPERTY_INDEX_L2TPIPSEC_CLIENT_CERT_SLOT }, - { kL2tpIpsecPinProperty, PROPERTY_INDEX_L2TPIPSEC_PIN }, - { kL2tpIpsecPskProperty, PROPERTY_INDEX_L2TPIPSEC_PSK }, - { kL2tpIpsecPasswordProperty, PROPERTY_INDEX_L2TPIPSEC_PASSWORD }, - { kL2tpIpsecUserProperty, PROPERTY_INDEX_L2TPIPSEC_USER }, - { kManufacturerProperty, PROPERTY_INDEX_MANUFACTURER }, - { kMdnProperty, PROPERTY_INDEX_MDN }, - { kMeidProperty, PROPERTY_INDEX_MEID }, - { kMinProperty, PROPERTY_INDEX_MIN }, - { kModeProperty, PROPERTY_INDEX_MODE }, - { kModelIdProperty, PROPERTY_INDEX_MODEL_ID }, - { kNameProperty, PROPERTY_INDEX_NAME }, - { kNetworkTechnologyProperty, PROPERTY_INDEX_NETWORK_TECHNOLOGY }, - { kNetworksProperty, PROPERTY_INDEX_NETWORKS }, - { kOfflineModeProperty, PROPERTY_INDEX_OFFLINE_MODE }, - { kOperatorCodeProperty, PROPERTY_INDEX_OPERATOR_CODE }, - { kOperatorNameProperty, PROPERTY_INDEX_OPERATOR_NAME }, - { kPrlVersionProperty, PROPERTY_INDEX_PRL_VERSION }, - { kPassphraseProperty, PROPERTY_INDEX_PASSPHRASE }, - { kPassphraseRequiredProperty, PROPERTY_INDEX_PASSPHRASE_REQUIRED }, - { kPaymentUrlProperty, PROPERTY_INDEX_PAYMENT_URL }, - { kPortalUrlProperty, PROPERTY_INDEX_PORTAL_URL }, - { kPoweredProperty, PROPERTY_INDEX_POWERED }, - { kPriorityProperty, PROPERTY_INDEX_PRIORITY }, - { kProfileProperty, PROPERTY_INDEX_PROFILE }, - { kProfilesProperty, PROPERTY_INDEX_PROFILES }, - { kProviderProperty, PROPERTY_INDEX_PROVIDER }, - { kProxyConfigProperty, PROPERTY_INDEX_PROXY_CONFIG }, - { kRoamingStateProperty, PROPERTY_INDEX_ROAMING_STATE }, - { kSimLockStatusProperty, PROPERTY_INDEX_SIM_LOCK }, - { kSaveCredentialsProperty, PROPERTY_INDEX_SAVE_CREDENTIALS }, - { kScanningProperty, PROPERTY_INDEX_SCANNING }, - { kSecurityProperty, PROPERTY_INDEX_SECURITY }, - { kSelectedNetworkProperty, PROPERTY_INDEX_SELECTED_NETWORK }, - { kServiceWatchListProperty, PROPERTY_INDEX_SERVICE_WATCH_LIST }, - { kServicesProperty, PROPERTY_INDEX_SERVICES }, - { kServingOperatorProperty, PROPERTY_INDEX_SERVING_OPERATOR }, - { kSignalStrengthProperty, PROPERTY_INDEX_SIGNAL_STRENGTH }, - { kStateProperty, PROPERTY_INDEX_STATE }, - { kSupportNetworkScanProperty, PROPERTY_INDEX_SUPPORT_NETWORK_SCAN }, - { kTechnologyFamilyProperty, PROPERTY_INDEX_TECHNOLOGY_FAMILY }, - { kTypeProperty, PROPERTY_INDEX_TYPE }, - { kUsageUrlProperty, PROPERTY_INDEX_USAGE_URL }, - { kWifiAuthMode, PROPERTY_INDEX_WIFI_AUTH_MODE }, - { kWifiFrequency, PROPERTY_INDEX_WIFI_FREQUENCY }, - { kWifiHexSsid, PROPERTY_INDEX_WIFI_HEX_SSID }, - { kWifiHiddenSsid, PROPERTY_INDEX_WIFI_HIDDEN_SSID }, - { kWifiPhyMode, PROPERTY_INDEX_WIFI_PHY_MODE }, + { flimflam::kActivationStateProperty, PROPERTY_INDEX_ACTIVATION_STATE }, + { flimflam::kActiveProfileProperty, PROPERTY_INDEX_ACTIVE_PROFILE }, + { flimflam::kArpGatewayProperty, PROPERTY_INDEX_ARP_GATEWAY }, + { flimflam::kAutoConnectProperty, PROPERTY_INDEX_AUTO_CONNECT }, + { flimflam::kAvailableTechnologiesProperty, + PROPERTY_INDEX_AVAILABLE_TECHNOLOGIES }, + { flimflam::kCarrierProperty, PROPERTY_INDEX_CARRIER }, + { flimflam::kCellularAllowRoamingProperty, + PROPERTY_INDEX_CELLULAR_ALLOW_ROAMING }, + { flimflam::kCellularApnListProperty, PROPERTY_INDEX_CELLULAR_APN_LIST }, + { flimflam::kCellularApnProperty, PROPERTY_INDEX_CELLULAR_APN }, + { flimflam::kCellularLastGoodApnProperty, + PROPERTY_INDEX_CELLULAR_LAST_GOOD_APN }, + { flimflam::kCheckPortalListProperty, PROPERTY_INDEX_CHECK_PORTAL_LIST }, + { flimflam::kConnectableProperty, PROPERTY_INDEX_CONNECTABLE }, + { flimflam::kConnectedTechnologiesProperty, + PROPERTY_INDEX_CONNECTED_TECHNOLOGIES }, + { flimflam::kDefaultTechnologyProperty, PROPERTY_INDEX_DEFAULT_TECHNOLOGY }, + { flimflam::kDeviceProperty, PROPERTY_INDEX_DEVICE }, + { flimflam::kDevicesProperty, PROPERTY_INDEX_DEVICES }, + { flimflam::kEapAnonymousIdentityProperty, + PROPERTY_INDEX_EAP_ANONYMOUS_IDENTITY }, + { flimflam::kEapCaCertIdProperty, PROPERTY_INDEX_EAP_CA_CERT_ID }, + { flimflam::kEapCaCertNssProperty, PROPERTY_INDEX_EAP_CA_CERT_NSS }, + { flimflam::kEapCaCertProperty, PROPERTY_INDEX_EAP_CA_CERT }, + { flimflam::kEapCertIdProperty, PROPERTY_INDEX_EAP_CERT_ID }, + { flimflam::kEapClientCertNssProperty, PROPERTY_INDEX_EAP_CLIENT_CERT_NSS }, + { flimflam::kEapClientCertProperty, PROPERTY_INDEX_EAP_CLIENT_CERT }, + { flimflam::kEapIdentityProperty, PROPERTY_INDEX_EAP_IDENTITY }, + { flimflam::kEapKeyIdProperty, PROPERTY_INDEX_EAP_KEY_ID }, + { flimflam::kEapKeyMgmtProperty, PROPERTY_INDEX_EAP_KEY_MGMT }, + { flimflam::kEapMethodProperty, PROPERTY_INDEX_EAP_METHOD }, + { flimflam::kEapPasswordProperty, PROPERTY_INDEX_EAP_PASSWORD }, + { flimflam::kEapPhase2AuthProperty, PROPERTY_INDEX_EAP_PHASE_2_AUTH }, + { flimflam::kEapPinProperty, PROPERTY_INDEX_EAP_PIN }, + { flimflam::kEapPrivateKeyPasswordProperty, + PROPERTY_INDEX_EAP_PRIVATE_KEY_PASSWORD }, + { flimflam::kEapPrivateKeyProperty, PROPERTY_INDEX_EAP_PRIVATE_KEY }, + { flimflam::kEapUseSystemCasProperty, PROPERTY_INDEX_EAP_USE_SYSTEM_CAS }, + { flimflam::kEnabledTechnologiesProperty, + PROPERTY_INDEX_ENABLED_TECHNOLOGIES }, + { flimflam::kErrorProperty, PROPERTY_INDEX_ERROR }, + { flimflam::kEsnProperty, PROPERTY_INDEX_ESN }, + { flimflam::kFavoriteProperty, PROPERTY_INDEX_FAVORITE }, + { flimflam::kFirmwareRevisionProperty, PROPERTY_INDEX_FIRMWARE_REVISION }, + { flimflam::kFoundNetworksProperty, PROPERTY_INDEX_FOUND_NETWORKS }, + { flimflam::kGuidProperty, PROPERTY_INDEX_GUID }, + { flimflam::kHardwareRevisionProperty, PROPERTY_INDEX_HARDWARE_REVISION }, + { flimflam::kHomeProviderProperty, PROPERTY_INDEX_HOME_PROVIDER }, + { flimflam::kHostProperty, PROPERTY_INDEX_HOST }, + { flimflam::kIdentityProperty, PROPERTY_INDEX_IDENTITY }, + { flimflam::kImeiProperty, PROPERTY_INDEX_IMEI }, + { flimflam::kImsiProperty, PROPERTY_INDEX_IMSI }, + { flimflam::kIsActiveProperty, PROPERTY_INDEX_IS_ACTIVE }, + { flimflam::kL2tpIpsecCaCertNssProperty, + PROPERTY_INDEX_L2TPIPSEC_CA_CERT_NSS }, + { flimflam::kL2tpIpsecClientCertIdProperty, + PROPERTY_INDEX_L2TPIPSEC_CLIENT_CERT_ID }, + { flimflam::kL2tpIpsecClientCertSlotProp, + PROPERTY_INDEX_L2TPIPSEC_CLIENT_CERT_SLOT }, + { flimflam::kL2tpIpsecPinProperty, PROPERTY_INDEX_L2TPIPSEC_PIN }, + { flimflam::kL2tpIpsecPskProperty, PROPERTY_INDEX_L2TPIPSEC_PSK }, + { flimflam::kL2tpIpsecPasswordProperty, PROPERTY_INDEX_L2TPIPSEC_PASSWORD }, + { flimflam::kL2tpIpsecUserProperty, PROPERTY_INDEX_L2TPIPSEC_USER }, + { flimflam::kManufacturerProperty, PROPERTY_INDEX_MANUFACTURER }, + { flimflam::kMdnProperty, PROPERTY_INDEX_MDN }, + { flimflam::kMeidProperty, PROPERTY_INDEX_MEID }, + { flimflam::kMinProperty, PROPERTY_INDEX_MIN }, + { flimflam::kModeProperty, PROPERTY_INDEX_MODE }, + { flimflam::kModelIDProperty, PROPERTY_INDEX_MODEL_ID }, + { flimflam::kNameProperty, PROPERTY_INDEX_NAME }, + { flimflam::kNetworkTechnologyProperty, PROPERTY_INDEX_NETWORK_TECHNOLOGY }, + { flimflam::kNetworksProperty, PROPERTY_INDEX_NETWORKS }, + { flimflam::kOfflineModeProperty, PROPERTY_INDEX_OFFLINE_MODE }, + { flimflam::kOperatorCodeProperty, PROPERTY_INDEX_OPERATOR_CODE }, + { flimflam::kOperatorNameProperty, PROPERTY_INDEX_OPERATOR_NAME }, + { flimflam::kPRLVersionProperty, PROPERTY_INDEX_PRL_VERSION }, + { flimflam::kPassphraseProperty, PROPERTY_INDEX_PASSPHRASE }, + { flimflam::kPassphraseRequiredProperty, PROPERTY_INDEX_PASSPHRASE_REQUIRED }, + { flimflam::kPaymentURLProperty, PROPERTY_INDEX_PAYMENT_URL }, + { flimflam::kPortalURLProperty, PROPERTY_INDEX_PORTAL_URL }, + { flimflam::kPoweredProperty, PROPERTY_INDEX_POWERED }, + { flimflam::kPriorityProperty, PROPERTY_INDEX_PRIORITY }, + { flimflam::kProfileProperty, PROPERTY_INDEX_PROFILE }, + { flimflam::kProfilesProperty, PROPERTY_INDEX_PROFILES }, + { flimflam::kProviderProperty, PROPERTY_INDEX_PROVIDER }, + { flimflam::kProxyConfigProperty, PROPERTY_INDEX_PROXY_CONFIG }, + { flimflam::kRoamingStateProperty, PROPERTY_INDEX_ROAMING_STATE }, + { flimflam::kSIMLockStatusProperty, PROPERTY_INDEX_SIM_LOCK }, + { flimflam::kSaveCredentialsProperty, PROPERTY_INDEX_SAVE_CREDENTIALS }, + { flimflam::kScanningProperty, PROPERTY_INDEX_SCANNING }, + { flimflam::kSecurityProperty, PROPERTY_INDEX_SECURITY }, + { flimflam::kSelectedNetworkProperty, PROPERTY_INDEX_SELECTED_NETWORK }, + { flimflam::kServiceWatchListProperty, PROPERTY_INDEX_SERVICE_WATCH_LIST }, + { flimflam::kServicesProperty, PROPERTY_INDEX_SERVICES }, + { flimflam::kServingOperatorProperty, PROPERTY_INDEX_SERVING_OPERATOR }, + { flimflam::kSignalStrengthProperty, PROPERTY_INDEX_SIGNAL_STRENGTH }, + { flimflam::kStateProperty, PROPERTY_INDEX_STATE }, + { flimflam::kSupportNetworkScanProperty, + PROPERTY_INDEX_SUPPORT_NETWORK_SCAN }, + { flimflam::kTechnologyFamilyProperty, PROPERTY_INDEX_TECHNOLOGY_FAMILY }, + { flimflam::kTypeProperty, PROPERTY_INDEX_TYPE }, + { flimflam::kUsageURLProperty, PROPERTY_INDEX_USAGE_URL }, + { flimflam::kWifiAuthMode, PROPERTY_INDEX_WIFI_AUTH_MODE }, + { flimflam::kWifiFrequency, PROPERTY_INDEX_WIFI_FREQUENCY }, + { flimflam::kWifiHexSsid, PROPERTY_INDEX_WIFI_HEX_SSID }, + { flimflam::kWifiHiddenSsid, PROPERTY_INDEX_WIFI_HIDDEN_SSID }, + { flimflam::kWifiPhyMode, PROPERTY_INDEX_WIFI_PHY_MODE }, }; // Serve the singleton mapper instance. @@ -124,12 +136,12 @@ const EnumMapper<PropertyIndex>* get_native_mapper() { ConnectionType ParseNetworkType(const std::string& type) { static EnumMapper<ConnectionType>::Pair table[] = { - { kTypeEthernet, TYPE_ETHERNET }, - { kTypeWifi, TYPE_WIFI }, - { kTypeWimax, TYPE_WIMAX }, - { kTypeBluetooth, TYPE_BLUETOOTH }, - { kTypeCellular, TYPE_CELLULAR }, - { kTypeVpn, TYPE_VPN }, + { flimflam::kTypeEthernet, TYPE_ETHERNET }, + { flimflam::kTypeWifi, TYPE_WIFI }, + { flimflam::kTypeWimax, TYPE_WIMAX }, + { flimflam::kTypeBluetooth, TYPE_BLUETOOTH }, + { flimflam::kTypeCellular, TYPE_CELLULAR }, + { flimflam::kTypeVPN, TYPE_VPN }, }; static EnumMapper<ConnectionType> parser( table, arraysize(table), TYPE_UNKNOWN); @@ -227,11 +239,11 @@ bool NativeNetworkDeviceParser::ParseValue( std::string home_provider_code; std::string home_provider_country; std::string home_provider_name; - dict.GetStringWithoutPathExpansion(kOperatorCodeKey, + dict.GetStringWithoutPathExpansion(flimflam::kOperatorCodeKey, &home_provider_code); - dict.GetStringWithoutPathExpansion(kOperatorCountryKey, + dict.GetStringWithoutPathExpansion(flimflam::kOperatorCountryKey, &home_provider_country); - dict.GetStringWithoutPathExpansion(kOperatorNameKey, + dict.GetStringWithoutPathExpansion(flimflam::kOperatorNameKey, &home_provider_name); device->set_home_provider_code(home_provider_code); device->set_home_provider_country(home_provider_country); @@ -373,19 +385,20 @@ bool NativeNetworkDeviceParser::ParseApnList(const ListValue& list, apn_list->resize(apn_list->size() + 1); const DictionaryValue* dict = static_cast<const DictionaryValue*>(*it); dict->GetStringWithoutPathExpansion( - kApnProperty, &apn_list->back().apn); + flimflam::kApnProperty, &apn_list->back().apn); dict->GetStringWithoutPathExpansion( - kApnNetworkIdProperty, &apn_list->back().network_id); + flimflam::kApnNetworkIdProperty, &apn_list->back().network_id); dict->GetStringWithoutPathExpansion( - kApnUsernameProperty, &apn_list->back().username); + flimflam::kApnUsernameProperty, &apn_list->back().username); dict->GetStringWithoutPathExpansion( - kApnPasswordProperty, &apn_list->back().password); + flimflam::kApnPasswordProperty, &apn_list->back().password); dict->GetStringWithoutPathExpansion( - kApnNameProperty, &apn_list->back().name); + flimflam::kApnNameProperty, &apn_list->back().name); dict->GetStringWithoutPathExpansion( - kApnLocalizedNameProperty, &apn_list->back().localized_name); + flimflam::kApnLocalizedNameProperty, + &apn_list->back().localized_name); dict->GetStringWithoutPathExpansion( - kApnLanguageProperty, &apn_list->back().language); + flimflam::kApnLanguageProperty, &apn_list->back().language); } else { return false; } @@ -403,15 +416,15 @@ bool NativeNetworkDeviceParser::ParseFoundNetworksFromList( found_networks->resize(found_networks->size() + 1); const DictionaryValue* dict = static_cast<const DictionaryValue*>(*it); dict->GetStringWithoutPathExpansion( - kStatusProperty, &found_networks->back().status); + flimflam::kStatusProperty, &found_networks->back().status); dict->GetStringWithoutPathExpansion( - kNetworkIdProperty, &found_networks->back().network_id); + flimflam::kNetworkIdProperty, &found_networks->back().network_id); dict->GetStringWithoutPathExpansion( - kShortNameProperty, &found_networks->back().short_name); + flimflam::kShortNameProperty, &found_networks->back().short_name); dict->GetStringWithoutPathExpansion( - kLongNameProperty, &found_networks->back().long_name); + flimflam::kLongNameProperty, &found_networks->back().long_name); dict->GetStringWithoutPathExpansion( - kTechnologyProperty, &found_networks->back().technology); + flimflam::kTechnologyProperty, &found_networks->back().technology); } else { return false; } @@ -423,8 +436,8 @@ SimLockState NativeNetworkDeviceParser::ParseSimLockState( const std::string& state) { static EnumMapper<SimLockState>::Pair table[] = { { "", SIM_UNLOCKED }, - { kSimLockPin, SIM_LOCKED_PIN }, - { kSimLockPuk, SIM_LOCKED_PUK }, + { flimflam::kSIMLockPin, SIM_LOCKED_PIN }, + { flimflam::kSIMLockPuk, SIM_LOCKED_PUK }, }; static EnumMapper<SimLockState> parser( table, arraysize(table), SIM_UNKNOWN); @@ -436,8 +449,8 @@ SimLockState NativeNetworkDeviceParser::ParseSimLockState( bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary( const DictionaryValue& info, SimLockState* out_state, int* out_retries) { std::string state_string; - if (!info.GetString(kSimLockTypeProperty, &state_string) || - !info.GetInteger(kSimLockRetriesLeftProperty, out_retries)) { + if (!info.GetString(flimflam::kSIMLockTypeProperty, &state_string) || + !info.GetInteger(flimflam::kSIMLockRetriesLeftProperty, out_retries)) { LOG(ERROR) << "Error parsing SIMLock state"; return false; } @@ -448,8 +461,8 @@ bool NativeNetworkDeviceParser::ParseSimLockStateFromDictionary( TechnologyFamily NativeNetworkDeviceParser::ParseTechnologyFamily( const std::string& technology_family) { static EnumMapper<TechnologyFamily>::Pair table[] = { - { kTechnologyFamilyCdma, TECHNOLOGY_FAMILY_CDMA }, - { kTechnologyFamilyGsm, TECHNOLOGY_FAMILY_GSM }, + { flimflam::kTechnologyFamilyCdma, TECHNOLOGY_FAMILY_CDMA }, + { flimflam::kTechnologyFamilyGsm, TECHNOLOGY_FAMILY_GSM }, }; static EnumMapper<TechnologyFamily> parser( table, arraysize(table), TECHNOLOGY_FAMILY_UNKNOWN); @@ -595,14 +608,14 @@ ConnectionType NativeNetworkParser::ParseType(const std::string& type) { ConnectionType NativeNetworkParser::ParseTypeFromDictionary( const DictionaryValue& info) { std::string type_string; - info.GetString(kTypeProperty, &type_string); + info.GetString(flimflam::kTypeProperty, &type_string); return ParseType(type_string); } ConnectionMode NativeNetworkParser::ParseMode(const std::string& mode) { static EnumMapper<ConnectionMode>::Pair table[] = { - { kModeManaged, MODE_MANAGED }, - { kModeAdhoc, MODE_ADHOC }, + { flimflam::kModeManaged, MODE_MANAGED }, + { flimflam::kModeAdhoc, MODE_ADHOC }, }; static EnumMapper<ConnectionMode> parser( table, arraysize(table), MODE_UNKNOWN); @@ -611,16 +624,16 @@ ConnectionMode NativeNetworkParser::ParseMode(const std::string& mode) { ConnectionState NativeNetworkParser::ParseState(const std::string& state) { static EnumMapper<ConnectionState>::Pair table[] = { - { kStateIdle, STATE_IDLE }, - { kStateCarrier, STATE_CARRIER }, - { kStateAssociation, STATE_ASSOCIATION }, - { kStateConfiguration, STATE_CONFIGURATION }, - { kStateReady, STATE_READY }, - { kStateDisconnect, STATE_DISCONNECT }, - { kStateFailure, STATE_FAILURE }, - { kStateActivationFailure, STATE_ACTIVATION_FAILURE }, - { kStatePortal, STATE_PORTAL }, - { kStateOnline, STATE_ONLINE }, + { flimflam::kStateIdle, STATE_IDLE }, + { flimflam::kStateCarrier, STATE_CARRIER }, + { flimflam::kStateAssociation, STATE_ASSOCIATION }, + { flimflam::kStateConfiguration, STATE_CONFIGURATION }, + { flimflam::kStateReady, STATE_READY }, + { flimflam::kStateDisconnect, STATE_DISCONNECT }, + { flimflam::kStateFailure, STATE_FAILURE }, + { flimflam::kStateActivationFailure, STATE_ACTIVATION_FAILURE }, + { flimflam::kStatePortal, STATE_PORTAL }, + { flimflam::kStateOnline, STATE_ONLINE }, }; static EnumMapper<ConnectionState> parser( table, arraysize(table), STATE_UNKNOWN); @@ -629,20 +642,20 @@ ConnectionState NativeNetworkParser::ParseState(const std::string& state) { ConnectionError NativeNetworkParser::ParseError(const std::string& error) { static EnumMapper<ConnectionError>::Pair table[] = { - { kErrorOutOfRange, ERROR_OUT_OF_RANGE }, - { kErrorPinMissing, ERROR_PIN_MISSING }, - { kErrorDhcpFailed, ERROR_DHCP_FAILED }, - { kErrorConnectFailed, ERROR_CONNECT_FAILED }, - { kErrorBadPassphrase, ERROR_BAD_PASSPHRASE }, - { kErrorBadWepKey, ERROR_BAD_WEPKEY }, - { kErrorActivationFailed, ERROR_ACTIVATION_FAILED }, - { kErrorNeedEvdo, ERROR_NEED_EVDO }, - { kErrorNeedHomeNetwork, ERROR_NEED_HOME_NETWORK }, - { kErrorOtaspFailed, ERROR_OTASP_FAILED }, - { kErrorAaaFailed, ERROR_AAA_FAILED }, - { kErrorInternal, ERROR_INTERNAL }, - { kErrorDnsLookupFailed, ERROR_DNS_LOOKUP_FAILED }, - { kErrorHttpGetFailed, ERROR_HTTP_GET_FAILED }, + { flimflam::kErrorOutOfRange, ERROR_OUT_OF_RANGE }, + { flimflam::kErrorPinMissing, ERROR_PIN_MISSING }, + { flimflam::kErrorDhcpFailed, ERROR_DHCP_FAILED }, + { flimflam::kErrorConnectFailed, ERROR_CONNECT_FAILED }, + { flimflam::kErrorBadPassphrase, ERROR_BAD_PASSPHRASE }, + { flimflam::kErrorBadWEPKey, ERROR_BAD_WEPKEY }, + { flimflam::kErrorActivationFailed, ERROR_ACTIVATION_FAILED }, + { flimflam::kErrorNeedEvdo, ERROR_NEED_EVDO }, + { flimflam::kErrorNeedHomeNetwork, ERROR_NEED_HOME_NETWORK }, + { flimflam::kErrorOtaspFailed, ERROR_OTASP_FAILED }, + { flimflam::kErrorAaaFailed, ERROR_AAA_FAILED }, + { flimflam::kErrorInternal, ERROR_INTERNAL }, + { flimflam::kErrorDNSLookupFailed, ERROR_DNS_LOOKUP_FAILED }, + { flimflam::kErrorHTTPGetFailed, ERROR_HTTP_GET_FAILED }, }; static EnumMapper<ConnectionError> parser( table, arraysize(table), ERROR_NO_ERROR); @@ -755,13 +768,16 @@ bool NativeCellularNetworkParser::ParseValue(PropertyIndex index, const DictionaryValue& dict = static_cast<const DictionaryValue&>(value); std::string value_str; - dict.GetStringWithoutPathExpansion(kOperatorNameKey, &value_str); + dict.GetStringWithoutPathExpansion( + flimflam::kOperatorNameKey, &value_str); cellular_network->set_operator_name(value_str); value_str.clear(); - dict.GetStringWithoutPathExpansion(kOperatorCodeKey, &value_str); + dict.GetStringWithoutPathExpansion( + flimflam::kOperatorCodeKey, &value_str); cellular_network->set_operator_code(value_str); value_str.clear(); - dict.GetStringWithoutPathExpansion(kOperatorCountryKey, &value_str); + dict.GetStringWithoutPathExpansion( + flimflam::kOperatorCountryKey, &value_str); cellular_network->set_operator_country(value_str); return true; } @@ -800,11 +816,12 @@ bool NativeCellularNetworkParser::ParseValue(PropertyIndex index, ActivationState NativeCellularNetworkParser::ParseActivationState( const std::string& state) { static EnumMapper<ActivationState>::Pair table[] = { - { kActivationStateActivated, ACTIVATION_STATE_ACTIVATED }, - { kActivationStateActivating, ACTIVATION_STATE_ACTIVATING }, - { kActivationStateNotActivated, ACTIVATION_STATE_NOT_ACTIVATED }, - { kActivationStatePartiallyActivated, ACTIVATION_STATE_PARTIALLY_ACTIVATED}, - { kActivationStateUnknown, ACTIVATION_STATE_UNKNOWN}, + { flimflam::kActivationStateActivated, ACTIVATION_STATE_ACTIVATED }, + { flimflam::kActivationStateActivating, ACTIVATION_STATE_ACTIVATING }, + { flimflam::kActivationStateNotActivated, ACTIVATION_STATE_NOT_ACTIVATED }, + { flimflam::kActivationStatePartiallyActivated, + ACTIVATION_STATE_PARTIALLY_ACTIVATED}, + { flimflam::kActivationStateUnknown, ACTIVATION_STATE_UNKNOWN}, }; static EnumMapper<ActivationState> parser( table, arraysize(table), ACTIVATION_STATE_UNKNOWN); @@ -814,16 +831,17 @@ ActivationState NativeCellularNetworkParser::ParseActivationState( NetworkTechnology NativeCellularNetworkParser::ParseNetworkTechnology( const std::string& technology) { static EnumMapper<NetworkTechnology>::Pair table[] = { - { kNetworkTechnology1Xrtt, NETWORK_TECHNOLOGY_1XRTT }, - { kNetworkTechnologyEvdo, NETWORK_TECHNOLOGY_EVDO }, - { kNetworkTechnologyGprs, NETWORK_TECHNOLOGY_GPRS }, - { kNetworkTechnologyEdge, NETWORK_TECHNOLOGY_EDGE }, - { kNetworkTechnologyUmts, NETWORK_TECHNOLOGY_UMTS }, - { kNetworkTechnologyHspa, NETWORK_TECHNOLOGY_HSPA }, - { kNetworkTechnologyHspaPlus, NETWORK_TECHNOLOGY_HSPA_PLUS }, - { kNetworkTechnologyLte, NETWORK_TECHNOLOGY_LTE }, - { kNetworkTechnologyLteAdvanced, NETWORK_TECHNOLOGY_LTE_ADVANCED }, - { kNetworkTechnologyGsm, NETWORK_TECHNOLOGY_GSM }, + { flimflam::kNetworkTechnology1Xrtt, NETWORK_TECHNOLOGY_1XRTT }, + { flimflam::kNetworkTechnologyEvdo, NETWORK_TECHNOLOGY_EVDO }, + { flimflam::kNetworkTechnologyGprs, NETWORK_TECHNOLOGY_GPRS }, + { flimflam::kNetworkTechnologyEdge, NETWORK_TECHNOLOGY_EDGE }, + { flimflam::kNetworkTechnologyUmts, NETWORK_TECHNOLOGY_UMTS }, + { flimflam::kNetworkTechnologyHspa, NETWORK_TECHNOLOGY_HSPA }, + { flimflam::kNetworkTechnologyHspaPlus, NETWORK_TECHNOLOGY_HSPA_PLUS }, + { flimflam::kNetworkTechnologyLte, NETWORK_TECHNOLOGY_LTE }, + { flimflam::kNetworkTechnologyLteAdvanced, + NETWORK_TECHNOLOGY_LTE_ADVANCED }, + { flimflam::kNetworkTechnologyGsm, NETWORK_TECHNOLOGY_GSM }, }; static EnumMapper<NetworkTechnology> parser( table, arraysize(table), NETWORK_TECHNOLOGY_UNKNOWN); @@ -833,9 +851,9 @@ NetworkTechnology NativeCellularNetworkParser::ParseNetworkTechnology( NetworkRoamingState NativeCellularNetworkParser::ParseRoamingState( const std::string& roaming_state) { static EnumMapper<NetworkRoamingState>::Pair table[] = { - { kRoamingStateHome, ROAMING_STATE_HOME }, - { kRoamingStateRoaming, ROAMING_STATE_ROAMING }, - { kRoamingStateUnknown, ROAMING_STATE_UNKNOWN }, + { flimflam::kRoamingStateHome, ROAMING_STATE_HOME }, + { flimflam::kRoamingStateRoaming, ROAMING_STATE_ROAMING }, + { flimflam::kRoamingStateUnknown, ROAMING_STATE_UNKNOWN }, }; static EnumMapper<NetworkRoamingState> parser( table, arraysize(table), ROAMING_STATE_UNKNOWN); @@ -990,12 +1008,12 @@ bool NativeWifiNetworkParser::ParseValue(PropertyIndex index, ConnectionSecurity NativeWifiNetworkParser::ParseSecurity( const std::string& security) { static EnumMapper<ConnectionSecurity>::Pair table[] = { - { kSecurityNone, SECURITY_NONE }, - { kSecurityWep, SECURITY_WEP }, - { kSecurityWpa, SECURITY_WPA }, - { kSecurityRsn, SECURITY_RSN }, - { kSecurityPsk, SECURITY_PSK }, - { kSecurity8021x, SECURITY_8021X }, + { flimflam::kSecurityNone, SECURITY_NONE }, + { flimflam::kSecurityWep, SECURITY_WEP }, + { flimflam::kSecurityWpa, SECURITY_WPA }, + { flimflam::kSecurityRsn, SECURITY_RSN }, + { flimflam::kSecurityPsk, SECURITY_PSK }, + { flimflam::kSecurity8021x, SECURITY_8021X }, }; static EnumMapper<ConnectionSecurity> parser( table, arraysize(table), SECURITY_UNKNOWN); @@ -1004,10 +1022,10 @@ ConnectionSecurity NativeWifiNetworkParser::ParseSecurity( EAPMethod NativeWifiNetworkParser::ParseEAPMethod(const std::string& method) { static EnumMapper<EAPMethod>::Pair table[] = { - { kEapMethodPeap, EAP_METHOD_PEAP }, - { kEapMethodTls, EAP_METHOD_TLS }, - { kEapMethodTtls, EAP_METHOD_TTLS }, - { kEapMethodLeap, EAP_METHOD_LEAP }, + { flimflam::kEapMethodPEAP, EAP_METHOD_PEAP }, + { flimflam::kEapMethodTLS, EAP_METHOD_TLS }, + { flimflam::kEapMethodTTLS, EAP_METHOD_TTLS }, + { flimflam::kEapMethodLEAP, EAP_METHOD_LEAP }, }; static EnumMapper<EAPMethod> parser( table, arraysize(table), EAP_METHOD_UNKNOWN); @@ -1017,13 +1035,13 @@ EAPMethod NativeWifiNetworkParser::ParseEAPMethod(const std::string& method) { EAPPhase2Auth NativeWifiNetworkParser::ParseEAPPhase2Auth( const std::string& auth) { static EnumMapper<EAPPhase2Auth>::Pair table[] = { - { kEapPhase2AuthPeapMd5, EAP_PHASE_2_AUTH_MD5 }, - { kEapPhase2AuthPeapMschap2, EAP_PHASE_2_AUTH_MSCHAPV2 }, - { kEapPhase2AuthTtlsMd5, EAP_PHASE_2_AUTH_MD5 }, - { kEapPhase2AuthTtlsMschapV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, - { kEapPhase2AuthTtlsMschap, EAP_PHASE_2_AUTH_MSCHAP }, - { kEapPhase2AuthTtlsPap, EAP_PHASE_2_AUTH_PAP }, - { kEapPhase2AuthTtlsChap, EAP_PHASE_2_AUTH_CHAP }, + { flimflam::kEapPhase2AuthPEAPMD5, EAP_PHASE_2_AUTH_MD5 }, + { flimflam::kEapPhase2AuthPEAPMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, + { flimflam::kEapPhase2AuthTTLSMD5, EAP_PHASE_2_AUTH_MD5 }, + { flimflam::kEapPhase2AuthTTLSMSCHAPV2, EAP_PHASE_2_AUTH_MSCHAPV2 }, + { flimflam::kEapPhase2AuthTTLSMSCHAP, EAP_PHASE_2_AUTH_MSCHAP }, + { flimflam::kEapPhase2AuthTTLSPAP, EAP_PHASE_2_AUTH_PAP }, + { flimflam::kEapPhase2AuthTTLSCHAP, EAP_PHASE_2_AUTH_CHAP }, }; static EnumMapper<EAPPhase2Auth> parser( table, arraysize(table), EAP_PHASE_2_AUTH_AUTO); @@ -1154,8 +1172,8 @@ bool NativeVirtualNetworkParser::ParseProviderValue(PropertyIndex index, ProviderType NativeVirtualNetworkParser::ParseProviderType( const std::string& type) { static EnumMapper<ProviderType>::Pair table[] = { - { kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK }, - { kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN }, + { flimflam::kProviderL2tpIpsec, PROVIDER_TYPE_L2TP_IPSEC_PSK }, + { flimflam::kProviderOpenVpn, PROVIDER_TYPE_OPEN_VPN }, }; static EnumMapper<ProviderType> parser( table, arraysize(table), PROVIDER_TYPE_MAX); diff --git a/chrome/browser/chromeos/cros/network_library.cc b/chrome/browser/chromeos/cros/network_library.cc index 9fa7cea..db1f723 100644 --- a/chrome/browser/chromeos/cros/network_library.cc +++ b/chrome/browser/chromeos/cros/network_library.cc @@ -33,6 +33,7 @@ #include "content/browser/browser_thread.h" #include "crypto/nss_util.h" // crypto::GetTPMTokenInfo() for 802.1X and VPN. #include "grit/generated_resources.h" +#include "third_party/cros_system_api/dbus/service_constants.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/text/bytes_formatting.h" @@ -448,25 +449,28 @@ void Network::SetIntegerProperty(const char* prop, int i, int* dest) { void Network::SetPreferred(bool preferred) { if (preferred) { - SetIntegerProperty(kPriorityProperty, kPriorityPreferred, &priority_); + SetIntegerProperty( + flimflam::kPriorityProperty, kPriorityPreferred, &priority_); } else { - ClearProperty(kPriorityProperty); + ClearProperty(flimflam::kPriorityProperty); priority_ = kPriorityNotSet; } } void Network::SetAutoConnect(bool auto_connect) { - SetBooleanProperty(kAutoConnectProperty, auto_connect, &auto_connect_); + SetBooleanProperty( + flimflam::kAutoConnectProperty, auto_connect, &auto_connect_); } void Network::SetSaveCredentials(bool save_credentials) { - SetBooleanProperty(kSaveCredentialsProperty, save_credentials, - &save_credentials_); + SetBooleanProperty( + flimflam::kSaveCredentialsProperty, save_credentials, &save_credentials_); } void Network::SetProfilePath(const std::string& profile_path) { VLOG(1) << "Setting profile for: " << name_ << " to: " << profile_path; - SetOrClearStringProperty(kProfileProperty, profile_path, &profile_path_); + SetOrClearStringProperty( + flimflam::kProfileProperty, profile_path, &profile_path_); } std::string Network::GetStateString() const { @@ -542,7 +546,8 @@ std::string Network::GetErrorString() const { } void Network::SetProxyConfig(const std::string& proxy_config) { - SetStringProperty(kProxyConfigProperty, proxy_config, &proxy_config_); + SetStringProperty( + flimflam::kProxyConfigProperty, proxy_config, &proxy_config_); } void Network::InitIPAddress() { @@ -665,31 +670,33 @@ std::string VirtualNetwork::GetProviderTypeString() const { } void VirtualNetwork::SetCACertNSS(const std::string& ca_cert_nss) { - SetStringProperty(kL2tpIpsecCaCertNssProperty, ca_cert_nss, &ca_cert_nss_); + SetStringProperty( + flimflam::kL2tpIpsecCaCertNssProperty, ca_cert_nss, &ca_cert_nss_); } void VirtualNetwork::SetPSKPassphrase(const std::string& psk_passphrase) { - SetStringProperty(kL2tpIpsecPskProperty, psk_passphrase, - &psk_passphrase_); + SetStringProperty( + flimflam::kL2tpIpsecPskProperty, psk_passphrase, &psk_passphrase_); } void VirtualNetwork::SetClientCertID(const std::string& cert_id) { - SetStringProperty(kL2tpIpsecClientCertIdProperty, cert_id, &client_cert_id_); + SetStringProperty( + flimflam::kL2tpIpsecClientCertIdProperty, cert_id, &client_cert_id_); } void VirtualNetwork::SetUsername(const std::string& username) { - SetStringProperty(kL2tpIpsecUserProperty, username, &username_); + SetStringProperty(flimflam::kL2tpIpsecUserProperty, username, &username_); } void VirtualNetwork::SetUserPassphrase(const std::string& user_passphrase) { - SetStringProperty(kL2tpIpsecPasswordProperty, user_passphrase, - &user_passphrase_); + SetStringProperty( + flimflam::kL2tpIpsecPasswordProperty, user_passphrase, &user_passphrase_); } void VirtualNetwork::SetCertificateSlotAndPin( const std::string& slot, const std::string& pin) { - SetOrClearStringProperty(kL2tpIpsecClientCertSlotProp, slot, NULL); - SetOrClearStringProperty(kL2tpIpsecPinProperty, pin, NULL); + SetOrClearStringProperty(flimflam::kL2tpIpsecClientCertSlotProp, slot, NULL); + SetOrClearStringProperty(flimflam::kL2tpIpsecPinProperty, pin, NULL); } //////////////////////////////////////////////////////////////////////////////// @@ -921,20 +928,24 @@ CellularApn::CellularApn( CellularApn::~CellularApn() {} void CellularApn::Set(const DictionaryValue& dict) { - if (!dict.GetStringWithoutPathExpansion(kApnProperty, &apn)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnProperty, &apn)) apn.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnNetworkIdProperty, &network_id)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnNetworkIdProperty, + &network_id)) network_id.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnUsernameProperty, &username)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnUsernameProperty, + &username)) username.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnPasswordProperty, &password)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnPasswordProperty, + &password)) password.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnNameProperty, &name)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnNameProperty, &name)) name.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnLocalizedNameProperty, + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnLocalizedNameProperty, &localized_name)) localized_name.clear(); - if (!dict.GetStringWithoutPathExpansion(kApnLanguageProperty, &language)) + if (!dict.GetStringWithoutPathExpansion(flimflam::kApnLanguageProperty, + &language)) language.clear(); } @@ -971,13 +982,13 @@ void CellularNetwork::SetApn(const CellularApn& apn) { DictionaryValue value; // Only use the fields that are needed for establishing // connections, and ignore the rest. - value.SetString(kApnProperty, apn.apn); - value.SetString(kApnNetworkIdProperty, apn.network_id); - value.SetString(kApnUsernameProperty, apn.username); - value.SetString(kApnPasswordProperty, apn.password); - SetValueProperty(kCellularApnProperty, &value); + value.SetString(flimflam::kApnProperty, apn.apn); + value.SetString(flimflam::kApnNetworkIdProperty, apn.network_id); + value.SetString(flimflam::kApnUsernameProperty, apn.username); + value.SetString(flimflam::kApnPasswordProperty, apn.password); + SetValueProperty(flimflam::kCellularApnProperty, &value); } else { - ClearProperty(kCellularApnProperty); + ClearProperty(flimflam::kCellularApnProperty); } } @@ -1151,7 +1162,7 @@ void WifiNetwork::SetPassphrase(const std::string& passphrase) { } // Send the change to flimflam. If the format is valid, it will propagate to // passphrase_ with a service update. - SetOrClearStringProperty(kPassphraseProperty, passphrase, NULL); + SetOrClearStringProperty(flimflam::kPassphraseProperty, passphrase, NULL); } // See src/third_party/flimflam/doc/service-api.txt for properties that @@ -1166,26 +1177,30 @@ void WifiNetwork::EraseCredentials() { } void WifiNetwork::SetIdentity(const std::string& identity) { - SetStringProperty(kIdentityProperty, identity, &identity_); + SetStringProperty(flimflam::kIdentityProperty, identity, &identity_); } void WifiNetwork::SetEAPMethod(EAPMethod method) { eap_method_ = method; switch (method) { case EAP_METHOD_PEAP: - SetStringProperty(kEapMethodProperty, kEapMethodPeap, NULL); + SetStringProperty( + flimflam::kEapMethodProperty, flimflam::kEapMethodPEAP, NULL); break; case EAP_METHOD_TLS: - SetStringProperty(kEapMethodProperty, kEapMethodTls, NULL); + SetStringProperty( + flimflam::kEapMethodProperty, flimflam::kEapMethodTLS, NULL); break; case EAP_METHOD_TTLS: - SetStringProperty(kEapMethodProperty, kEapMethodTtls, NULL); + SetStringProperty( + flimflam::kEapMethodProperty, flimflam::kEapMethodTTLS, NULL); break; case EAP_METHOD_LEAP: - SetStringProperty(kEapMethodProperty, kEapMethodLeap, NULL); + SetStringProperty( + flimflam::kEapMethodProperty, flimflam::kEapMethodLEAP, NULL); break; default: - ClearProperty(kEapMethodProperty); + ClearProperty(flimflam::kEapMethodProperty); break; } } @@ -1195,28 +1210,31 @@ void WifiNetwork::SetEAPPhase2Auth(EAPPhase2Auth auth) { bool is_peap = (eap_method_ == EAP_METHOD_PEAP); switch (auth) { case EAP_PHASE_2_AUTH_AUTO: - ClearProperty(kEapPhase2AuthProperty); + ClearProperty(flimflam::kEapPhase2AuthProperty); break; case EAP_PHASE_2_AUTH_MD5: - SetStringProperty(kEapPhase2AuthProperty, - is_peap ? kEapPhase2AuthPeapMd5 - : kEapPhase2AuthTtlsMd5, + SetStringProperty(flimflam::kEapPhase2AuthProperty, + is_peap ? flimflam::kEapPhase2AuthPEAPMD5 + : flimflam::kEapPhase2AuthTTLSMD5, NULL); break; case EAP_PHASE_2_AUTH_MSCHAPV2: - SetStringProperty(kEapPhase2AuthProperty, - is_peap ? kEapPhase2AuthPeapMschap2 - : kEapPhase2AuthTtlsMschapV2, + SetStringProperty(flimflam::kEapPhase2AuthProperty, + is_peap ? flimflam::kEapPhase2AuthPEAPMSCHAPV2 + : flimflam::kEapPhase2AuthTTLSMSCHAPV2, NULL); break; case EAP_PHASE_2_AUTH_MSCHAP: - SetStringProperty(kEapPhase2AuthProperty, kEapPhase2AuthTtlsMschap, NULL); + SetStringProperty(flimflam::kEapPhase2AuthProperty, + flimflam::kEapPhase2AuthTTLSMSCHAP, NULL); break; case EAP_PHASE_2_AUTH_PAP: - SetStringProperty(kEapPhase2AuthProperty, kEapPhase2AuthTtlsPap, NULL); + SetStringProperty(flimflam::kEapPhase2AuthProperty, + flimflam::kEapPhase2AuthTTLSPAP, NULL); break; case EAP_PHASE_2_AUTH_CHAP: - SetStringProperty(kEapPhase2AuthProperty, kEapPhase2AuthTtlsChap, NULL); + SetStringProperty(flimflam::kEapPhase2AuthProperty, + flimflam::kEapPhase2AuthTTLSCHAP, NULL); break; } } @@ -1224,35 +1242,37 @@ void WifiNetwork::SetEAPPhase2Auth(EAPPhase2Auth auth) { void WifiNetwork::SetEAPServerCaCertNssNickname( const std::string& nss_nickname) { VLOG(1) << "SetEAPServerCaCertNssNickname " << nss_nickname; - SetOrClearStringProperty(kEapCaCertNssProperty, nss_nickname, - &eap_server_ca_cert_nss_nickname_); + SetOrClearStringProperty(flimflam::kEapCaCertNssProperty, + nss_nickname, &eap_server_ca_cert_nss_nickname_); } void WifiNetwork::SetEAPClientCertPkcs11Id(const std::string& pkcs11_id) { VLOG(1) << "SetEAPClientCertPkcs11Id " << pkcs11_id; - SetOrClearStringProperty(kEapCertIdProperty, pkcs11_id, - &eap_client_cert_pkcs11_id_); + SetOrClearStringProperty( + flimflam::kEapCertIdProperty, pkcs11_id, &eap_client_cert_pkcs11_id_); // flimflam requires both CertID and KeyID for TLS connections, despite // the fact that by convention they are the same ID. - SetOrClearStringProperty(kEapKeyIdProperty, pkcs11_id, NULL); + SetOrClearStringProperty(flimflam::kEapKeyIdProperty, pkcs11_id, NULL); } void WifiNetwork::SetEAPUseSystemCAs(bool use_system_cas) { - SetBooleanProperty(kEapUseSystemCasProperty, use_system_cas, + SetBooleanProperty(flimflam::kEapUseSystemCasProperty, use_system_cas, &eap_use_system_cas_); } void WifiNetwork::SetEAPIdentity(const std::string& identity) { - SetOrClearStringProperty(kEapIdentityProperty, identity, &eap_identity_); + SetOrClearStringProperty( + flimflam::kEapIdentityProperty, identity, &eap_identity_); } void WifiNetwork::SetEAPAnonymousIdentity(const std::string& identity) { - SetOrClearStringProperty(kEapAnonymousIdentityProperty, identity, + SetOrClearStringProperty(flimflam::kEapAnonymousIdentityProperty, identity, &eap_anonymous_identity_); } void WifiNetwork::SetEAPPassphrase(const std::string& passphrase) { - SetOrClearStringProperty(kEapPasswordProperty, passphrase, &eap_passphrase_); + SetOrClearStringProperty( + flimflam::kEapPasswordProperty, passphrase, &eap_passphrase_); } std::string WifiNetwork::GetEncryptionString() const { @@ -1314,7 +1334,7 @@ bool WifiNetwork::RequiresUserProfile() const { } void WifiNetwork::SetCertificatePin(const std::string& pin) { - SetOrClearStringProperty(kEapPinProperty, pin, NULL); + SetOrClearStringProperty(flimflam::kEapPinProperty, pin, NULL); } //////////////////////////////////////////////////////////////////////////////// @@ -3398,7 +3418,7 @@ void NetworkLibraryImplCros::NetworkConnectCallback( << service_path << " Error: " << error << " Message: " << error_message; if (error_message && - strcmp(error_message, kErrorPassphraseRequiredMsg) == 0) { + strcmp(error_message, flimflam::kErrorPassphraseRequiredMsg) == 0) { status = CONNECT_BAD_PASSPHRASE; } else { status = CONNECT_FAILED; @@ -3562,11 +3582,11 @@ void NetworkLibraryImplCros::PinOperationCallback( networklib->FlipSimPinRequiredStateIfNeeded(); } else { if (error_message && - (strcmp(error_message, kErrorIncorrectPinMsg) == 0 || - strcmp(error_message, kErrorPinRequiredMsg) == 0)) { + (strcmp(error_message, flimflam::kErrorIncorrectPinMsg) == 0 || + strcmp(error_message, flimflam::kErrorPinRequiredMsg) == 0)) { pin_error = PIN_ERROR_INCORRECT_CODE; } else if (error_message && - strcmp(error_message, kErrorPinBlockedMsg) == 0) { + strcmp(error_message, flimflam::kErrorPinBlockedMsg) == 0) { pin_error = PIN_ERROR_BLOCKED; } else { pin_error = PIN_ERROR_UNKNOWN; @@ -3619,9 +3639,9 @@ void NetworkLibraryImplCros::SetCellularDataRoamingAllowed(bool new_value) { return; } scoped_ptr<GValue> gvalue(ConvertBoolToGValue(new_value)); - chromeos::SetNetworkDevicePropertyGValue(cellular->device_path().c_str(), - kCellularAllowRoamingProperty, - gvalue.get()); + chromeos::SetNetworkDevicePropertyGValue( + cellular->device_path().c_str(), + flimflam::kCellularAllowRoamingProperty, gvalue.get()); } bool NetworkLibraryImplCros::IsCellularAlwaysInRoaming() { @@ -3642,7 +3662,7 @@ bool NetworkLibraryImplCros::IsCellularAlwaysInRoaming() { void NetworkLibraryImplCros::RequestNetworkScan() { if (wifi_enabled()) { wifi_scanning_ = true; // Cleared when updates are received. - chromeos::RequestNetworkScan(kTypeWifi); + chromeos::RequestNetworkScan(flimflam::kTypeWifi); } if (cellular_network()) cellular_network()->RefreshDataPlansIfNeeded(); @@ -3782,7 +3802,7 @@ void NetworkLibraryImplCros::SetIPConfig(const NetworkIPConfig& ipconfig) { if (ipconfig.address != ipconfig_static->address) { scoped_ptr<GValue> gvalue(ConvertStringToGValue(ipconfig.address)); chromeos::SetNetworkIPConfigPropertyGValue( - ipconfig_static->path, kAddressProperty, gvalue.get()); + ipconfig_static->path, flimflam::kAddressProperty, gvalue.get()); } if (ipconfig.netmask != ipconfig_static->netmask) { int prefixlen = ipconfig.GetPrefixLength(); @@ -3792,18 +3812,20 @@ void NetworkLibraryImplCros::SetIPConfig(const NetworkIPConfig& ipconfig) { } else { scoped_ptr<GValue> gvalue(ConvertIntToGValue(prefixlen)); chromeos::SetNetworkIPConfigPropertyGValue( - ipconfig_static->path, kPrefixlenProperty, gvalue.get()); + ipconfig_static->path, + flimflam::kPrefixlenProperty, gvalue.get()); } } if (ipconfig.gateway != ipconfig_static->gateway) { scoped_ptr<GValue> gvalue(ConvertStringToGValue(ipconfig.gateway)); chromeos::SetNetworkIPConfigPropertyGValue( - ipconfig_static->path, kGatewayProperty, gvalue.get()); + ipconfig_static->path, flimflam::kGatewayProperty, gvalue.get()); } if (ipconfig.name_servers != ipconfig_static->name_servers) { scoped_ptr<GValue> gvalue(ConvertStringToGValue(ipconfig.name_servers)); chromeos::SetNetworkIPConfigPropertyGValue( - ipconfig_static->path, kNameServersProperty, gvalue.get()); + ipconfig_static->path, + flimflam::kNameServersProperty, gvalue.get()); } // Remove dhcp ip config if there is one. if (ipconfig_dhcp) @@ -3946,7 +3968,7 @@ void NetworkLibraryImplCros::ParseNetworkManager(const DictionaryValue& dict) { NetworkManagerStatusChanged(key.c_str(), value); } // If there is no Profiles entry, request remembered networks here. - if (!dict.HasKey(kProfilesProperty)) + if (!dict.HasKey(flimflam::kProfilesProperty)) RequestRememberedNetworksUpdate(); } @@ -4231,7 +4253,7 @@ void NetworkLibraryImplCros::ProfileUpdate( VLOG(1) << "Received ProfileUpdate for: " << profile_path; scoped_ptr<DictionaryValue> dict(ConvertGHashTable(ghash)); ListValue* entries(NULL); - dict->GetList(kEntriesProperty, &entries); + dict->GetList(flimflam::kEntriesProperty, &entries); DCHECK(entries); networklib->UpdateRememberedServiceList(profile_path, entries); } |