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

Side by Side 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: add annotation to fix closure_compiler 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview 6 * @fileoverview
7 * 'usb-devices' is the polymer element for showing the USB Devices category 7 * 'usb-devices' is the polymer element for showing the USB Devices category
8 * under Site Settings. 8 * under Site Settings.
9 */ 9 */
10 10
11 Polymer({ 11 Polymer({
12 is: 'usb-devices', 12 is: 'usb-devices',
13 13
14 behaviors: [SiteSettingsBehavior], 14 behaviors: [SiteSettingsBehavior],
15 15
16 properties: { 16 properties: {
17 /** 17 /**
18 * A list of all USB devices. 18 * A list of all USB devices.
19 * @type {Array<UsbDeviceEntry>} 19 * @type {Array<UsbDeviceEntry>}
20 */ 20 */
21 devices: Array, 21 devices: Array,
dpapad 2016/11/08 01:53:49 !Array<!UsbDeviceEntry> Also, can we turn this in
scottchen 2016/11/09 19:20:56 Done.
22 /**
dschuyler 2016/11/08 01:48:41 Please add a blank line before the /**.
scottchen 2016/11/09 19:20:56 Done.
23 * The targetted object for menu operations.
24 * @type {?Object}
25 */
26 actionMenuModel: Object
dpapad 2016/11/08 01:53:49 Since this is only used within this file, let's do
scottchen 2016/11/09 19:20:56 Done.
22 }, 27 },
23 28
24 ready: function() { 29 ready: function() {
25 this.fetchUsbDevices_(); 30 this.fetchUsbDevices_();
26 }, 31 },
27 32
28 /** 33 /**
29 * Fetch the list of USB devices and update the list. 34 * Fetch the list of USB devices and update the list.
30 * @private 35 * @private
31 */ 36 */
32 fetchUsbDevices_: function() { 37 fetchUsbDevices_: function() {
33 this.browserProxy.fetchUsbDevices().then(function(deviceList) { 38 this.browserProxy.fetchUsbDevices().then(function(deviceList) {
34 this.devices = deviceList; 39 this.devices = deviceList;
35 }.bind(this)); 40 }.bind(this));
36 }, 41 },
37 42
38 /** 43 /**
39 * A handler when an action is selected in the action menu. 44 * A handler when an action is selected in the action menu.
40 * @param {!{model: !{item: UsbDeviceEntry}}} event 45 * @param {!{model: !{item: UsbDeviceEntry}}} event
41 * @private 46 * @private
42 */ 47 */
43 onActionMenuIronActivate_: function(event) { 48 onRemoveTap_: function(event) {
dpapad 2016/11/08 01:53:49 |event| is no longer used in this method, let's re
scottchen 2016/11/09 19:20:56 Done.
44 var item = event.model.item; 49 var item = this.actionMenuModel;
45 this.browserProxy.removeUsbDevice( 50 this.browserProxy.removeUsbDevice(
46 item.origin, item.embeddingOrigin, item.object); 51 item.origin, item.embeddingOrigin, item.object);
52 this.actionMenuModel = null;
47 this.fetchUsbDevices_(); 53 this.fetchUsbDevices_();
48 }, 54 },
dschuyler 2016/11/08 01:48:40 Please add a blank line here.
dpapad 2016/11/08 01:53:49 Add a blank line between functions.
scottchen 2016/11/09 19:20:56 Done.
scottchen 2016/11/09 19:20:56 Done.
55 showMenu_: function(event) {
dschuyler 2016/11/08 01:48:41 Please add an @param for |event|. Something like t
dpapad 2016/11/08 01:53:49 Need @private and @param annotation.
scottchen 2016/11/09 19:20:56 Done.
scottchen 2016/11/09 19:20:56 Done.
56 this.actionMenuModel = event.model.item;
57 /** @type {!CrActionMenuElement} */ (
58 this.$$('dialog[is=cr-action-menu]')).showAt(
59 /** @type {!Element} */ (
60 Polymer.dom(/** @type {!Event} */ (event)).localTarget));
61 }
49 }); 62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698