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

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

Issue 1976733002: MD Settings: combine title and ways of closing Bluetooth device dialog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 cf0c1f969c6b0ea24f23ac307af584df2002a6a0..7b410b0c33b6a542dd0f22d203acf840ea53bbda 100644
--- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js
+++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_dialog.js
@@ -65,9 +65,6 @@ settings.BluetoothAddDeviceBehavior = {
this.fire('device-event', e.detail);
/** @type {Event} */(e).stopPropagation();
},
-
- /** @private */
- onAddCancelTap_: function() { this.fire('close-dialog'); },
};
/** @polymerBehavior */
@@ -222,13 +219,6 @@ settings.BluetoothPairDeviceBehavior = {
},
/** @private */
- onPairCancelTap_: function() {
- this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL);
- // Close the dialog immediately.
- this.fire('close-dialog', '');
- },
-
- /** @private */
onDismissTap_: function() { this.fire('close-dialog', ''); },
/** @private */
@@ -336,6 +326,15 @@ Polymer({
},
/**
+ * @param {string} dialogType
+ * @return {string} The title of for that |dialogType|.
+ */
+ getTitle_: function(dialogType) {
+ return this.i18n(dialogType == 'addDevice' ?
+ 'bluetoothAddDevicePageTitle' : 'bluetoothPairDevicePageTitle');
+ },
+
+ /**
* @param {string} currentDialogType
* @param {string} wantedDialogType
* @return {boolean}
@@ -345,6 +344,25 @@ Polymer({
return currentDialogType == wantedDialogType;
},
+ /** @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();
+ },
+
+ /** @private */
+ onIronOverlayCanceled_: function() {
+ if (this.dialogType == 'pairDevice')
+ this.sendResponse_(chrome.bluetoothPrivate.PairingResponse.CANCEL);
+ },
+
+ /** @private */
+ onIronOverlayClosed_: function() {
+ this.fire('close-dialog', '');
+ },
+
open: function() {
this.$.dialog.open();
},

Powered by Google App Engine
This is Rietveld 408576698