Commit 004cb56a authored by Roman Aleksandrov's avatar Roman Aleksandrov Committed by Commit Bot

Migrate away from using 'var' in network directory.

Just simple refactoring.

Bug: 792774
Change-Id: I90e97fb8fd4e1ab5bb91f03b19ec8031eeb24375
Reviewed-on: https://chromium-review.googlesource.com/c/1326145Reviewed-by: default avatarAlexander Hendrich <hendrich@chromium.org>
Reviewed-by: default avatarDemetrios Papadopoulos <dpapad@chromium.org>
Commit-Queue: Roman Aleksandrov <raleksandrov@google.com>
Cr-Commit-Position: refs/heads/master@{#606918}
parent 31aaefcb
......@@ -91,10 +91,10 @@ Polymer({
if (!this.networkProperties || !this.networkProperties.Cellular)
return;
/** @type {!CrOnc.APNProperties|undefined} */ var activeApn;
var cellular = this.networkProperties.Cellular;
/** @type {!chrome.networkingPrivate.ManagedAPNProperties|undefined} */ var
apn = cellular.APN;
/** @type {!CrOnc.APNProperties|undefined} */ let activeApn;
const cellular = this.networkProperties.Cellular;
/** @type {!chrome.networkingPrivate.ManagedAPNProperties|undefined} */
const apn = cellular.APN;
if (apn && apn.AccessPointName) {
activeApn = /** @type {!CrOnc.APNProperties|undefined} */ (
CrOnc.getActiveProperties(apn));
......@@ -113,18 +113,18 @@ Polymer({
*/
setApnSelectList_: function(activeApn) {
// Copy the list of APNs from this.networkProperties.
var result = this.getApnList_().slice();
const result = this.getApnList_().slice();
// Test whether |activeApn| is in the current APN list in networkProperties.
var activeApnInList = activeApn && result.some(function(a) {
const activeApnInList = activeApn && result.some(function(a) {
return a.AccessPointName == activeApn.AccessPointName;
});
// If |activeApn| is specified and not in the list, use the active
// properties for 'other'. Otherwise use any existing 'other' properties.
var otherApnProperties =
const otherApnProperties =
(activeApn && !activeApnInList) ? activeApn : this.otherApn_;
var otherApn = this.createApnObject_(otherApnProperties);
const otherApn = this.createApnObject_(otherApnProperties);
// Always use 'Other' for the name of custom APN entries (the name does
// not get saved).
......@@ -155,7 +155,7 @@ Polymer({
* @private
*/
createApnObject_: function(apnProperties) {
var newApn = {AccessPointName: ''};
const newApn = {AccessPointName: ''};
if (apnProperties)
Object.assign(newApn, apnProperties);
return newApn;
......@@ -169,8 +169,8 @@ Polymer({
getApnList_: function() {
if (!this.networkProperties || !this.networkProperties.Cellular)
return [];
/** @type {!chrome.networkingPrivate.ManagedAPNList|undefined} */ var
apnlist = this.networkProperties.Cellular.APNList;
/** @type {!chrome.networkingPrivate.ManagedAPNList|undefined} */
const apnlist = this.networkProperties.Cellular.APNList;
if (!apnlist)
return [];
return /** @type {!Array<!CrOnc.APNProperties>} */ (
......@@ -183,8 +183,8 @@ Polymer({
* @private
*/
onSelectApnChange_: function(event) {
var target = /** @type {!HTMLSelectElement} */ (event.target);
var accessPointName = target.value;
const target = /** @type {!HTMLSelectElement} */ (event.target);
const accessPointName = target.value;
// When selecting 'Other', don't set a change event unless a valid
// non-default value has been set for Other.
if (this.isOtherSelected_(accessPointName) &&
......@@ -204,7 +204,7 @@ Polymer({
onOtherApnChange_: function(event) {
// TODO(benchan/stevenjb): Move this to shill or
// onc_translator_onc_to_shill.cc.
var value = (event.detail.field == 'AccessPointName') ?
const value = (event.detail.field == 'AccessPointName') ?
event.detail.value.toUpperCase() :
event.detail.value;
this.set('otherApn_.' + event.detail.field, value);
......@@ -226,8 +226,8 @@ Polymer({
* @private
*/
sendApnChange_: function(accessPointName) {
var apnList = this.getApnList_();
var apn = this.findApnInList(apnList, accessPointName);
const apnList = this.getApnList_();
let apn = this.findApnInList(apnList, accessPointName);
if (apn == undefined) {
apn = this.createApnObject_();
if (this.otherApn_) {
......@@ -247,8 +247,8 @@ Polymer({
isOtherSelected_: function(accessPointName) {
if (!this.networkProperties || !this.networkProperties.Cellular)
return false;
var apnList = this.getApnList_();
var apn = this.findApnInList(apnList, accessPointName);
const apnList = this.getApnList_();
const apn = this.findApnInList(apnList, accessPointName);
return apn == undefined;
},
......
......@@ -66,13 +66,13 @@ Polymer({
networkPropertiesChanged_: function() {
if (!this.networkProperties || !this.networkProperties.Cellular)
return;
var cellular = this.networkProperties.Cellular;
const cellular = this.networkProperties.Cellular;
this.mobileNetworkList_ = cellular.FoundNetworks ||
[{NetworkId: 'none', LongName: this.i18n('networkCellularNoNetworks')}];
// Set selectedMobileNetworkId_ after the dom-repeat has been stamped.
this.async(() => {
var selected = this.mobileNetworkList_.find(function(mobileNetwork) {
let selected = this.mobileNetworkList_.find(function(mobileNetwork) {
return mobileNetwork.Status == 'current';
});
if (!selected)
......@@ -110,7 +110,7 @@ Polymer({
properties.ConnectionState != CrOnc.ConnectionState.NOT_CONNECTED) {
return false;
}
var found = this.get('Cellular.FoundNetworks', properties);
const found = this.get('Cellular.FoundNetworks', properties);
return !!found && found.length > 0;
},
......@@ -122,7 +122,7 @@ Polymer({
getSecondaryText_: function(properties) {
if (!properties || !properties.Cellular)
return '';
var cellular = properties.Cellular;
const cellular = properties.Cellular;
if (cellular.Scanning)
return this.i18n('networkCellularScanning');
else if (this.scanRequested_)
......@@ -157,7 +157,7 @@ Polymer({
* @private
*/
onChange_: function(event) {
var target = /** @type {!HTMLSelectElement} */ (event.target);
const target = /** @type {!HTMLSelectElement} */ (event.target);
if (!target.value || target.value == 'none')
return;
this.networkingPrivate.selectCellularMobileNetwork(
......
......@@ -7,7 +7,7 @@
*/
/** @polymerBehavior */
var NetworkConfigElementBehavior = {
const NetworkConfigElementBehavior = {
properties: {
disabled: {
type: Boolean,
......
......@@ -52,7 +52,7 @@ Polymer({
updateSelected_: function() {
// Wait for the dom-repeat to populate the <option> entries.
this.async(function() {
var select = this.$$('select');
const select = this.$$('select');
if (select.value != this.value)
select.value = this.value;
});
......@@ -69,8 +69,8 @@ Polymer({
return this.getCertificateName_(
/** @type {chrome.networkingPrivate.Certificate}*/ (item));
}
var key = /** @type {string} */ (item);
var oncKey = 'Onc' + prefix.replace(/\./g, '-') + '_' + key;
const key = /** @type {string} */ (item);
const oncKey = 'Onc' + prefix.replace(/\./g, '-') + '_' + key;
if (this.i18nExists(oncKey))
return this.i18n(oncKey);
assertNotReached('ONC Key not found: ' + oncKey);
......@@ -95,7 +95,7 @@ Polymer({
*/
getItemEnabled_: function(item) {
if (this.certList) {
var cert = /** @type {chrome.networkingPrivate.Certificate}*/ (item);
const cert = /** @type {chrome.networkingPrivate.Certificate}*/ (item);
return !!cert.hash;
}
return true;
......
......@@ -81,21 +81,21 @@ Polymer({
if (!this.networkProperties)
return;
var properties = this.networkProperties;
const properties = this.networkProperties;
if (newValue.GUID != (oldValue && oldValue.GUID))
this.savedStaticIp_ = undefined;
// Update the 'automatic' property.
if (properties.IPAddressConfigType) {
var ipConfigType = CrOnc.getActiveValue(properties.IPAddressConfigType);
const ipConfigType = CrOnc.getActiveValue(properties.IPAddressConfigType);
this.automatic_ = (ipConfigType != CrOnc.IPConfigType.STATIC);
}
if (properties.IPConfigs || properties.StaticIPConfig) {
// Update the 'ipConfig' property.
var ipv4 = this.getIPConfigUIProperties_(
const ipv4 = this.getIPConfigUIProperties_(
CrOnc.getIPConfigForType(properties, CrOnc.IPType.IPV4));
var ipv6 = this.getIPConfigUIProperties_(
let ipv6 = this.getIPConfigUIProperties_(
CrOnc.getIPConfigForType(properties, CrOnc.IPType.IPV6));
if (properties.ConnectionState == CrOnc.ConnectionState.CONNECTED &&
ipv4 && ipv4.IPAddress) {
......@@ -111,7 +111,7 @@ Polymer({
/** @private */
onAutomaticChange_: function() {
if (!this.automatic_) {
var defaultIpv4 = {
const defaultIpv4 = {
Gateway: '192.168.1.1',
IPAddress: '192.168.1.1',
RoutingPrefix: '255.255.255.0',
......@@ -147,9 +147,9 @@ Polymer({
getIPConfigUIProperties_: function(ipconfig) {
if (!ipconfig)
return undefined;
var result = {};
for (var key in ipconfig) {
var value = ipconfig[key];
const result = {};
for (const key in ipconfig) {
const value = ipconfig[key];
if (key == 'RoutingPrefix')
result.RoutingPrefix = CrOnc.getRoutingPrefixAsNetmask(value);
else
......@@ -165,9 +165,9 @@ Polymer({
* @private
*/
getIPConfigProperties_: function(ipconfig) {
var result = {};
for (var key in ipconfig) {
var value = ipconfig[key];
const result = {};
for (const key in ipconfig) {
const value = ipconfig[key];
if (key == 'RoutingPrefix')
result.RoutingPrefix = CrOnc.getRoutingPrefixAsLength(value);
else
......@@ -183,7 +183,7 @@ Polymer({
hasIpConfigFields_: function() {
if (!this.ipConfigFields_)
return false;
for (var i = 0; i < this.ipConfigFields_.length; ++i) {
for (let i = 0; i < this.ipConfigFields_.length; ++i) {
if (this.get(this.ipConfigFields_[i], this.ipConfig_) != undefined)
return true;
}
......@@ -213,8 +213,8 @@ Polymer({
onIPChange_: function(event) {
if (!this.ipConfig_)
return;
var field = event.detail.field;
var value = event.detail.value;
const field = event.detail.field;
const value = event.detail.value;
// Note: |field| includes the 'ipv4.' prefix.
this.set('ipConfig_.' + field, value);
this.sendStaticIpConfig_();
......
......@@ -81,16 +81,16 @@ Polymer({
this.savedNameservers_ = [];
// Update the 'nameservers' property.
var nameservers = [];
var ipv4 =
let nameservers = [];
const ipv4 =
CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
if (ipv4 && ipv4.NameServers)
nameservers = ipv4.NameServers;
// Update the 'nameserversType' property.
var configType =
const configType =
CrOnc.getActiveValue(this.networkProperties.NameServersConfigType);
var type;
let type;
if (configType == CrOnc.IPConfigType.STATIC) {
if (nameservers.join(',') == this.GOOGLE_NAMESERVERS.join(',')) {
type = 'google';
......@@ -114,7 +114,7 @@ Polymer({
setNameservers_: function(nameserversType, nameservers, sendNameservers) {
if (nameserversType == 'custom') {
// Add empty entries for unset custom nameservers.
for (var i = nameservers.length; i < this.MAX_NAMESERVERS; ++i)
for (let i = nameservers.length; i < this.MAX_NAMESERVERS; ++i)
nameservers[i] = '';
this.savedNameservers_ = nameservers.slice();
}
......@@ -165,7 +165,7 @@ Polymer({
* @private
*/
onTypeChange_: function() {
var type = this.$$('#nameserverType').selected;
const type = this.$$('#nameserverType').selected;
this.nameserversType_ = type;
if (type == 'custom') {
// Restore the saved nameservers.
......@@ -193,12 +193,12 @@ Polymer({
* @private
*/
sendNameServers_: function() {
var type = this.nameserversType_;
const type = this.nameserversType_;
if (type == 'custom') {
var nameservers = new Array(this.MAX_NAMESERVERS);
for (var i = 0; i < this.MAX_NAMESERVERS; ++i) {
var nameserverInput = this.$$('#nameserver' + i);
const nameservers = new Array(this.MAX_NAMESERVERS);
for (let i = 0; i < this.MAX_NAMESERVERS; ++i) {
const nameserverInput = this.$$('#nameserver' + i);
nameservers[i] = nameserverInput ? nameserverInput.value : '';
}
this.nameservers_ = nameservers;
......
......@@ -75,14 +75,14 @@ Polymer({
onValueChange_: function(event) {
if (!this.propertyDict)
return;
var key = event.target.id;
var curValue = this.get(key, this.propertyDict);
const key = event.target.id;
let curValue = this.get(key, this.propertyDict);
if (typeof curValue == 'object' && !Array.isArray(curValue)) {
// Extract the property from an ONC managed dictionary.
curValue = CrOnc.getActiveValue(
/** @type {!CrOnc.ManagedProperty} */ (curValue));
}
var newValue = this.getValueFromEditField_(key, event.target.value);
const newValue = this.getValueFromEditField_(key, event.target.value);
if (newValue == curValue)
return;
this.fire('property-change', {field: key, value: newValue});
......@@ -95,15 +95,15 @@ Polymer({
* @private
*/
getPropertyLabel_: function(key, prefix) {
var oncKey = 'Onc' + prefix + key;
let oncKey = 'Onc' + prefix + key;
oncKey = oncKey.replace(/\./g, '-');
if (this.i18nExists(oncKey))
return this.i18n(oncKey);
// We do not provide translations for every possible network property key.
// For keys specific to a type, strip the type prefix.
var result = prefix + key;
for (var entry in chrome.networkingPrivate.NetworkType) {
var type = chrome.networkingPrivate.NetworkType[entry];
let result = prefix + key;
for (const entry in chrome.networkingPrivate.NetworkType) {
const type = chrome.networkingPrivate.NetworkType[entry];
if (result.startsWith(type + '.')) {
result = result.substr(type.length + 1);
break;
......@@ -123,7 +123,7 @@ Polymer({
return key => {
if (editFieldTypes.hasOwnProperty(key))
return true;
var value = this.getPropertyValue_(key, prefix, propertyDict);
const value = this.getPropertyValue_(key, prefix, propertyDict);
return value !== undefined && value !== '';
};
},
......@@ -135,12 +135,12 @@ Polymer({
* @private
*/
isPropertyEditable_: function(key, propertyDict) {
var property = /** @type {!CrOnc.ManagedProperty|undefined} */ (
const property = /** @type {!CrOnc.ManagedProperty|undefined} */ (
this.get(key, propertyDict));
if (property === undefined) {
// Unspecified properties in policy configurations are not user
// modifiable. https://crbug.com/819837.
var source = propertyDict.Source;
const source = propertyDict.Source;
return source != 'UserPolicy' && source != 'DevicePolicy';
}
return !this.isNetworkPolicyEnforced(property);
......@@ -153,7 +153,7 @@ Polymer({
* @private
*/
isEditType_: function(key, editFieldTypes) {
var editType = editFieldTypes[key];
const editType = editFieldTypes[key];
return editType == 'String' || editType == 'StringArray' ||
editType == 'Password';
},
......@@ -198,7 +198,7 @@ Polymer({
* @private
*/
getProperty_: function(key, propertyDict) {
var property = this.get(key, propertyDict);
const property = this.get(key, propertyDict);
if (property === undefined && propertyDict.Source) {
// Provide an empty property object with the network policy source.
// See https://crbug.com/819837 for more info.
......@@ -215,7 +215,7 @@ Polymer({
* @private
*/
getPropertyValue_: function(key, prefix, propertyDict) {
var value = this.get(key, propertyDict);
let value = this.get(key, propertyDict);
if (value === undefined)
return '';
if (typeof value == 'object' && !Array.isArray(value)) {
......@@ -226,15 +226,15 @@ Polymer({
if (Array.isArray(value))
return value.join(', ');
var customValue = this.getCustomPropertyValue_(key, value);
const customValue = this.getCustomPropertyValue_(key, value);
if (customValue)
return customValue;
if (typeof value == 'number' || typeof value == 'boolean')
return value.toString();
assert(typeof value == 'string');
var valueStr = /** @type {string} */ (value);
var oncKey = 'Onc' + prefix + key;
const valueStr = /** @type {string} */ (value);
let oncKey = 'Onc' + prefix + key;
oncKey = oncKey.replace(/\./g, '-');
oncKey += '_' + valueStr;
if (this.i18nExists(oncKey))
......@@ -250,7 +250,7 @@ Polymer({
* @private
*/
getValueFromEditField_(key, fieldValue) {
var editType = this.editFieldTypes[key];
const editType = this.editFieldTypes[key];
if (editType == 'StringArray')
return fieldValue.toString().split(/, */);
return fieldValue;
......
......@@ -150,12 +150,12 @@ Polymer({
return;
/** @type {!CrOnc.ProxySettings} */
var proxy = this.createDefaultProxySettings_();
const proxy = this.createDefaultProxySettings_();
// For shared networks with unmanaged proxy settings, ignore any saved
// proxy settings (use the default values).
if (this.isShared_()) {
var property = this.getProxySettingsTypeProperty_();
const property = this.getProxySettingsTypeProperty_();
if (!this.isControlled(property) && !this.useSharedProxies) {
this.setProxyAsync_(proxy);
return; // Proxy settings will be ignored.
......@@ -163,7 +163,7 @@ Polymer({
}
/** @type {!chrome.networkingPrivate.ManagedProxySettings|undefined} */
var proxySettings = this.networkProperties.ProxySettings;
const proxySettings = this.networkProperties.ProxySettings;
if (proxySettings) {
proxy.Type = /** @type {!CrOnc.ProxySettingsType} */ (
CrOnc.getActiveValue(proxySettings.Type));
......@@ -185,7 +185,7 @@ Polymer({
/** @type {!CrOnc.ProxyLocation|undefined} */ (
CrOnc.getActiveProperties(proxySettings.Manual.SOCKS)) ||
{Host: '', Port: 80};
var jsonHttp = proxy.Manual.HTTPProxy;
const jsonHttp = proxy.Manual.HTTPProxy;
this.useSameProxy_ =
(CrOnc.proxyMatches(jsonHttp, proxy.Manual.SecureHTTPProxy) &&
CrOnc.proxyMatches(jsonHttp, proxy.Manual.FTPProxy) &&
......@@ -206,7 +206,7 @@ Polymer({
proxy.Manual = proxy.Manual || this.savedManual_;
// Set the Web Proxy Auto Discovery URL.
var ipv4 =
const ipv4 =
CrOnc.getIPConfigForType(this.networkProperties, CrOnc.IPType.IPV4);
this.WPAD_ = (ipv4 && ipv4.WebProxyAutoDiscoveryUrl) ||
this.i18n('networkProxyWpadNone');
......@@ -254,11 +254,11 @@ Polymer({
* @private
*/
sendProxyChange_: function() {
var proxy =
const proxy =
/** @type {!CrOnc.ProxySettings} */ (Object.assign({}, this.proxy_));
if (proxy.Type == CrOnc.ProxySettingsType.MANUAL) {
var manual = proxy.Manual;
var defaultProxy = manual.HTTPProxy || {Host: '', Port: 80};
const manual = proxy.Manual;
const defaultProxy = manual.HTTPProxy || {Host: '', Port: 80};
if (this.useSameProxy_) {
proxy.Manual.SecureHTTPProxy = /** @type {!CrOnc.ProxyLocation} */ (
Object.assign({}, defaultProxy));
......@@ -293,12 +293,12 @@ Polymer({
* @private
*/
onTypeChange_: function(event) {
var target = /** @type {!HTMLSelectElement} */ (event.target);
var type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ (
const target = /** @type {!HTMLSelectElement} */ (event.target);
const type = /** @type {chrome.networkingPrivate.ProxySettingsType} */ (
target.value);
this.set('proxy_.Type', type);
var proxyTypeChangeIsReady;
var elementToFocus;
let proxyTypeChangeIsReady;
let elementToFocus;
switch (type) {
case CrOnc.ProxySettingsType.DIRECT:
case CrOnc.ProxySettingsType.WPAD:
......@@ -346,7 +346,7 @@ Polymer({
/** @private */
onAddProxyExclusionTap_: function() {
var value = this.$.proxyExclusion.value;
const value = this.$.proxyExclusion.value;
if (!value)
return;
this.push('proxy_.ExcludeDomains', value);
......@@ -414,7 +414,7 @@ Polymer({
return false;
if (!this.networkProperties.hasOwnProperty('ProxySettings'))
return true; // No proxy settings defined, so not enforced.
var property = /** @type {!CrOnc.ManagedProperty|undefined} */ (
const property = /** @type {!CrOnc.ManagedProperty|undefined} */ (
this.get('ProxySettings.' + propertyName, this.networkProperties));
if (!property)
return true;
......@@ -447,8 +447,8 @@ Polymer({
isSaveManualProxyEnabled_: function() {
if (!this.proxyIsUserModified_)
return false;
var manual = this.proxy_.Manual;
var httpHost = this.get('HTTPProxy.Host', manual);
const manual = this.proxy_.Manual;
const httpHost = this.get('HTTPProxy.Host', manual);
if (this.useSameProxy_)
return !!httpHost;
return !!httpHost || !!this.get('SecureHTTPProxy.Host', manual) ||
......
......@@ -38,7 +38,7 @@ Polymer({
* @private
*/
onRemoveTap_: function(event) {
var index = event.model.index;
const index = event.model.index;
this.splice('exclusions', index, 1);
this.fire('proxy-change');
}
......
......@@ -52,7 +52,7 @@ Polymer({
* @private
*/
onValueChange_: function() {
var port = parseInt(this.value.Port, 10);
let port = parseInt(this.value.Port, 10);
if (isNaN(port))
port = 80;
this.value.Port = port;
......
......@@ -7,7 +7,7 @@
*/
/** @enum {string} */
var ErrorType = {
const ErrorType = {
NONE: 'none',
INCORRECT_PIN: 'incorrect-pin',
INCORRECT_PUK: 'incorrect-puk',
......@@ -18,9 +18,9 @@ var ErrorType = {
(function() {
var PIN_MIN_LENGTH = 4;
var PUK_MIN_LENGTH = 8;
var TOGGLE_DEBOUNCE_MS = 500;
const PIN_MIN_LENGTH = 4;
const PUK_MIN_LENGTH = 8;
const TOGGLE_DEBOUNCE_MS = 500;
Polymer({
is: 'network-siminfo',
......@@ -161,10 +161,10 @@ Polymer({
networkPropertiesChanged_: function() {
if (!this.networkProperties || !this.networkProperties.Cellular)
return;
var simLockStatus = this.networkProperties.Cellular.SIMLockStatus;
const simLockStatus = this.networkProperties.Cellular.SIMLockStatus;
this.pukRequired_ =
!!simLockStatus && simLockStatus.LockType == CrOnc.LockType.PUK;
var lockEnabled = !!simLockStatus && simLockStatus.LockEnabled;
const lockEnabled = !!simLockStatus && simLockStatus.LockEnabled;
if (lockEnabled != this.lockEnabled_) {
this.setLockEnabled_ = lockEnabled;
this.updateLockEnabled_();
......@@ -223,7 +223,7 @@ Polymer({
// If the PUK was activated while attempting to enter or change a pin,
// close the dialog and open the unlock PUK dialog.
var showUnlockPuk = false;
let showUnlockPuk = false;
if (this.$.enterPinDialog.open) {
this.$.enterPinDialog.close();
showUnlockPuk = true;
......@@ -271,7 +271,7 @@ Polymer({
* @private
*/
setCellularSimState_: function(simState) {
var guid = (this.networkProperties && this.networkProperties.GUID) || '';
const guid = (this.networkProperties && this.networkProperties.GUID) || '';
this.setInProgress_();
this.networkingPrivate.setCellularSimState(guid, simState, () => {
this.inProgress_ = false;
......@@ -292,7 +292,7 @@ Polymer({
* @private
*/
unlockCellularSim_: function(pin, puk) {
var guid = (this.networkProperties && this.networkProperties.GUID) || '';
const guid = (this.networkProperties && this.networkProperties.GUID) || '';
this.setInProgress_();
this.networkingPrivate.unlockCellularSim(guid, pin, puk, () => {
this.inProgress_ = false;
......@@ -316,10 +316,10 @@ Polymer({
event.stopPropagation();
if (!this.enterPinEnabled_)
return;
var pin = this.$.enterPin.value;
const pin = this.$.enterPin.value;
if (!this.validatePin_(pin))
return;
var simState = /** @type {!CrOnc.CellularSimState} */ ({
const simState = /** @type {!CrOnc.CellularSimState} */ ({
currentPin: pin,
requirePin: this.sendSimLockEnabled_,
});
......@@ -352,10 +352,10 @@ Polymer({
*/
sendChangePin_: function(event) {
event.stopPropagation();
var newPin = this.$.changePinNew1.value;
const newPin = this.$.changePinNew1.value;
if (!this.validatePin_(newPin, this.$.changePinNew2.value))
return;
var simState = /** @type {!CrOnc.CellularSimState} */ ({
const simState = /** @type {!CrOnc.CellularSimState} */ ({
requirePin: true,
currentPin: this.$.changePinOld.value,
newPin: newPin
......@@ -384,7 +384,7 @@ Polymer({
*/
sendUnlockPin_: function(event) {
event.stopPropagation();
var pin = this.$.unlockPin.value;
const pin = this.$.unlockPin.value;
if (!this.validatePin_(pin))
return;
this.unlockCellularSim_(pin, '');
......@@ -419,10 +419,10 @@ Polymer({
*/
sendUnlockPuk_: function(event) {
event.stopPropagation();
var puk = this.$.unlockPuk.value;
const puk = this.$.unlockPuk.value;
if (!this.validatePuk_(puk))
return;
var pin = this.$.unlockPin1.value;
const pin = this.$.unlockPin1.value;
if (!this.validatePin_(pin, this.$.unlockPin2.value))
return;
this.unlockCellularSim_(pin, puk);
......@@ -457,7 +457,7 @@ Polymer({
if (this.error_ == ErrorType.NONE)
return '';
// TODO(stevenjb): Translate
var msg;
let msg;
if (this.error_ == ErrorType.INCORRECT_PIN)
msg = 'Incorrect PIN.';
else if (this.error_ == ErrorType.INCORRECT_PUK)
......@@ -470,7 +470,7 @@ Polymer({
msg = 'Invalid PUK.';
else
return 'UNKNOWN ERROR';
var retriesLeft = this.simUnlockSent_ &&
const retriesLeft = this.simUnlockSent_ &&
this.get('Cellular.SIMLockStatus.RetriesLeft', this.networkProperties);
if (retriesLeft) {
msg += ' Retries left: ' + retriesLeft.toString();
......
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