| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 * @typedef {{ | 6 * @typedef {{ |
| 7 * id: string, | 7 * id: string, |
| 8 * name: string, | 8 * name: string, |
| 9 * subnodes: Array.<{id: string, name: string, readonly: boolean, | 9 * subnodes: Array<{id: string, name: string, readonly: boolean, |
| 10 * untrusted: boolean, extractable: boolean, | 10 * untrusted: boolean, extractable: boolean, |
| 11 * policy: boolean}> | 11 * policy: boolean}> |
| 12 * }} | 12 * }} |
| 13 */ | 13 */ |
| 14 var CertificateData; | 14 var CertificateData; |
| 15 | 15 |
| 16 cr.define('options', function() { | 16 cr.define('options', function() { |
| 17 /** @const */ var Tree = cr.ui.Tree; | 17 /** @const */ var Tree = cr.ui.Tree; |
| 18 /** @const */ var TreeItem = cr.ui.TreeItem; | 18 /** @const */ var TreeItem = cr.ui.TreeItem; |
| 19 | 19 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 clear: function() { | 136 clear: function() { |
| 137 // Remove all fields without recreating the object since other code | 137 // Remove all fields without recreating the object since other code |
| 138 // references it. | 138 // references it. |
| 139 for (var id in this.treeLookup_) | 139 for (var id in this.treeLookup_) |
| 140 delete this.treeLookup_[id]; | 140 delete this.treeLookup_[id]; |
| 141 this.textContent = ''; | 141 this.textContent = ''; |
| 142 }, | 142 }, |
| 143 | 143 |
| 144 /** | 144 /** |
| 145 * Populate the tree. | 145 * Populate the tree. |
| 146 * @param {Array.<CertificateData>} nodesData Nodes data array. | 146 * @param {Array<CertificateData>} nodesData Nodes data array. |
| 147 */ | 147 */ |
| 148 populate: function(nodesData) { | 148 populate: function(nodesData) { |
| 149 this.clear(); | 149 this.clear(); |
| 150 | 150 |
| 151 for (var i = 0; i < nodesData.length; ++i) { | 151 for (var i = 0; i < nodesData.length; ++i) { |
| 152 var subnodes = nodesData[i].subnodes; | 152 var subnodes = nodesData[i].subnodes; |
| 153 delete nodesData[i].subnodes; | 153 delete nodesData[i].subnodes; |
| 154 | 154 |
| 155 var item = new CertificateTreeFolder(nodesData[i]); | 155 var item = new CertificateTreeFolder(nodesData[i]); |
| 156 this.addAt(item, i); | 156 this.addAt(item, i); |
| 157 | 157 |
| 158 for (var j = 0; j < subnodes.length; ++j) { | 158 for (var j = 0; j < subnodes.length; ++j) { |
| 159 var subitem = new CertificateTreeItem(subnodes[j]); | 159 var subitem = new CertificateTreeItem(subnodes[j]); |
| 160 item.addAt(subitem, j); | 160 item.addAt(subitem, j); |
| 161 } | 161 } |
| 162 // Make tree expanded by default. | 162 // Make tree expanded by default. |
| 163 item.expanded = true; | 163 item.expanded = true; |
| 164 } | 164 } |
| 165 | 165 |
| 166 cr.dispatchSimpleEvent(this, 'change'); | 166 cr.dispatchSimpleEvent(this, 'change'); |
| 167 }, | 167 }, |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 return { | 170 return { |
| 171 CertificatesTree: CertificatesTree | 171 CertificatesTree: CertificatesTree |
| 172 }; | 172 }; |
| 173 }); | 173 }); |
| 174 | 174 |
| OLD | NEW |