| Index: chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js
|
| diff --git a/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js b/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js
|
| index 426de1940f40e96ed27d54fbad08c4f8ae556f92..55eab7cd590b9d409e0d56177b261ffe9f26eebe 100644
|
| --- a/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js
|
| +++ b/chrome/browser/resources/options/chromeos/bluetooth_pair_device_overlay.js
|
| @@ -17,8 +17,8 @@ var BluetoothPairingEventType = {
|
| CONFIRM_PASSKEY: 'bluetoothConfirmPasskey',
|
| CONNECT_FAILED: 'bluetoothConnectFailed',
|
| CANCELED: 'bluetoothPairingCanceled',
|
| - DISMISSED: 'bluetoothPairingDismissed', // pairing dismissed (succeeded or
|
| - // canceled).
|
| + DISMISSED: 'bluetoothPairingDismissed', // pairing dismissed (succeeded or
|
| + // canceled).
|
| NOOP: '' // Update device but do not show or update the dialog.
|
| };
|
|
|
| @@ -67,14 +67,14 @@ cr.define('options', function() {
|
| * @type {Array<string>}
|
| * @const
|
| */
|
| - var ELEMENTS = ['bluetooth-pairing-passkey-display',
|
| - 'bluetooth-pairing-passkey-entry',
|
| - 'bluetooth-pairing-pincode-entry',
|
| - 'bluetooth-pair-device-connect-button',
|
| - 'bluetooth-pair-device-cancel-button',
|
| - 'bluetooth-pair-device-accept-button',
|
| - 'bluetooth-pair-device-reject-button',
|
| - 'bluetooth-pair-device-dismiss-button'];
|
| + var ELEMENTS = [
|
| + 'bluetooth-pairing-passkey-display', 'bluetooth-pairing-passkey-entry',
|
| + 'bluetooth-pairing-pincode-entry', 'bluetooth-pair-device-connect-button',
|
| + 'bluetooth-pair-device-cancel-button',
|
| + 'bluetooth-pair-device-accept-button',
|
| + 'bluetooth-pair-device-reject-button',
|
| + 'bluetooth-pair-device-dismiss-button'
|
| + ];
|
|
|
| /**
|
| * Encapsulated handling of the Bluetooth device pairing page.
|
| @@ -82,9 +82,10 @@ cr.define('options', function() {
|
| * @extends {cr.ui.pageManager.Page}
|
| */
|
| function BluetoothPairing() {
|
| - Page.call(this, 'bluetoothPairing',
|
| - loadTimeData.getString('bluetoothOptionsPageTabTitle'),
|
| - 'bluetooth-pairing');
|
| + Page.call(
|
| + this, 'bluetoothPairing',
|
| + loadTimeData.getString('bluetoothOptionsPageTabTitle'),
|
| + 'bluetooth-pairing');
|
| }
|
|
|
| cr.addSingletonGetter(BluetoothPairing);
|
| @@ -176,12 +177,12 @@ cr.define('options', function() {
|
| $('bluetooth-pair-device-connect-button').disabled =
|
| $('bluetooth-pincode').value.length == 0;
|
| };
|
| - $('bluetooth-passkey').addEventListener('keydown',
|
| - this.keyDownEventHandler_.bind(this));
|
| - $('bluetooth-pincode').addEventListener('keydown',
|
| - this.keyDownEventHandler_.bind(this));
|
| - $('bluetooth-pairing-close-button').addEventListener('click',
|
| - this.onClose_.bind(this));
|
| + $('bluetooth-passkey')
|
| + .addEventListener('keydown', this.keyDownEventHandler_.bind(this));
|
| + $('bluetooth-pincode')
|
| + .addEventListener('keydown', this.keyDownEventHandler_.bind(this));
|
| + $('bluetooth-pairing-close-button')
|
| + .addEventListener('click', this.onClose_.bind(this));
|
| },
|
|
|
| /** @override */
|
| @@ -205,8 +206,8 @@ cr.define('options', function() {
|
| * @return {boolean} True if the overlay can be displayed.
|
| */
|
| canShowPage: function() {
|
| - return !!(this.event_ && this.event_.device.address &&
|
| - this.event_.pairing);
|
| + return !!(
|
| + this.event_ && this.event_.device.address && this.event_.pairing);
|
| },
|
|
|
| /**
|
| @@ -275,7 +276,7 @@ cr.define('options', function() {
|
| var message = loadTimeData.getString(this.event_.pairing);
|
| assert(typeof this.event_.device.name == 'string');
|
| message = message.replace(
|
| - '%1', /** @type {string} */(this.event_.device.name));
|
| + '%1', /** @type {string} */ (this.event_.device.name));
|
| instructionsEl.textContent = message;
|
|
|
| // Update visibility of dialog elements.
|
| @@ -283,32 +284,42 @@ cr.define('options', function() {
|
| this.updatePasskey_(String(this.event_.passkey));
|
| if (this.event_.pairing == BluetoothPairingEventType.CONFIRM_PASSKEY) {
|
| // Confirming a match between displayed passkeys.
|
| - this.displayElements_(['bluetooth-pairing-passkey-display',
|
| - 'bluetooth-pair-device-accept-button',
|
| - 'bluetooth-pair-device-reject-button']);
|
| + this.displayElements_([
|
| + 'bluetooth-pairing-passkey-display',
|
| + 'bluetooth-pair-device-accept-button',
|
| + 'bluetooth-pair-device-reject-button'
|
| + ]);
|
| $('bluetooth-pair-device-accept-button').disabled = false;
|
| } else {
|
| // Remote entering a passkey.
|
| - this.displayElements_(['bluetooth-pairing-passkey-display',
|
| - 'bluetooth-pair-device-cancel-button']);
|
| + this.displayElements_([
|
| + 'bluetooth-pairing-passkey-display',
|
| + 'bluetooth-pair-device-cancel-button'
|
| + ]);
|
| }
|
| } else if (this.event_.pincode) {
|
| this.updatePasskey_(String(this.event_.pincode));
|
| - this.displayElements_(['bluetooth-pairing-passkey-display',
|
| - 'bluetooth-pair-device-cancel-button']);
|
| - } else if (this.event_.pairing ==
|
| - BluetoothPairingEventType.ENTER_PIN_CODE) {
|
| + this.displayElements_([
|
| + 'bluetooth-pairing-passkey-display',
|
| + 'bluetooth-pair-device-cancel-button'
|
| + ]);
|
| + } else if (
|
| + this.event_.pairing == BluetoothPairingEventType.ENTER_PIN_CODE) {
|
| // Prompting the user to enter a PIN code.
|
| - this.displayElements_(['bluetooth-pairing-pincode-entry',
|
| - 'bluetooth-pair-device-connect-button',
|
| - 'bluetooth-pair-device-cancel-button']);
|
| + this.displayElements_([
|
| + 'bluetooth-pairing-pincode-entry',
|
| + 'bluetooth-pair-device-connect-button',
|
| + 'bluetooth-pair-device-cancel-button'
|
| + ]);
|
| $('bluetooth-pincode').value = '';
|
| - } else if (this.event_.pairing ==
|
| - BluetoothPairingEventType.ENTER_PASSKEY) {
|
| + } else if (
|
| + this.event_.pairing == BluetoothPairingEventType.ENTER_PASSKEY) {
|
| // Prompting the user to enter a passkey.
|
| - this.displayElements_(['bluetooth-pairing-passkey-entry',
|
| - 'bluetooth-pair-device-connect-button',
|
| - 'bluetooth-pair-device-cancel-button']);
|
| + this.displayElements_([
|
| + 'bluetooth-pairing-passkey-entry',
|
| + 'bluetooth-pair-device-connect-button',
|
| + 'bluetooth-pair-device-cancel-button'
|
| + ]);
|
| $('bluetooth-passkey').value = '';
|
| } else if (this.event_.pairing == BluetoothPairingEventType.CONNECTING) {
|
| // Starting the pairing process.
|
| @@ -386,8 +397,8 @@ cr.define('options', function() {
|
| var keyClass =
|
| (this.event_.pairing == BluetoothPairingEventType.REMOTE_PASSKEY ||
|
| this.event_.pairing == BluetoothPairingEventType.REMOTE_PIN_CODE) ?
|
| - 'bluetooth-keyboard-button' :
|
| - 'bluetooth-passkey-char';
|
| + 'bluetooth-keyboard-button' :
|
| + 'bluetooth-passkey-char';
|
| this.clearElement_(passkeyEl);
|
| // Passkey should always have 6 digits.
|
| key = '000000'.substring(0, 6 - key.length) + key;
|
| @@ -529,8 +540,9 @@ cr.define('options', function() {
|
| if (chrome.runtime.lastError) {
|
| var errorMessage = chrome.runtime.lastError.message;
|
| if (errorMessage != 'Connect failed') {
|
| - console.error('bluetoothPrivate.connect: Unexpected error for: ' +
|
| - address + ': ' + errorMessage);
|
| + console.error(
|
| + 'bluetoothPrivate.connect: Unexpected error for: ' + address +
|
| + ': ' + errorMessage);
|
| }
|
| }
|
| switch (result) {
|
| @@ -581,7 +593,5 @@ cr.define('options', function() {
|
| };
|
|
|
| // Export
|
| - return {
|
| - BluetoothPairing: BluetoothPairing
|
| - };
|
| + return {BluetoothPairing: BluetoothPairing};
|
| });
|
|
|