Commit 4afa337e authored by dpapad's avatar dpapad Committed by Commit Bot

WebUI: Use const/let instead of var in cr_components/.

Conversions performed with a tool
./node_modules/lebab/bin/index.js \
    --replace ui/webui/resources/cr_components --transform let

A .eslintrc.js file already exists, so probably these violations had
not been fixed at the time it was added.

Bug: 792774
Change-Id: I647bbf9a08c816fe810acf6582a5d9a0a45a96a0
Reviewed-on: https://chromium-review.googlesource.com/c/1354575Reviewed-by: default avatarDan Beam <dbeam@chromium.org>
Commit-Queue: Demetrios Papadopoulos <dpapad@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612822}
parent 79d17cde
......@@ -60,7 +60,7 @@ Polymer({
onOkTap_: function() {
this.$.spinner.active = true;
var whenDone = this.model.id ?
const whenDone = this.model.id ?
this.browserProxy_.editCaCertificateTrust(
this.model.id, this.$.ssl.checked, this.$.email.checked,
this.$.objSign.checked) :
......
......@@ -42,7 +42,7 @@ Polymer({
* @param {string} localizedMessageId
* @return {string}
*/
var getString = localizedMessageId =>
const getString = localizedMessageId =>
loadTimeData.getStringF(localizedMessageId, this.model.name);
switch (this.certificateType) {
......@@ -63,7 +63,7 @@ Polymer({
* @return {string}
*/
getDescriptionText_: function() {
var getString = loadTimeData.getString.bind(loadTimeData);
const getString = loadTimeData.getString.bind(loadTimeData);
switch (this.certificateType) {
case CertificateType.PERSONAL:
return getString('certificateManagerDeleteUserDescription');
......
......@@ -145,7 +145,7 @@ Polymer({
* @private
*/
handleImport_: function(useHardwareBacked, anchor) {
var browserProxy =
const browserProxy =
certificate_manager.CertificatesBrowserProxyImpl.getInstance();
if (this.certificateType == CertificateType.PERSONAL) {
browserProxy.importPersonalCertificate(useHardwareBacked)
......
......@@ -160,7 +160,8 @@ Polymer({
});
this.addEventListener('certificates-error', event => {
var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail);
const detail =
/** @type {!CertificatesErrorEventDetail} */ (event.detail);
this.errorDialogModel_ = detail.error;
this.openDialog_(
'certificates-error-dialog', 'showErrorDialog_', detail.anchor);
......@@ -188,7 +189,7 @@ Polymer({
this.activeDialogAnchor_ = anchor;
this.set(domIfBooleanName, true);
this.async(() => {
var dialog = this.$$(dialogTagName);
const dialog = this.$$(dialogTagName);
dialog.addEventListener('close', () => {
this.set(domIfBooleanName, false);
cr.ui.focusWithoutInk(assert(this.activeDialogAnchor_));
......
......@@ -15,7 +15,7 @@
* anchor: !HTMLElement
* }}
*/
var CertificateActionEventDetail;
let CertificateActionEventDetail;
/**
* The payload of the 'certificates-error' event.
......@@ -24,13 +24,13 @@ var CertificateActionEventDetail;
* anchor: ?HTMLElement
* }}
*/
var CertificatesErrorEventDetail;
let CertificatesErrorEventDetail;
/**
* Enumeration of actions that require a popup menu to be shown to the user.
* @enum {number}
*/
var CertificateAction = {
const CertificateAction = {
DELETE: 0,
EDIT: 1,
EXPORT_PERSONAL: 2,
......@@ -41,4 +41,4 @@ var CertificateAction = {
* The name of the event fired when a certificate action is selected from the
* dropdown menu. CertificateActionEventDetail is passed as the event detail.
*/
var CertificateActionEvent = 'certificate-action';
const CertificateActionEvent = 'certificate-action';
......@@ -62,7 +62,7 @@ Polymer({
/** @private */
validate_: function() {
var isValid =
const isValid =
this.password_ != '' && this.password_ == this.confirmPassword_;
this.$.ok.disabled = !isValid;
},
......
......@@ -144,7 +144,7 @@ Polymer({
/** @private */
onDotsTap_: function() {
var actionMenu = /** @type {!CrActionMenuElement} */ (this.$.menu.get());
const actionMenu = /** @type {!CrActionMenuElement} */ (this.$.menu.get());
actionMenu.showAt(this.$.dots);
},
......
......@@ -19,7 +19,7 @@
* }}
* @see chrome/browser/ui/webui/settings/certificates_handler.cc
*/
var CertificateSubnode;
let CertificateSubnode;
/**
* A data structure describing a certificate that is currently being imported,
......@@ -28,7 +28,7 @@ var CertificateSubnode;
* name: string,
* }}
*/
var NewCertificateSubNode;
let NewCertificateSubNode;
/**
* Top-level grouping node in a certificate list, representing an organization
......@@ -43,7 +43,7 @@ var NewCertificateSubNode;
* }}
* @see chrome/browser/ui/webui/settings/certificates_handler.cc
*/
var CertificatesOrgGroup;
let CertificatesOrgGroup;
/**
* @typedef {{
......@@ -52,7 +52,7 @@ var CertificatesOrgGroup;
* objSign: boolean
* }}
*/
var CaTrustInfo;
let CaTrustInfo;
/**
* Generic error returned from C++ via a Promise reject callback.
......@@ -62,13 +62,13 @@ var CaTrustInfo;
* }}
* @see chrome/browser/ui/webui/settings/certificates_handler.cc
*/
var CertificatesError;
let CertificatesError;
/**
* Enumeration of all possible certificate types.
* @enum {string}
*/
var CertificateType = {
const CertificateType = {
CA: 'ca',
OTHER: 'other',
PERSONAL: 'personal',
......@@ -86,7 +86,7 @@ var CertificateType = {
* }}
* @see chrome/browser/ui/webui/settings/certificates_handler.cc
*/
var CertificatesImportError;
let CertificatesImportError;
cr.define('certificate_manager', function() {
/** @interface */
......
......@@ -9,7 +9,7 @@
* NOTE: This module depends on I18nBehavior which depends on loadTimeData.
*/
var PairingEventType = chrome.bluetoothPrivate.PairingEventType;
const PairingEventType = chrome.bluetoothPrivate.PairingEventType;
Polymer({
is: 'bluetooth-dialog',
......@@ -105,7 +105,7 @@ Polymer({
close: function() {
this.endPairing();
var dialog = this.getDialog_();
const dialog = this.getDialog_();
if (dialog.open)
dialog.close();
},
......@@ -119,7 +119,7 @@ Polymer({
* @return {boolean}
*/
handleError: function(device, lastError, result) {
var error;
let error;
if (lastError) {
error = lastError.message;
} else {
......@@ -135,8 +135,8 @@ Polymer({
}
}
var name = device.name || device.address;
var id = 'bluetooth_connect_' + error;
const name = device.name || device.address;
const id = 'bluetooth_connect_' + error;
if (this.i18nExists(id)) {
this.errorMessage_ = this.i18n(id, name);
} else {
......@@ -256,7 +256,7 @@ Polymer({
* @private
*/
getMessage_: function() {
var message;
let message;
if (!this.pairingEvent_)
message = 'bluetoothStartConnecting';
else
......@@ -289,7 +289,7 @@ Polymer({
showDisplayPassOrPin_: function() {
if (!this.pairingEvent_)
return false;
var pairing = this.pairingEvent_.pairing;
const pairing = this.pairingEvent_.pairing;
return (
pairing == PairingEventType.DISPLAY_PINCODE ||
pairing == PairingEventType.DISPLAY_PASSKEY ||
......@@ -313,7 +313,7 @@ Polymer({
showConnect_: function() {
if (!this.pairingEvent_)
return false;
var pairing = this.pairingEvent_.pairing;
const pairing = this.pairingEvent_.pairing;
return pairing == PairingEventType.REQUEST_PINCODE ||
pairing == PairingEventType.REQUEST_PASSKEY;
},
......@@ -325,13 +325,13 @@ Polymer({
enableConnect_: function() {
if (!this.showConnect_())
return false;
var inputId =
const inputId =
(this.pairingEvent_.pairing == PairingEventType.REQUEST_PINCODE) ?
'#pincode' :
'#passkey';
var crInput = /** @type {!CrInputElement} */ (this.$$(inputId));
const crInput = /** @type {!CrInputElement} */ (this.$$(inputId));
assert(crInput);
/** @type {string} */ var value = crInput.value;
/** @type {string} */ const value = crInput.value;
return !!value && crInput.validate();
},
......@@ -367,11 +367,11 @@ Polymer({
sendResponse_: function(response) {
if (!this.pairingDevice)
return;
var options =
const options =
/** @type {!chrome.bluetoothPrivate.SetPairingResponseOptions} */ (
{device: this.pairingDevice, response: response});
if (response == chrome.bluetoothPrivate.PairingResponse.CONFIRM) {
var pairing = this.pairingEvent_.pairing;
const pairing = this.pairingEvent_.pairing;
if (pairing == PairingEventType.REQUEST_PINCODE)
options.pincode = this.$$('#pincode').value;
else if (pairing == PairingEventType.REQUEST_PASSKEY)
......@@ -414,8 +414,8 @@ Polymer({
getPinDigit_: function(index) {
if (!this.pairingEvent_)
return '';
var digit = '0';
var pairing = this.pairingEvent_.pairing;
let digit = '0';
const pairing = this.pairingEvent_.pairing;
if (pairing == PairingEventType.DISPLAY_PINCODE &&
this.pairingEvent_.pincode &&
index < this.pairingEvent_.pincode.length) {
......@@ -425,7 +425,7 @@ Polymer({
(pairing == PairingEventType.DISPLAY_PASSKEY ||
pairing == PairingEventType.KEYS_ENTERED ||
pairing == PairingEventType.CONFIRM_PASSKEY)) {
var passkeyString =
const passkeyString =
String(this.pairingEvent_.passkey).padStart(this.digits_.length, '0');
digit = passkeyString[index];
}
......@@ -442,7 +442,7 @@ Polymer({
return '';
if (this.pairingEvent_.pairing == PairingEventType.CONFIRM_PASSKEY)
return 'confirm';
var cssClass = 'display';
let cssClass = 'display';
if (this.pairingEvent_.pairing == PairingEventType.DISPLAY_PASSKEY) {
if (index == 0)
cssClass += ' next';
......@@ -451,8 +451,8 @@ Polymer({
} else if (
this.pairingEvent_.pairing == PairingEventType.KEYS_ENTERED &&
this.pairingEvent_.enteredKey) {
var enteredKey = this.pairingEvent_.enteredKey; // 1-7
var lastKey = this.digits_.length; // 6
const enteredKey = this.pairingEvent_.enteredKey; // 1-7
const lastKey = this.digits_.length; // 6
if ((index == -1 && enteredKey > lastKey) || (index + 1 == enteredKey))
cssClass += ' next';
else if (index > enteredKey)
......
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