cros_network_config.mojom: VPNType -> VpnType
This also renames kThirdPartyVPN -> kExtension and kArcVPN -> kArc This is in preparation for merging vpn_list.mojom into cros_network_config and using it in Ash and Settings. Bug: 979314 Change-Id: I2a74156080d59a4ae2f757c8410e01036dedcd68 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1775319 Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Kyle Horimoto <khorimoto@chromium.org> Commit-Queue: Steven Bennetts <stevenjb@chromium.org> Cr-Commit-Position: refs/heads/master@{#691790}
This commit is contained in:

committed by
Commit Bot

parent
b2f3cafe6d
commit
0434bbb21f
ash/system/network
chrome
browser
resources
settings
internet_page
test
data
webui
chromeos
chromeos/services/network_config
ui/webui/resources
@ -54,7 +54,7 @@ using chromeos::network_config::mojom::NetworkFilter;
|
||||
using chromeos::network_config::mojom::NetworkStateProperties;
|
||||
using chromeos::network_config::mojom::NetworkStatePropertiesPtr;
|
||||
using chromeos::network_config::mojom::NetworkType;
|
||||
using chromeos::network_config::mojom::VPNType;
|
||||
using chromeos::network_config::mojom::VpnType;
|
||||
|
||||
namespace ash {
|
||||
namespace tray {
|
||||
@ -75,11 +75,11 @@ bool VpnProviderMatchesNetwork(const VPNProvider& provider,
|
||||
return false;
|
||||
|
||||
// Package name is the vpn provider id for ArcVPNProvider in network state.
|
||||
if (network->vpn->type == VPNType::kArcVPN) {
|
||||
if (network->vpn->type == VpnType::kArc) {
|
||||
return provider.provider_type == VPNProvider::ARC_VPN &&
|
||||
network->vpn->provider_id == provider.package_name;
|
||||
}
|
||||
if (network->vpn->type == VPNType::kThirdPartyVPN) {
|
||||
if (network->vpn->type == VpnType::kExtension) {
|
||||
return provider.provider_type == VPNProvider::THIRD_PARTY_VPN &&
|
||||
network->vpn->provider_id == provider.app_id;
|
||||
}
|
||||
@ -444,7 +444,7 @@ void VPNListView::AddProvidersAndNetworks(const NetworkStateList& networks) {
|
||||
for (const auto& network : networks) {
|
||||
if (network->connection_state == ConnectionStateType::kNotConnected)
|
||||
break;
|
||||
if (network->vpn->type != VPNType::kArcVPN)
|
||||
if (network->vpn->type != VpnType::kArc)
|
||||
continue;
|
||||
|
||||
// If no matched provider found for this network. Show it unnested.
|
||||
|
@ -1271,18 +1271,18 @@ Polymer({
|
||||
} else if (type == mojom.NetworkType.kVPN) {
|
||||
const vpnType = this.managedProperties_.vpn.type;
|
||||
switch (vpnType) {
|
||||
case mojom.VPNType.kThirdPartyVPN:
|
||||
case mojom.VpnType.kExtension:
|
||||
fields.push('vpn.providerName');
|
||||
break;
|
||||
case mojom.VPNType.kArcVPN:
|
||||
case mojom.VpnType.kArc:
|
||||
fields.push('vpn.type');
|
||||
break;
|
||||
case mojom.VPNType.kOpenVPN:
|
||||
case mojom.VpnType.kOpenVPN:
|
||||
fields.push(
|
||||
'vpn.type', 'vpn.host', 'vpn.openVpn.username',
|
||||
'vpn.openVpn.extraHosts');
|
||||
break;
|
||||
case mojom.VPNType.kL2TPIPsec:
|
||||
case mojom.VpnType.kL2TPIPsec:
|
||||
fields.push('vpn.type', 'vpn.host', 'vpn.l2tp.username');
|
||||
break;
|
||||
}
|
||||
@ -1308,10 +1308,10 @@ Polymer({
|
||||
const type = this.managedProperties_.type;
|
||||
if (type == mojom.NetworkType.kVPN) {
|
||||
const vpnType = this.managedProperties_.vpn.type;
|
||||
if (vpnType != mojom.VPNType.kThirdPartyVPN) {
|
||||
if (vpnType != mojom.VpnType.kExtension) {
|
||||
editFields['vpn.host'] = 'String';
|
||||
}
|
||||
if (vpnType == mojom.VPNType.kOpenVPN) {
|
||||
if (vpnType == mojom.VpnType.kOpenVPN) {
|
||||
editFields['vpn.openVpn.username'] = 'String';
|
||||
editFields['vpn.openVpn.extraHosts'] = 'StringArray';
|
||||
}
|
||||
@ -1492,7 +1492,7 @@ Polymer({
|
||||
isArcVpn_: function(managedProperties) {
|
||||
return !!managedProperties &&
|
||||
managedProperties.type == mojom.NetworkType.kVPN &&
|
||||
managedProperties.vpn.type == mojom.VPNType.kArcVPN;
|
||||
managedProperties.vpn.type == mojom.VpnType.kArc;
|
||||
},
|
||||
|
||||
/**
|
||||
@ -1503,7 +1503,7 @@ Polymer({
|
||||
isThirdPartyVpn_: function(managedProperties) {
|
||||
return !!managedProperties &&
|
||||
managedProperties.type == mojom.NetworkType.kVPN &&
|
||||
managedProperties.vpn.type == mojom.VPNType.kThirdPartyVPN;
|
||||
managedProperties.vpn.type == mojom.VpnType.kExtension;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -326,16 +326,16 @@ Polymer({
|
||||
networkStates.forEach(state => {
|
||||
assert(state.type == mojom.NetworkType.kVPN);
|
||||
switch (state.vpn.type) {
|
||||
case mojom.VPNType.kL2TPIPsec:
|
||||
case mojom.VPNType.kOpenVPN:
|
||||
case mojom.VpnType.kL2TPIPsec:
|
||||
case mojom.VpnType.kOpenVPN:
|
||||
builtinNetworkStates.push(state);
|
||||
break;
|
||||
case mojom.VPNType.kThirdPartyVPN:
|
||||
case mojom.VpnType.kExtension:
|
||||
const providerName = state.vpn.providerName;
|
||||
thirdPartyVpns[providerName] = thirdPartyVpns[providerName] || [];
|
||||
thirdPartyVpns[providerName].push(state);
|
||||
break;
|
||||
case mojom.VPNType.kArcVPN:
|
||||
case mojom.VpnType.kArc:
|
||||
const arcProviderName = this.get('VPN.Host', state);
|
||||
if (OncMojo.connectionStateIsConnected(state.connectionState)) {
|
||||
arcVpns[arcProviderName] = arcVpns[arcProviderName] || [];
|
||||
|
@ -180,7 +180,7 @@ class FakeNetworkConfig {
|
||||
OncMojo.getConnectionStateTypeFromString(network.ConnectionState);
|
||||
}
|
||||
if (network.VPN) {
|
||||
mojoNetwork.vpn = {type: OncMojo.getVPNTypeFromString(network.VPN.Type)};
|
||||
mojoNetwork.vpn = {type: OncMojo.getVpnTypeFromString(network.VPN.Type)};
|
||||
if (network.VPN.ThirdPartyVPN) {
|
||||
mojoNetwork.vpn.providerId = network.VPN.ThirdPartyVPN.ExtensionID;
|
||||
mojoNetwork.vpn.providerName = network.VPN.ThirdPartyVPN.ProviderName;
|
||||
|
@ -104,28 +104,28 @@ mojom::ConnectionStateType GetConnectionState(const NetworkState* network,
|
||||
: mojom::ConnectionStateType::kNotConnected;
|
||||
}
|
||||
|
||||
mojom::VPNType OncVpnTypeToMojo(const std::string& onc_vpn_type) {
|
||||
mojom::VpnType OncVpnTypeToMojo(const std::string& onc_vpn_type) {
|
||||
if (onc_vpn_type == ::onc::vpn::kTypeL2TP_IPsec)
|
||||
return mojom::VPNType::kL2TPIPsec;
|
||||
return mojom::VpnType::kL2TPIPsec;
|
||||
if (onc_vpn_type == ::onc::vpn::kOpenVPN)
|
||||
return mojom::VPNType::kOpenVPN;
|
||||
return mojom::VpnType::kOpenVPN;
|
||||
if (onc_vpn_type == ::onc::vpn::kThirdPartyVpn)
|
||||
return mojom::VPNType::kThirdPartyVPN;
|
||||
return mojom::VpnType::kExtension;
|
||||
if (onc_vpn_type == ::onc::vpn::kArcVpn)
|
||||
return mojom::VPNType::kArcVPN;
|
||||
return mojom::VpnType::kArc;
|
||||
NOTREACHED() << "Unsupported ONC VPN type: " << onc_vpn_type;
|
||||
return mojom::VPNType::kOpenVPN;
|
||||
return mojom::VpnType::kOpenVPN;
|
||||
}
|
||||
|
||||
std::string MojoVpnTypeToOnc(mojom::VPNType mojo_vpn_type) {
|
||||
std::string MojoVpnTypeToOnc(mojom::VpnType mojo_vpn_type) {
|
||||
switch (mojo_vpn_type) {
|
||||
case mojom::VPNType::kL2TPIPsec:
|
||||
case mojom::VpnType::kL2TPIPsec:
|
||||
return ::onc::vpn::kTypeL2TP_IPsec;
|
||||
case mojom::VPNType::kOpenVPN:
|
||||
case mojom::VpnType::kOpenVPN:
|
||||
return ::onc::vpn::kOpenVPN;
|
||||
case mojom::VPNType::kThirdPartyVPN:
|
||||
case mojom::VpnType::kExtension:
|
||||
return ::onc::vpn::kThirdPartyVpn;
|
||||
case mojom::VPNType::kArcVPN:
|
||||
case mojom::VpnType::kArc:
|
||||
return ::onc::vpn::kArcVpn;
|
||||
}
|
||||
NOTREACHED();
|
||||
|
@ -369,7 +369,7 @@ TEST_F(CrosNetworkConfigTest, GetNetworkState) {
|
||||
EXPECT_EQ(mojom::NetworkType::kVPN, network->type);
|
||||
EXPECT_EQ(mojom::ConnectionStateType::kConnecting, network->connection_state);
|
||||
ASSERT_TRUE(network->vpn);
|
||||
EXPECT_EQ(mojom::VPNType::kL2TPIPsec, network->vpn->type);
|
||||
EXPECT_EQ(mojom::VpnType::kL2TPIPsec, network->vpn->type);
|
||||
EXPECT_EQ(mojom::OncSource::kNone, network->source);
|
||||
|
||||
// TODO(919691): Test ProxyMode once UIProxyConfigService logic is improved.
|
||||
@ -505,7 +505,7 @@ TEST_F(CrosNetworkConfigTest, GetManagedProperties) {
|
||||
EXPECT_EQ(mojom::ConnectionStateType::kConnecting,
|
||||
properties->connection_state);
|
||||
ASSERT_TRUE(properties->vpn);
|
||||
EXPECT_EQ(mojom::VPNType::kL2TPIPsec, properties->vpn->type);
|
||||
EXPECT_EQ(mojom::VpnType::kL2TPIPsec, properties->vpn->type);
|
||||
}
|
||||
|
||||
// Test managed property policy values.
|
||||
|
@ -121,11 +121,13 @@ enum SecurityType {
|
||||
};
|
||||
|
||||
// The configuration type for virtual networks.
|
||||
enum VPNType {
|
||||
enum VpnType {
|
||||
// Internal VPN types.
|
||||
kL2TPIPsec,
|
||||
kOpenVPN,
|
||||
kThirdPartyVPN,
|
||||
kArcVPN,
|
||||
// External VPN types.
|
||||
kExtension,
|
||||
kArc,
|
||||
};
|
||||
|
||||
// Filter used for requesting lists of network states.
|
||||
@ -185,7 +187,7 @@ struct TetherStateProperties {
|
||||
};
|
||||
|
||||
struct VPNStateProperties {
|
||||
VPNType type;
|
||||
VpnType type;
|
||||
string provider_id;
|
||||
string provider_name;
|
||||
};
|
||||
@ -539,7 +541,7 @@ struct ManagedVPNProperties {
|
||||
ManagedOpenVPNProperties? open_vpn;
|
||||
ManagedString? provider_id;
|
||||
string provider_name;
|
||||
VPNType type;
|
||||
VpnType type;
|
||||
};
|
||||
|
||||
struct ManagedWiFiProperties {
|
||||
@ -633,7 +635,7 @@ struct VPNConfigProperties {
|
||||
OpenVPNConfigProperties? open_vpn;
|
||||
// For existing configurations, this must match the VPN type. Only
|
||||
// configuration of internal VPN types (kOpenVPN and kL2TPIPsec) is supported.
|
||||
VPNType type;
|
||||
VpnType type;
|
||||
};
|
||||
|
||||
struct ConfigProperties {
|
||||
|
@ -308,8 +308,8 @@ Polymer({
|
||||
/** @type{!chromeos.networkConfig.mojom.ActivationStateType}*/ (
|
||||
value));
|
||||
} else if (key == 'vpn.type') {
|
||||
valueStr = OncMojo.getVPNTypeString(
|
||||
/** @type{!chromeos.networkConfig.mojom.VPNType}*/ (value));
|
||||
valueStr = OncMojo.getVpnTypeString(
|
||||
/** @type{!chromeos.networkConfig.mojom.VpnType}*/ (value));
|
||||
} else if (key == 'wifi.security') {
|
||||
valueStr = OncMojo.getSecurityTypeString(
|
||||
/** @type{!chromeos.networkConfig.mojom.SecurityType}*/ (value));
|
||||
|
@ -352,19 +352,19 @@ class OncMojo {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {!chromeos.networkConfig.mojom.VPNType} value
|
||||
* @param {!chromeos.networkConfig.mojom.VpnType} value
|
||||
* @return {string}
|
||||
*/
|
||||
static getVPNTypeString(value) {
|
||||
const VPNType = chromeos.networkConfig.mojom.VPNType;
|
||||
static getVpnTypeString(value) {
|
||||
const VpnType = chromeos.networkConfig.mojom.VpnType;
|
||||
switch (value) {
|
||||
case VPNType.kL2TPIPsec:
|
||||
case VpnType.kL2TPIPsec:
|
||||
return 'L2TP-IPsec';
|
||||
case VPNType.kOpenVPN:
|
||||
case VpnType.kOpenVPN:
|
||||
return 'OpenVPN';
|
||||
case VPNType.kThirdPartyVPN:
|
||||
case VpnType.kExtension:
|
||||
return 'ThirdPartyVPN';
|
||||
case VPNType.kArcVPN:
|
||||
case VpnType.kArc:
|
||||
return 'ARCVPN';
|
||||
}
|
||||
assertNotReached('Unexpected enum value: ' + OncMojo.getEnumString(value));
|
||||
@ -373,22 +373,22 @@ class OncMojo {
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @return {!chromeos.networkConfig.mojom.VPNType}
|
||||
* @return {!chromeos.networkConfig.mojom.VpnType}
|
||||
*/
|
||||
static getVPNTypeFromString(value) {
|
||||
const VPNType = chromeos.networkConfig.mojom.VPNType;
|
||||
static getVpnTypeFromString(value) {
|
||||
const VpnType = chromeos.networkConfig.mojom.VpnType;
|
||||
switch (value) {
|
||||
case 'L2TP-IPsec':
|
||||
return VPNType.kL2TPIPsec;
|
||||
return VpnType.kL2TPIPsec;
|
||||
case 'OpenVPN':
|
||||
return VPNType.kOpenVPN;
|
||||
return VpnType.kOpenVPN;
|
||||
case 'ThirdPartyVPN':
|
||||
return VPNType.kThirdPartyVPN;
|
||||
return VpnType.kExtension;
|
||||
case 'ARCVPN':
|
||||
return VPNType.kArcVPN;
|
||||
return VpnType.kArc;
|
||||
}
|
||||
assertNotReached('Unexpected value: ' + value);
|
||||
return VPNType.kOpenVPN;
|
||||
return VpnType.kOpenVPN;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -546,7 +546,7 @@ class OncMojo {
|
||||
break;
|
||||
case mojom.NetworkType.kVPN:
|
||||
result.vpn = {
|
||||
type: mojom.VPNType.kOpenVPN,
|
||||
type: mojom.VpnType.kOpenVPN,
|
||||
providerId: '',
|
||||
providerName: '',
|
||||
};
|
||||
@ -664,7 +664,7 @@ class OncMojo {
|
||||
case mojom.NetworkType.kVPN:
|
||||
result.vpn = {
|
||||
providerName: '',
|
||||
type: mojom.VPNType.kOpenVPN,
|
||||
type: mojom.VpnType.kOpenVPN,
|
||||
openVpn: {},
|
||||
};
|
||||
break;
|
||||
|
Reference in New Issue
Block a user