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

Side by Side Diff: chrome/browser/resources/options/certificate_tree.js

Issue 570503002: Compile chrome://settings, part 6 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@H_options_errors_4
Patch Set: fix asserts, rebase Created 6 years, 3 months 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 (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 /**
6 * @typedef {{
7 * id: string,
8 * name: string,
9 * subnodes: Array.<{id: string, name: string, readonly: boolean,
10 * untrusted: boolean, extractable: boolean,
11 * policy: boolean}>
12 * }}
13 */
14 var CertificateData;
15
5 cr.define('options', function() { 16 cr.define('options', function() {
6 /** @const */ var Tree = cr.ui.Tree; 17 /** @const */ var Tree = cr.ui.Tree;
7 /** @const */ var TreeItem = cr.ui.TreeItem; 18 /** @const */ var TreeItem = cr.ui.TreeItem;
8 19
9 /** 20 /**
10 * Creates a new tree folder for certificate data. 21 * Creates a new tree folder for certificate data.
11 * @param {Object=} data Data used to create a certificate tree folder. 22 * @param {Object=} data Data used to create a certificate tree folder.
12 * @constructor 23 * @constructor
13 * @extends {TreeItem} 24 * @extends {TreeItem}
14 */ 25 */
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 clear: function() { 136 clear: function() {
126 // Remove all fields without recreating the object since other code 137 // Remove all fields without recreating the object since other code
127 // references it. 138 // references it.
128 for (var id in this.treeLookup_) 139 for (var id in this.treeLookup_)
129 delete this.treeLookup_[id]; 140 delete this.treeLookup_[id];
130 this.textContent = ''; 141 this.textContent = '';
131 }, 142 },
132 143
133 /** 144 /**
134 * Populate the tree. 145 * Populate the tree.
135 * @param {Array} nodesData Nodes data array. 146 * @param {Array.<CertificateData>} nodesData Nodes data array.
136 */ 147 */
137 populate: function(nodesData) { 148 populate: function(nodesData) {
138 this.clear(); 149 this.clear();
139 150
140 for (var i = 0; i < nodesData.length; ++i) { 151 for (var i = 0; i < nodesData.length; ++i) {
141 var subnodes = nodesData[i].subnodes; 152 var subnodes = nodesData[i].subnodes;
142 delete nodesData[i].subnodes; 153 delete nodesData[i].subnodes;
143 154
144 var item = new CertificateTreeFolder(nodesData[i]); 155 var item = new CertificateTreeFolder(nodesData[i]);
145 this.addAt(item, i); 156 this.addAt(item, i);
146 157
147 for (var j = 0; j < subnodes.length; ++j) { 158 for (var j = 0; j < subnodes.length; ++j) {
148 var subitem = new CertificateTreeItem(subnodes[j]); 159 var subitem = new CertificateTreeItem(subnodes[j]);
149 item.addAt(subitem, j); 160 item.addAt(subitem, j);
150 } 161 }
151 // Make tree expanded by default. 162 // Make tree expanded by default.
152 item.expanded = true; 163 item.expanded = true;
153 } 164 }
154 165
155 cr.dispatchSimpleEvent(this, 'change'); 166 cr.dispatchSimpleEvent(this, 'change');
156 }, 167 },
157 }; 168 };
158 169
159 return { 170 return {
160 CertificatesTree: CertificatesTree 171 CertificatesTree: CertificatesTree
161 }; 172 };
162 }); 173 });
163 174
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698