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 |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..523078f5e0cd669af5de17f935e92a35113ab2e8 |
| --- /dev/null |
| +++ b/chrome/browser/resources/settings/site_settings/usb_devices.js |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +/** |
| + * @fileoverview |
| + * 'usb-devices' is the polymer element for showing the |
| + * USB Devices category under Site Settings. |
|
dschuyler
2016/08/11 23:28:07
nit: more of this line could go on the line above.
Finnur
2016/08/12 13:11:26
Done.
|
| + */ |
| + |
| +Polymer({ |
| + is: 'usb-devices', |
| + |
| + behaviors: [SiteSettingsBehavior], |
| + |
| + properties: { |
| + /** |
| + * A list of all USB devices. |
| + * @type {Array<UsbDeviceEntry>} |
| + */ |
| + devices: Array, |
| + }, |
| + |
| + ready: function() { |
| + this.fetchUsbDevices_(); |
| + }, |
| + |
| + /** |
| + * Fetch the list of USB devices and update the list. |
| + * @private |
| + */ |
| + fetchUsbDevices_: function() { |
| + this.browserProxy.fetchUsbDevices().then(function(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; |
| + console.log(item); |
|
dschuyler
2016/08/11 23:28:07
Please remove the console.log.
Finnur
2016/08/12 13:11:26
Oops, done.
|
| + this.browserProxy.removeUsbDevice( |
| + item.origin, item.embeddingOrigin, item.object); |
| + this.fetchUsbDevices_(); |
| + }, |
| +}); |