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

Unified Diff: chrome/browser/resources/settings/site_settings/usb_devices.js

Issue 2480843003: change site-settings -> usb-device to use cr-action-menu instead of paper-menu (Closed)
Patch Set: move helper function out of test function scope Created 4 years, 1 month 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/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..b941e3bea353bbb5aebffea1a8bc46b2f09bacc5 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,34 @@ 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() {
+ this.$$('dialog[is=cr-action-menu]').close();
+
+ var item = this.actionMenuModel_;
this.browserProxy.removeUsbDevice(
item.origin, item.embeddingOrigin, item.object);
+ 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));
+ }
});

Powered by Google App Engine
This is Rietveld 408576698