Chromium Code Reviews| Index: chrome/browser/resources/settings/site_settings/usb_devices.js |
| diff --git a/chrome/browser/resources/settings/site_settings/usb_devices.js b/chrome/browser/resources/settings/site_settings/usb_devices.js |
| index 836bdf66b35a07912d28f4af81c677a3d0e454e5..247c0b3ddd7e299f5b8b96c739b85c7f814e8352 100644 |
| --- a/chrome/browser/resources/settings/site_settings/usb_devices.js |
| +++ b/chrome/browser/resources/settings/site_settings/usb_devices.js |
| @@ -16,9 +16,15 @@ Polymer({ |
| properties: { |
| /** |
| * A list of all USB devices. |
| - * @type {Array<UsbDeviceEntry>} |
| + * @private {!Array<!UsbDeviceEntry>} |
| */ |
| - devices: Array, |
| + devices_: Array, |
| + |
| + /** |
| + * The targetted object for menu operations. |
| + * @private {?Object} |
| + */ |
| + actionMenuModel_: Object |
| }, |
| ready: function() { |
| @@ -31,19 +37,32 @@ Polymer({ |
| */ |
| fetchUsbDevices_: function() { |
| this.browserProxy.fetchUsbDevices().then(function(deviceList) { |
| - this.devices = deviceList; |
| + this.devices_ = deviceList; |
| }.bind(this)); |
| }, |
| /** |
| * A handler when an action is selected in the action menu. |
| - * @param {!{model: !{item: UsbDeviceEntry}}} event |
| * @private |
| */ |
| - onActionMenuIronActivate_: function(event) { |
| - var item = event.model.item; |
| + onRemoveTap_: function() { |
| + var item = this.actionMenuModel_; |
| this.browserProxy.removeUsbDevice( |
| item.origin, item.embeddingOrigin, item.object); |
|
dpapad
2016/11/09 21:37:42
How does the dialog get closed after we tap the re
dpapad
2016/11/10 17:35:09
^^ Also can we ensure that the test checks that th
scottchen
2016/11/10 19:17:48
Done.
scottchen
2016/11/10 19:17:48
Done.
|
| + this.actionMenuModel_ = null; |
| this.fetchUsbDevices_(); |
| }, |
| + |
| + /** |
| + * A handler to show the action menu next to the clicked menu button. |
| + * @param {!{model: !{item: UsbDeviceEntry}}} event |
| + * @private |
| + */ |
| + showMenu_: function(event) { |
| + this.actionMenuModel_ = event.model.item; |
| + /** @type {!CrActionMenuElement} */ ( |
| + this.$$('dialog[is=cr-action-menu]')).showAt( |
| + /** @type {!Element} */ ( |
| + Polymer.dom(/** @type {!Event} */ (event)).localTarget)); |
| + } |
| }); |