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

Unified Diff: chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js

Issue 2180823004: Migrate <cr-dialog> from PaperDialogBehavior to native <dialog>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
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);
},

Powered by Google App Engine
This is Rietveld 408576698