diff options
author | stevenjb <stevenjb@chromium.org> | 2014-09-19 14:03:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-19 21:03:59 +0000 |
commit | 9362ad95966777d8689476acbef35a31421831c3 (patch) | |
tree | 1616e0e37828d5deed272adb7ba35528c6d182c8 | |
parent | 0fbac4d6271f2eaacd8d67800ba5dce7781578b4 (diff) | |
download | chromium_src-9362ad95966777d8689476acbef35a31421831c3.zip chromium_src-9362ad95966777d8689476acbef35a31421831c3.tar.gz chromium_src-9362ad95966777d8689476acbef35a31421831c3.tar.bz2 |
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}
9 files changed, 102 insertions, 20 deletions
diff --git a/chrome/browser/resources/options/chromeos/internet_detail.js b/chrome/browser/resources/options/chromeos/internet_detail.js index d907ae8..f4c6ca2 100644 --- a/chrome/browser/resources/options/chromeos/internet_detail.js +++ b/chrome/browser/resources/options/chromeos/internet_detail.js @@ -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') { diff --git a/chrome/browser/resources/options/chromeos/network_list.js b/chrome/browser/resources/options/chromeos/network_list.js index d82ec20..8ba909c 100644 --- a/chrome/browser/resources/options/chromeos/network_list.js +++ b/chrome/browser/resources/options/chromeos/network_list.js @@ -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'); diff --git a/chromeos/dbus/fake_shill_manager_client.cc b/chromeos/dbus/fake_shill_manager_client.cc index 25ad05d..2ef8327 100644 --- a/chromeos/dbus/fake_shill_manager_client.cc +++ b/chromeos/dbus/fake_shill_manager_client.cc @@ -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 diff --git a/chromeos/network/onc/onc_translation_tables.cc b/chromeos/network/onc/onc_translation_tables.cc index 2f8fa9c..30ccd9d 100644 --- a/chromeos/network/onc/onc_translation_tables.cc +++ b/chromeos/network/onc/onc_translation_tables.cc @@ -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}}; diff --git a/chromeos/network/onc/onc_translator_shill_to_onc.cc b/chromeos/network/onc/onc_translator_shill_to_onc.cc index d7bc265..43bb42f 100644 --- a/chromeos/network/onc/onc_translator_shill_to_onc.cc +++ b/chromeos/network/onc/onc_translator_shill_to_onc.cc @@ -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() { diff --git a/chromeos/test/data/network/shill_wimax_with_state.json b/chromeos/test/data/network/shill_wimax_with_state.json index ed12a13..ececaa8 100644 --- a/chromeos/test/data/network/shill_wimax_with_state.json +++ b/chromeos/test/data/network/shill_wimax_with_state.json @@ -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, diff --git a/chromeos/test/data/network/translation_of_shill_wifi_clientcert.onc b/chromeos/test/data/network/translation_of_shill_wifi_clientcert.onc index cd01e6d..1f2956c 100644 --- a/chromeos/test/data/network/translation_of_shill_wifi_clientcert.onc +++ b/chromeos/test/data/network/translation_of_shill_wifi_clientcert.onc @@ -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" } diff --git a/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc index c8a83f6..3be399b 100644 --- a/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc +++ b/chromeos/test/data/network/translation_of_shill_wimax_with_state.onc @@ -6,6 +6,10 @@ "Name": "SomeWiMAX", "WiMAX": { "AutoConnect": true, + "EAP": { + "Identity": "${LOGIN_ID}@my.domain.com", + "SaveCredentials": true + }, "SignalStrength": 10 }, "Source":"User" diff --git a/components/onc/docs/onc_spec.html b/components/onc/docs/onc_spec.html index acfd64f..686dfda 100644 --- a/components/onc/docs/onc_spec.html +++ b/components/onc/docs/onc_spec.html @@ -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"> @@ -1863,6 +1873,52 @@ </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> For Cellular connections, <span class="field">Type</span> must be set to |