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

Side by Side Diff: ui/webui/resources/cr_elements/network/cr_network_list.js

Issue 2597013002: Run clang-format on ui/webui/resources (Closed)
Patch Set: remove cr_shared_menu.js Created 4 years 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Polymer element for displaying a collapsable list of networks. 6 * @fileoverview Polymer element for displaying a collapsable list of networks.
7 */ 7 */
8 8
9 /** 9 /**
10 * Polymer class definition for 'cr-network-list'. 10 * Polymer class definition for 'cr-network-list'.
11 */ 11 */
12 Polymer({ 12 Polymer({
13 is: 'cr-network-list', 13 is: 'cr-network-list',
14 14
15 properties: { 15 properties: {
16 /** 16 /**
17 * The maximum height in pixels for the list. 17 * The maximum height in pixels for the list.
18 */ 18 */
19 maxHeight: { 19 maxHeight: {
20 type: Number, 20 type: Number,
21 value: 1000, 21 value: 1000,
22 observer: 'maxHeightChanged_', 22 observer: 'maxHeightChanged_',
23 }, 23 },
24 24
25 /** 25 /**
26 * The list of network state properties for the items to display. 26 * The list of network state properties for the items to display.
27 * @type {!Array<!CrOnc.NetworkStateProperties>} 27 * @type {!Array<!CrOnc.NetworkStateProperties>}
28 */ 28 */
29 networks: { 29 networks: {type: Array, value: function() { return []; }},
30 type: Array,
31 value: function() {
32 return [];
33 }
34 },
35 30
36 /** 31 /**
37 * The list of custom items to display after the list of networks. 32 * The list of custom items to display after the list of networks.
38 * @type {!Array<!CrNetworkList.CustomItemState>} 33 * @type {!Array<!CrNetworkList.CustomItemState>}
39 */ 34 */
40 customItems: { 35 customItems: {type: Array, value: function() { return []; }},
41 type: Array,
42 value: function() {
43 return [];
44 }
45 },
46 36
47 /** True if action buttons should be shown for the itmes. */ 37 /** True if action buttons should be shown for the itmes. */
48 showButtons: { 38 showButtons: {
49 type: Boolean, 39 type: Boolean,
50 value: false, 40 value: false,
51 reflectToAttribute: true, 41 reflectToAttribute: true,
52 }, 42 },
53 43
54 /** Whether to show separators between all items. */ 44 /** Whether to show separators between all items. */
55 showSeparators: { 45 showSeparators: {
(...skipping 15 matching lines...) Expand all
71 behaviors: [CrScrollableBehavior], 61 behaviors: [CrScrollableBehavior],
72 62
73 observers: ['listChanged_(networks, customItems)'], 63 observers: ['listChanged_(networks, customItems)'],
74 64
75 /** @private */ 65 /** @private */
76 maxHeightChanged_: function() { 66 maxHeightChanged_: function() {
77 this.$.container.style.maxHeight = this.maxHeight + 'px'; 67 this.$.container.style.maxHeight = this.maxHeight + 'px';
78 }, 68 },
79 69
80 /** @private */ 70 /** @private */
81 listChanged_: function() { 71 listChanged_: function() { this.updateScrollableContents(); },
82 this.updateScrollableContents();
83 },
84 72
85 /** 73 /**
86 * Returns a combined list of networks and custom items. 74 * Returns a combined list of networks and custom items.
87 * @return {!Array<!CrNetworkList.CrNetworkListItemType>} 75 * @return {!Array<!CrNetworkList.CrNetworkListItemType>}
88 * @private 76 * @private
89 */ 77 */
90 getItems_: function() { 78 getItems_: function() {
91 let customItems = this.customItems.slice(); 79 let customItems = this.customItems.slice();
92 // Flag the first custom item with isFirstCustomItem = true. 80 // Flag the first custom item with isFirstCustomItem = true.
93 if (!this.showSeparators && customItems.length > 0) 81 if (!this.showSeparators && customItems.length > 0)
(...skipping 15 matching lines...) Expand all
109 * @param {!CrNetworkList.CrNetworkListItemType} item 97 * @param {!CrNetworkList.CrNetworkListItemType} item
110 * @private 98 * @private
111 */ 99 */
112 onItemAction_: function(item) { 100 onItemAction_: function(item) {
113 if (item.hasOwnProperty('customItemName')) 101 if (item.hasOwnProperty('customItemName'))
114 this.fire('custom-item-selected', item); 102 this.fire('custom-item-selected', item);
115 else 103 else
116 this.fire('selected', item); 104 this.fire('selected', item);
117 }, 105 },
118 }); 106 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698