Chromium Code Reviews| Index: chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js |
| diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js |
| index bbddbaf3246aa21e41e6295870d05028349b0717..fe229a0463b7f0464d7973081d8e044a947cbb76 100644 |
| --- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js |
| +++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js |
| @@ -33,11 +33,9 @@ settings.BluetoothAddDeviceBehavior = { |
| }, |
| }, |
| - observers: ['deviceListChanged_(deviceList.*)'], |
| - |
| /** @private */ |
| adapterStateChanged_: function() { |
| - if (!this.adapterState.powered && this.$.dialog.opened) |
| + if (!this.adapterState.powered) |
| this.close(); |
| }, |
| @@ -341,13 +339,22 @@ Polymer({ |
| open: function() { |
| this.pinOrPass = ''; |
| - this.$.dialog.open(); |
| + this.getDialog_().showModal(); |
| }, |
| - close: function() { this.$.dialog.close(); }, |
| + /** |
| + * @return {!CrDialogElement} |
| + * @private |
| + */ |
| + getDialog_: function() { |
| + return /** @type {!CrDialogElement} */ (this.$.dialog); |
| + }, |
| - /** @private */ |
| - deviceListChanged_: function(e) { this.$.dialog.notifyResize(); }, |
| + close: function() { |
| + var dialog = this.getDialog_(); |
| + if (dialog.open) |
| + dialog.close(); |
| + }, |
|
Dan Beam
2016/07/26 23:36:12
arguable nit: this public method should go above p
dpapad
2016/07/27 01:21:47
Done.
|
| /** |
| * @param {string} dialogId |
| @@ -372,14 +379,11 @@ Polymer({ |
| /** @private */ |
| onCancelTap_: function() { |
| - // NOTE: tapping on an element with [dialog-dismiss] doesn't trigger an |
| - // iron-overlay-cancel event, whereas tapping (X) or pressing Esc does. |
| - // Using cancel() ensures all 3 ways to close the dialog run the same code. |
| - this.$.dialog.cancel(); |
| + this.getDialog_().cancel(); |
| }, |
| /** @private */ |
| - onIronOverlayCanceled_: function() { |
| + onDialogCanceled_: function() { |
| if (this.dialogId == 'pairDevice') |
| this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL); |
| }, |