Commit 9362ad95 authored by stevenjb's avatar stevenjb Committed by Commit bot

Translate Wimax from Shill -> ONC, fix JS Wimax strings.

This is a follow up CL for 414417 that includes the ONC translation
necessary for the Wimax UI and fixes the JS to use the new WiMAX
capitalization. It also adds a WiMAX entry to the HTML doc.

BUG=414417

Review URL: https://codereview.chromium.org/581213003

Cr-Commit-Position: refs/heads/master@{#295774}
parent 0fbac4d6
...@@ -461,7 +461,7 @@ cr.define('options.internet', function() { ...@@ -461,7 +461,7 @@ cr.define('options.internet', function() {
updateHidden('#details-internet-page .wifi-details', updateHidden('#details-internet-page .wifi-details',
this.type_ != 'WiFi'); this.type_ != 'WiFi');
updateHidden('#details-internet-page .wimax-details', updateHidden('#details-internet-page .wimax-details',
this.type_ != 'Wimax'); this.type_ != 'WiMAX');
updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN'); updateHidden('#details-internet-page .vpn-details', this.type_ != 'VPN');
updateHidden('#details-internet-page .proxy-details', !this.showProxy_); updateHidden('#details-internet-page .proxy-details', !this.showProxy_);
...@@ -644,7 +644,7 @@ cr.define('options.internet', function() { ...@@ -644,7 +644,7 @@ cr.define('options.internet', function() {
var connectable = onc.getActiveValue('Connectable'); var connectable = onc.getActiveValue('Connectable');
if (connectState != 'Connected' && if (connectState != 'Connected' &&
(!connectable || onc.getWiFiSecurity() != 'None' || (!connectable || onc.getWiFiSecurity() != 'None' ||
(this.type_ == 'Wimax' || this.type_ == 'VPN'))) { (this.type_ == 'WiMAX' || this.type_ == 'VPN'))) {
$('details-internet-configure').hidden = false; $('details-internet-configure').hidden = false;
} else { } else {
$('details-internet-configure').hidden = true; $('details-internet-configure').hidden = true;
...@@ -667,7 +667,7 @@ cr.define('options.internet', function() { ...@@ -667,7 +667,7 @@ cr.define('options.internet', function() {
var showActivate = false; var showActivate = false;
if (type == 'WiFi') { if (type == 'WiFi') {
$('wifi-connection-state').textContent = connectionStateString; $('wifi-connection-state').textContent = connectionStateString;
} else if (type == 'Wimax') { } else if (type == 'WiMAX') {
$('wimax-connection-state').textContent = connectionStateString; $('wimax-connection-state').textContent = connectionStateString;
} else if (type == 'Cellular') { } else if (type == 'Cellular') {
$('activation-state').textContent = $('activation-state').textContent =
...@@ -710,7 +710,7 @@ cr.define('options.internet', function() { ...@@ -710,7 +710,7 @@ cr.define('options.internet', function() {
typeKey = 'ethernetTitle'; typeKey = 'ethernetTitle';
else if (type == 'WiFi') else if (type == 'WiFi')
typeKey = 'wifiTitle'; typeKey = 'wifiTitle';
else if (type == 'Wimax') else if (type == 'WiMAX')
typeKey = 'wimaxTitle'; typeKey = 'wimaxTitle';
else if (type == 'Cellular') else if (type == 'Cellular')
typeKey = 'cellularTitle'; typeKey = 'cellularTitle';
...@@ -1076,7 +1076,7 @@ cr.define('options.internet', function() { ...@@ -1076,7 +1076,7 @@ cr.define('options.internet', function() {
'setAutoConnect', 'setAutoConnect',
'auto-connect-network-wifi', 'auto-connect-network-wifi',
'Options_NetworkAutoConnect'); 'Options_NetworkAutoConnect');
} else if (type == 'Wimax') { } else if (type == 'WiMAX') {
sendCheckedIfEnabled(servicePath, sendCheckedIfEnabled(servicePath,
'setAutoConnect', 'setAutoConnect',
'auto-connect-network-wimax', 'auto-connect-network-wimax',
...@@ -1398,9 +1398,9 @@ cr.define('options.internet', function() { ...@@ -1398,9 +1398,9 @@ cr.define('options.internet', function() {
var networkName = onc.getTranslatedValue('Name'); var networkName = onc.getTranslatedValue('Name');
// Signal strength as percentage (for WiFi and Wimax). // Signal strength as percentage (for WiFi and WiMAX).
var signalStrength; var signalStrength;
if (type == 'WiFi' || type == 'Wimax') if (type == 'WiFi' || type == 'WiMAX')
signalStrength = onc.getActiveValue(type + '.SignalStrength'); signalStrength = onc.getActiveValue(type + '.SignalStrength');
if (!signalStrength) if (!signalStrength)
signalStrength = 0; signalStrength = 0;
...@@ -1433,14 +1433,14 @@ cr.define('options.internet', function() { ...@@ -1433,14 +1433,14 @@ cr.define('options.internet', function() {
$('auto-connect-network-wifi').checked = $('auto-connect-network-wifi').checked =
onc.getActiveValue('WiFi.AutoConnect'); onc.getActiveValue('WiFi.AutoConnect');
$('auto-connect-network-wifi').disabled = !remembered; $('auto-connect-network-wifi').disabled = !remembered;
} else if (type == 'Wimax') { } else if (type == 'WiMAX') {
OptionsPage.showTab($('wimax-network-nav-tab')); OptionsPage.showTab($('wimax-network-nav-tab'));
$('wimax-restricted-connectivity').textContent = restrictedString; $('wimax-restricted-connectivity').textContent = restrictedString;
$('auto-connect-network-wimax').checked = $('auto-connect-network-wimax').checked =
onc.getActiveValue('Wimax.AutoConnect'); onc.getActiveValue('WiMAX.AutoConnect');
$('auto-connect-network-wimax').disabled = !remembered; $('auto-connect-network-wimax').disabled = !remembered;
var identity = onc.getActiveValue('Wimax.EAP.Identity'); var identity = onc.getActiveValue('WiMAX.EAP.Identity');
setOrHideParent('wimax-eap-identity', identity); setOrHideParent('wimax-eap-identity', identity);
$('wimax-signal-strength').textContent = strengthString; $('wimax-signal-strength').textContent = strengthString;
} else if (type == 'Cellular') { } else if (type == 'Cellular') {
......
...@@ -40,7 +40,7 @@ cr.define('options.network', function() { ...@@ -40,7 +40,7 @@ cr.define('options.network', function() {
*/ */
Constants.NETWORK_ORDER = ['Ethernet', Constants.NETWORK_ORDER = ['Ethernet',
'WiFi', 'WiFi',
'Wimax', 'WiMAX',
'Cellular', 'Cellular',
'VPN', 'VPN',
'addConnection']; 'addConnection'];
...@@ -550,7 +550,7 @@ cr.define('options.network', function() { ...@@ -550,7 +550,7 @@ cr.define('options.network', function() {
} }
} }
} }
if (this.data_.key == 'WiFi' || this.data_.key == 'Wimax' || if (this.data_.key == 'WiFi' || this.data_.key == 'WiMAX' ||
this.data_.key == 'Cellular') { this.data_.key == 'Cellular') {
addendum.push({}); addendum.push({});
if (this.data_.key == 'WiFi') { if (this.data_.key == 'WiFi') {
...@@ -562,12 +562,12 @@ cr.define('options.network', function() { ...@@ -562,12 +562,12 @@ cr.define('options.network', function() {
chrome.send('disableNetworkType', ['WiFi']); chrome.send('disableNetworkType', ['WiFi']);
}, },
data: {}}); data: {}});
} else if (this.data_.key == 'Wimax') { } else if (this.data_.key == 'WiMAX') {
addendum.push({ addendum.push({
label: loadTimeData.getString('turnOffWimax'), label: loadTimeData.getString('turnOffWimax'),
command: function() { command: function() {
// TODO(stevenjb): chrome.networkingPrivate.disableNetworkType // TODO(stevenjb): chrome.networkingPrivate.disableNetworkType
chrome.send('disableNetworkType', ['Wimax']); chrome.send('disableNetworkType', ['WiMAX']);
}, },
data: {}}); data: {}});
} else if (this.data_.key == 'Cellular') { } else if (this.data_.key == 'Cellular') {
...@@ -1044,11 +1044,11 @@ cr.define('options.network', function() { ...@@ -1044,11 +1044,11 @@ cr.define('options.network', function() {
// Only show wimax control if available. Uses cellular icons. // Only show wimax control if available. Uses cellular icons.
if (data.wimaxAvailable) { if (data.wimaxAvailable) {
if (data.wimaxEnabled) if (data.wimaxEnabled)
loadData_('Wimax', data.wirelessList, data.rememberedList); loadData_('WiMAX', data.wirelessList, data.rememberedList);
else else
addEnableNetworkButton_('Wimax'); addEnableNetworkButton_('WiMAX');
} else { } else {
networkList.deleteItem('Wimax'); networkList.deleteItem('WiMAX');
} }
// Only show VPN control if there is at least one VPN configured. // Only show VPN control if there is at least one VPN configured.
...@@ -1066,7 +1066,7 @@ cr.define('options.network', function() { ...@@ -1066,7 +1066,7 @@ cr.define('options.network', function() {
*/ */
function addEnableNetworkButton_(type) { function addEnableNetworkButton_(type) {
var subtitle = loadTimeData.getString('networkDisabled'); var subtitle = loadTimeData.getString('networkDisabled');
var icon = (type == 'Wimax') ? 'Cellular' : type; var icon = (type == 'WiMAX') ? 'Cellular' : type;
var enableNetwork = function() { var enableNetwork = function() {
if (type == 'WiFi') if (type == 'WiFi')
sendChromeMetricsAction('Options_NetworkWifiToggle'); sendChromeMetricsAction('Options_NetworkWifiToggle');
......
...@@ -723,6 +723,12 @@ void FakeShillManagerClient::SetupDefaultEnvironment() { ...@@ -723,6 +723,12 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
services->SetServiceProperty("/service/wimax1", services->SetServiceProperty("/service/wimax1",
shill::kConnectableProperty, shill::kConnectableProperty,
base::FundamentalValue(true)); base::FundamentalValue(true));
base::FundamentalValue strength_value(80);
services->SetServiceProperty(
"/service/wimax1", shill::kSignalStrengthProperty, strength_value);
base::StringValue identity_value("test.identity");
services->SetServiceProperty(
"/service/wimax1", shill::kEapIdentityProperty, identity_value);
} }
// Cellular // Cellular
......
...@@ -108,6 +108,8 @@ const FieldTranslationEntry vpn_fields[] = { ...@@ -108,6 +108,8 @@ const FieldTranslationEntry vpn_fields[] = {
const FieldTranslationEntry wifi_fields[] = { const FieldTranslationEntry wifi_fields[] = {
{ ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty}, { ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty},
{ ::onc::wifi::kBSSID, shill::kWifiBSsid}, { ::onc::wifi::kBSSID, shill::kWifiBSsid},
// This dictionary is converted during translation, see onc_translator_*.
// { ::onc::wifi::kEAP, shill::kEap*},
{ ::onc::wifi::kFrequency, shill::kWifiFrequency}, { ::onc::wifi::kFrequency, shill::kWifiFrequency},
{ ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty}, { ::onc::wifi::kFrequencyList, shill::kWifiFrequencyListProperty},
{ ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid}, { ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid},
...@@ -121,6 +123,8 @@ const FieldTranslationEntry wifi_fields[] = { ...@@ -121,6 +123,8 @@ const FieldTranslationEntry wifi_fields[] = {
const FieldTranslationEntry wimax_fields[] = { const FieldTranslationEntry wimax_fields[] = {
{ ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty}, { ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty},
// This dictionary is converted during translation, see onc_translator_*.
// { ::onc::wimax::kEAP, shill::kEap*},
{ ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty}, { ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty},
{NULL}}; {NULL}};
......
...@@ -79,6 +79,7 @@ class ShillToONCTranslator { ...@@ -79,6 +79,7 @@ class ShillToONCTranslator {
void TranslateIPsec(); void TranslateIPsec();
void TranslateVPN(); void TranslateVPN();
void TranslateWiFiWithState(); void TranslateWiFiWithState();
void TranslateWiMAXWithState();
void TranslateCellularWithState(); void TranslateCellularWithState();
void TranslateCellularDevice(); void TranslateCellularDevice();
void TranslateNetworkWithState(); void TranslateNetworkWithState();
...@@ -160,6 +161,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() { ...@@ -160,6 +161,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() {
TranslateIPsec(); TranslateIPsec();
} else if (onc_signature_ == &kWiFiWithStateSignature) { } else if (onc_signature_ == &kWiFiWithStateSignature) {
TranslateWiFiWithState(); TranslateWiFiWithState();
} else if (onc_signature_ == &kWiMAXWithStateSignature) {
TranslateWiMAXWithState();
} else if (onc_signature_ == &kCellularWithStateSignature) { } else if (onc_signature_ == &kCellularWithStateSignature) {
if (field_translation_table_ == kCellularDeviceTable) if (field_translation_table_ == kCellularDeviceTable)
TranslateCellularDevice(); TranslateCellularDevice();
...@@ -317,6 +320,12 @@ void ShillToONCTranslator::TranslateWiFiWithState() { ...@@ -317,6 +320,12 @@ void ShillToONCTranslator::TranslateWiFiWithState() {
if (!ssid.empty()) if (!ssid.empty())
onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSSID, ssid); onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSSID, ssid);
CopyPropertiesAccordingToSignature(); CopyPropertiesAccordingToSignature();
TranslateAndAddNestedObject(::onc::wifi::kEAP);
}
void ShillToONCTranslator::TranslateWiMAXWithState() {
CopyPropertiesAccordingToSignature();
TranslateAndAddNestedObject(::onc::wimax::kEAP);
} }
void ShillToONCTranslator::TranslateCellularWithState() { void ShillToONCTranslator::TranslateCellularWithState() {
......
...@@ -2,9 +2,7 @@ ...@@ -2,9 +2,7 @@
"AutoConnect": true, "AutoConnect": true,
"Connectable": true, "Connectable": true,
"Name": "SomeWiMAX", "Name": "SomeWiMAX",
"EAP.EAP": "TLS",
"EAP.Identity": "${LOGIN_ID}@my.domain.com", "EAP.Identity": "${LOGIN_ID}@my.domain.com",
"EAP.UseSystemCAs": true,
"GUID": "{77db0089-0bc8-4358-929c-123xcv}", "GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Profile": "/profile/someuser", "Profile": "/profile/someuser",
"SaveCredentials": true, "SaveCredentials": true,
......
...@@ -3,6 +3,11 @@ ...@@ -3,6 +3,11 @@
"Name":"", "Name":"",
"Type":"WiFi", "Type":"WiFi",
"WiFi":{ "WiFi":{
"EAP": {
"Identity": "abc ${LOGIN_ID}@my.domain.com",
"SaveCredentials": true,
"UseSystemCAs": true
},
"SSID":"SomeWifi-XY", "SSID":"SomeWifi-XY",
"Security":"WPA-EAP" "Security":"WPA-EAP"
} }
......
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
"Name": "SomeWiMAX", "Name": "SomeWiMAX",
"WiMAX": { "WiMAX": {
"AutoConnect": true, "AutoConnect": true,
"EAP": {
"Identity": "${LOGIN_ID}@my.domain.com",
"SaveCredentials": true
},
"SignalStrength": 10 "SignalStrength": 10
}, },
"Source":"User" "Source":"User"
......
...@@ -356,6 +356,16 @@ ...@@ -356,6 +356,16 @@
Wi-Fi settings. Wi-Fi settings.
</dd> </dd>
<dt class="field">WiMAX</dt>
<dd>
<span class="field_meta">
(required if <span class="field">Type</span> is
<span class="value">WiMAX</span>, otherwise ignored)
<span class="type">WiMAX</span>
</span>
WiMAX settings.
</dd>
<dt class="field">Cellular</dt> <dt class="field">Cellular</dt>
<dd> <dd>
<span class="field_meta"> <span class="field_meta">
...@@ -1862,6 +1872,52 @@ ...@@ -1862,6 +1872,52 @@
</p> </p>
</section> </section>
<section>
<h1>WiMAX Networks</h1>
<p>
For WiMAX connections, <span class="field">Type</span> must be set to
<span class="value">WiMAX</span> and the
field <span class="field">WiMAX</span> must be set to an object of
type <span class="type">WiMAX</span>. Currently only used for
representing an existing configuration; ONC configuration of
of <span class="field">WiMAX</span> networks is not yet fully supported.
Contains the following fields:
</p>
<dl class="field_list">
<dt class="field">AutoConnect</dt>
<dd>
<span class="field_meta">
(optional, defaults to <span class="value">false</span>)
<span class="type">boolean</span>
</span>
Indicating that the network should be connected to automatically when
possible.
</dd>
<dt class="field">EAP</dt>
<dd>
<span class="field_meta">
(required)
<span class="type">EAP</span>
</span>
EAP settings.
</dd>
<dt class="field">SignalStrength</dt>
<dd>
<span class="field_meta">
(optional, read-only)
<span class="type">integer</span>
</span>
The current signal strength for this network in the range [0, 100],
provided by the system. If the network is not in range this field will
be set to '0' or not present.
</dd>
</dl>
</section>
<section> <section>
<h1>Cellular Networks</h1> <h1>Cellular Networks</h1>
<p> <p>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment