OLD | NEW |
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 (function() { | 7 (function() { |
8 | 8 |
9 var PairingEventType = chrome.bluetoothPrivate.PairingEventType; | 9 var PairingEventType = chrome.bluetoothPrivate.PairingEventType; |
10 | 10 |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 I18nBehavior, | 330 I18nBehavior, |
331 settings.BluetoothAddDeviceBehavior, | 331 settings.BluetoothAddDeviceBehavior, |
332 settings.BluetoothPairDeviceBehavior, | 332 settings.BluetoothPairDeviceBehavior, |
333 ], | 333 ], |
334 | 334 |
335 properties: { | 335 properties: { |
336 /** Which version of this dialog to show (adding or pairing). */ | 336 /** Which version of this dialog to show (adding or pairing). */ |
337 dialogId: String, | 337 dialogId: String, |
338 }, | 338 }, |
339 | 339 |
| 340 observers: [ |
| 341 'dialogUpdated_(dialogId, pairingEvent)', |
| 342 ], |
| 343 |
340 open: function() { | 344 open: function() { |
341 this.pinOrPass = ''; | 345 this.pinOrPass = ''; |
342 this.getDialog_().showModal(); | 346 this.getDialog_().showModal(); |
343 }, | 347 }, |
344 | 348 |
345 close: function() { | 349 close: function() { |
346 var dialog = this.getDialog_(); | 350 var dialog = this.getDialog_(); |
347 if (dialog.open) | 351 if (dialog.open) |
348 dialog.close(); | 352 dialog.close(); |
349 }, | 353 }, |
350 | 354 |
| 355 /** @private */ |
| 356 dialogUpdated_: function() { |
| 357 if (this.showEnterPincode_(this.pairingEvent)) |
| 358 this.$$('#pincode').focus(); |
| 359 else if (this.showEnterPasskey_(this.pairingEvent)) |
| 360 this.$$('#passkey').focus(); |
| 361 }, |
| 362 |
351 /** | 363 /** |
352 * @return {!CrDialogElement} | 364 * @return {!CrDialogElement} |
353 * @private | 365 * @private |
354 */ | 366 */ |
355 getDialog_: function() { | 367 getDialog_: function() { |
356 return /** @type {!CrDialogElement} */ (this.$.dialog); | 368 return /** @type {!CrDialogElement} */ (this.$.dialog); |
357 }, | 369 }, |
358 | 370 |
359 /** | 371 /** |
360 * @param {string} dialogId | 372 * @param {string} dialogId |
(...skipping 22 matching lines...) Expand all Loading... |
383 }, | 395 }, |
384 | 396 |
385 /** @private */ | 397 /** @private */ |
386 onDialogCanceled_: function() { | 398 onDialogCanceled_: function() { |
387 if (this.dialogId == 'pairDevice') | 399 if (this.dialogId == 'pairDevice') |
388 this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL); | 400 this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL); |
389 }, | 401 }, |
390 }); | 402 }); |
391 | 403 |
392 })(); | 404 })(); |
OLD | NEW |