Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(635)

Side by Side Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js

Issue 2984843003: MD Settings: Convert all usages of .bind(this) to use ES6 arrow function. (Closed)
Patch Set: Resolve conflicts. Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.exportPath('settings'); 5 cr.exportPath('settings');
6 6
7 var PairingEventType = chrome.bluetoothPrivate.PairingEventType; 7 var PairingEventType = chrome.bluetoothPrivate.PairingEventType;
8 8
9 // NOTE(dbeam): even though this behavior is only used privately, it must 9 // NOTE(dbeam): even though this behavior is only used privately, it must
10 // be globally accessible for Closure's --polymer_pass to compile happily. 10 // be globally accessible for Closure's --polymer_pass to compile happily.
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 device: this.pairingDevice, 233 device: this.pairingDevice,
234 response: response 234 response: response
235 }; 235 };
236 if (response == chrome.bluetoothPrivate.PairingResponse.CONFIRM) { 236 if (response == chrome.bluetoothPrivate.PairingResponse.CONFIRM) {
237 var pairing = this.pairingEvent_.pairing; 237 var pairing = this.pairingEvent_.pairing;
238 if (pairing == PairingEventType.REQUEST_PINCODE) 238 if (pairing == PairingEventType.REQUEST_PINCODE)
239 options.pincode = this.$$('#pincode').value; 239 options.pincode = this.$$('#pincode').value;
240 else if (pairing == PairingEventType.REQUEST_PASSKEY) 240 else if (pairing == PairingEventType.REQUEST_PASSKEY)
241 options.passkey = parseInt(this.$$('#passkey').value, 10); 241 options.passkey = parseInt(this.$$('#passkey').value, 10);
242 } 242 }
243 this.bluetoothPrivate.setPairingResponse(options, function() { 243 this.bluetoothPrivate.setPairingResponse(options, () => {
244 if (chrome.runtime.lastError) { 244 if (chrome.runtime.lastError) {
245 // TODO(stevenjb): Show error. 245 // TODO(stevenjb): Show error.
246 console.error( 246 console.error(
247 'Error setting pairing response: ' + options.device.name + 247 'Error setting pairing response: ' + options.device.name +
248 ': Response: ' + options.response + 248 ': Response: ' + options.response +
249 ': Error: ' + chrome.runtime.lastError.message); 249 ': Error: ' + chrome.runtime.lastError.message);
250 } 250 }
251 this.close(); 251 this.close();
252 }.bind(this)); 252 });
253 253
254 this.fire('response', options); 254 this.fire('response', options);
255 }, 255 },
256 256
257 /** 257 /**
258 * @param {!PairingEventType} eventType 258 * @param {!PairingEventType} eventType
259 * @return {string} 259 * @return {string}
260 * @private 260 * @private
261 */ 261 */
262 getEventDesc_: function(eventType) { 262 getEventDesc_: function(eventType) {
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 this.getDialog_().cancel(); 386 this.getDialog_().cancel();
387 }, 387 },
388 388
389 /** @private */ 389 /** @private */
390 onDialogCanceled_: function() { 390 onDialogCanceled_: function() {
391 if (this.dialogId == 'pairDevice') 391 if (this.dialogId == 'pairDevice')
392 this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL); 392 this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL);
393 this.endPairing(); 393 this.endPairing();
394 }, 394 },
395 }); 395 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698