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

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

Issue 2431583005: MD Settings: Bluetooth: Use settings-action-menu dialog (Closed)
Patch Set: Nits Created 4 years, 2 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_list_item.js
diff --git a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js
index 265200451dfd56b5ada37f7d63edaacd2ff60786..32a2774470bf6981e34438feb582703b9f55a55f 100644
--- a/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js
+++ b/chrome/browser/resources/settings/bluetooth_page/bluetooth_device_list_item.js
@@ -9,6 +9,8 @@
Polymer({
is: 'bluetooth-device-list-item',
+ behaviors: [I18nBehavior],
+
properties: {
/**
* The bluetooth device.
@@ -20,15 +22,42 @@ Polymer({
},
/**
- * @param {Event} e
+ * @param {!Event} event
* @private
*/
- menuSelected_: function(e) {
- e.currentTarget.opened = false;
+ onMenuButtonTap_: function(event) {
+ let button = /** @type {!HTMLElement} */ (event.target);
+ let menu = /** @type {!SettingsActionMenuElement} */ (this.$.dotsMenu);
+ menu.showAt(button);
+ event.stopPropagation();
+ },
+
+ /** @private */
+ onConnectActionTap_: function() {
+ let action = this.isDisconnected_(this.device) ? 'connect' : 'disconnect';
this.fire('device-event', {
- action: e.target.id,
+ action: action,
device: this.device,
});
+ /** @type {!SettingsActionMenuElement} */ (this.$.dotsMenu).close();
+ },
+
+ /** @private */
+ onRemoveTap_: function() {
+ this.fire('device-event', {
+ action: 'remove',
+ device: this.device,
+ });
+ /** @type {!SettingsActionMenuElement} */ (this.$.dotsMenu).close();
+ },
+
+ /**
+ * @param {boolean} connected
+ * @return {string} The text to display for the connect/disconnect menu item.
+ * @private
+ */
+ getConnectActionText_: function(connected) {
+ return this.i18n(connected ? 'bluetoothDisconnect' : 'bluetoothConnect');
},
/**

Powered by Google App Engine
This is Rietveld 408576698