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() {
updateHidden('#details-internet-page .wifi-details',
this.type_ != 'WiFi');
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 .proxy-details', !this.showProxy_);
......@@ -644,7 +644,7 @@ cr.define('options.internet', function() {
var connectable = onc.getActiveValue('Connectable');
if (connectState != 'Connected' &&
(!connectable || onc.getWiFiSecurity() != 'None' ||
(this.type_ == 'Wimax' || this.type_ == 'VPN'))) {
(this.type_ == 'WiMAX' || this.type_ == 'VPN'))) {
$('details-internet-configure').hidden = false;
} else {
$('details-internet-configure').hidden = true;
......@@ -667,7 +667,7 @@ cr.define('options.internet', function() {
var showActivate = false;
if (type == 'WiFi') {
$('wifi-connection-state').textContent = connectionStateString;
} else if (type == 'Wimax') {
} else if (type == 'WiMAX') {
$('wimax-connection-state').textContent = connectionStateString;
} else if (type == 'Cellular') {
$('activation-state').textContent =
......@@ -710,7 +710,7 @@ cr.define('options.internet', function() {
typeKey = 'ethernetTitle';
else if (type == 'WiFi')
typeKey = 'wifiTitle';
else if (type == 'Wimax')
else if (type == 'WiMAX')
typeKey = 'wimaxTitle';
else if (type == 'Cellular')
typeKey = 'cellularTitle';
......@@ -1076,7 +1076,7 @@ cr.define('options.internet', function() {
'setAutoConnect',
'auto-connect-network-wifi',
'Options_NetworkAutoConnect');
} else if (type == 'Wimax') {
} else if (type == 'WiMAX') {
sendCheckedIfEnabled(servicePath,
'setAutoConnect',
'auto-connect-network-wimax',
......@@ -1398,9 +1398,9 @@ cr.define('options.internet', function() {
var networkName = onc.getTranslatedValue('Name');
// Signal strength as percentage (for WiFi and Wimax).
// Signal strength as percentage (for WiFi and WiMAX).
var signalStrength;
if (type == 'WiFi' || type == 'Wimax')
if (type == 'WiFi' || type == 'WiMAX')
signalStrength = onc.getActiveValue(type + '.SignalStrength');
if (!signalStrength)
signalStrength = 0;
......@@ -1433,14 +1433,14 @@ cr.define('options.internet', function() {
$('auto-connect-network-wifi').checked =
onc.getActiveValue('WiFi.AutoConnect');
$('auto-connect-network-wifi').disabled = !remembered;
} else if (type == 'Wimax') {
} else if (type == 'WiMAX') {
OptionsPage.showTab($('wimax-network-nav-tab'));
$('wimax-restricted-connectivity').textContent = restrictedString;
$('auto-connect-network-wimax').checked =
onc.getActiveValue('Wimax.AutoConnect');
onc.getActiveValue('WiMAX.AutoConnect');
$('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);
$('wimax-signal-strength').textContent = strengthString;
} else if (type == 'Cellular') {
......
......@@ -40,7 +40,7 @@ cr.define('options.network', function() {
*/
Constants.NETWORK_ORDER = ['Ethernet',
'WiFi',
'Wimax',
'WiMAX',
'Cellular',
'VPN',
'addConnection'];
......@@ -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') {
addendum.push({});
if (this.data_.key == 'WiFi') {
......@@ -562,12 +562,12 @@ cr.define('options.network', function() {
chrome.send('disableNetworkType', ['WiFi']);
},
data: {}});
} else if (this.data_.key == 'Wimax') {
} else if (this.data_.key == 'WiMAX') {
addendum.push({
label: loadTimeData.getString('turnOffWimax'),
command: function() {
// TODO(stevenjb): chrome.networkingPrivate.disableNetworkType
chrome.send('disableNetworkType', ['Wimax']);
chrome.send('disableNetworkType', ['WiMAX']);
},
data: {}});
} else if (this.data_.key == 'Cellular') {
......@@ -1044,11 +1044,11 @@ cr.define('options.network', function() {
// Only show wimax control if available. Uses cellular icons.
if (data.wimaxAvailable) {
if (data.wimaxEnabled)
loadData_('Wimax', data.wirelessList, data.rememberedList);
loadData_('WiMAX', data.wirelessList, data.rememberedList);
else
addEnableNetworkButton_('Wimax');
addEnableNetworkButton_('WiMAX');
} else {
networkList.deleteItem('Wimax');
networkList.deleteItem('WiMAX');
}
// Only show VPN control if there is at least one VPN configured.
......@@ -1066,7 +1066,7 @@ cr.define('options.network', function() {
*/
function addEnableNetworkButton_(type) {
var subtitle = loadTimeData.getString('networkDisabled');
var icon = (type == 'Wimax') ? 'Cellular' : type;
var icon = (type == 'WiMAX') ? 'Cellular' : type;
var enableNetwork = function() {
if (type == 'WiFi')
sendChromeMetricsAction('Options_NetworkWifiToggle');
......
......@@ -723,6 +723,12 @@ void FakeShillManagerClient::SetupDefaultEnvironment() {
services->SetServiceProperty("/service/wimax1",
shill::kConnectableProperty,
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
......
......@@ -108,6 +108,8 @@ const FieldTranslationEntry vpn_fields[] = {
const FieldTranslationEntry wifi_fields[] = {
{ ::onc::wifi::kAutoConnect, shill::kAutoConnectProperty},
{ ::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::kFrequencyList, shill::kWifiFrequencyListProperty},
{ ::onc::wifi::kHiddenSSID, shill::kWifiHiddenSsid},
......@@ -121,6 +123,8 @@ const FieldTranslationEntry wifi_fields[] = {
const FieldTranslationEntry wimax_fields[] = {
{ ::onc::wimax::kAutoConnect, shill::kAutoConnectProperty},
// This dictionary is converted during translation, see onc_translator_*.
// { ::onc::wimax::kEAP, shill::kEap*},
{ ::onc::wimax::kSignalStrength, shill::kSignalStrengthProperty},
{NULL}};
......
......@@ -79,6 +79,7 @@ class ShillToONCTranslator {
void TranslateIPsec();
void TranslateVPN();
void TranslateWiFiWithState();
void TranslateWiMAXWithState();
void TranslateCellularWithState();
void TranslateCellularDevice();
void TranslateNetworkWithState();
......@@ -160,6 +161,8 @@ ShillToONCTranslator::CreateTranslatedONCObject() {
TranslateIPsec();
} else if (onc_signature_ == &kWiFiWithStateSignature) {
TranslateWiFiWithState();
} else if (onc_signature_ == &kWiMAXWithStateSignature) {
TranslateWiMAXWithState();
} else if (onc_signature_ == &kCellularWithStateSignature) {
if (field_translation_table_ == kCellularDeviceTable)
TranslateCellularDevice();
......@@ -317,6 +320,12 @@ void ShillToONCTranslator::TranslateWiFiWithState() {
if (!ssid.empty())
onc_object_->SetStringWithoutPathExpansion(::onc::wifi::kSSID, ssid);
CopyPropertiesAccordingToSignature();
TranslateAndAddNestedObject(::onc::wifi::kEAP);
}
void ShillToONCTranslator::TranslateWiMAXWithState() {
CopyPropertiesAccordingToSignature();
TranslateAndAddNestedObject(::onc::wimax::kEAP);
}
void ShillToONCTranslator::TranslateCellularWithState() {
......
......@@ -2,9 +2,7 @@
"AutoConnect": true,
"Connectable": true,
"Name": "SomeWiMAX",
"EAP.EAP": "TLS",
"EAP.Identity": "${LOGIN_ID}@my.domain.com",
"EAP.UseSystemCAs": true,
"GUID": "{77db0089-0bc8-4358-929c-123xcv}",
"Profile": "/profile/someuser",
"SaveCredentials": true,
......
......@@ -3,6 +3,11 @@
"Name":"",
"Type":"WiFi",
"WiFi":{
"EAP": {
"Identity": "abc ${LOGIN_ID}@my.domain.com",
"SaveCredentials": true,
"UseSystemCAs": true
},
"SSID":"SomeWifi-XY",
"Security":"WPA-EAP"
}
......
......@@ -6,6 +6,10 @@
"Name": "SomeWiMAX",
"WiMAX": {
"AutoConnect": true,
"EAP": {
"Identity": "${LOGIN_ID}@my.domain.com",
"SaveCredentials": true
},
"SignalStrength": 10
},
"Source":"User"
......
......@@ -356,6 +356,16 @@
Wi-Fi settings.
</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>
<dd>
<span class="field_meta">
......@@ -1862,6 +1872,52 @@
</p>
</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>
<h1>Cellular Networks</h1>
<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