OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 cr.define('options', function() { | 5 cr.define('options', function() { |
6 const Tree = cr.ui.Tree; | 6 const Tree = cr.ui.Tree; |
7 const TreeItem = cr.ui.TreeItem; | 7 const TreeItem = cr.ui.TreeItem; |
8 | 8 |
9 /** | 9 /** |
10 * Creates a new tree item for certificate data. | 10 * Creates a new tree item for certificate data. |
11 * @param {Object=} data Data used to create a certificate tree item. | 11 * @param {Object=} data Data used to create a certificate tree item. |
12 * @constructor | 12 * @constructor |
13 * @extends {TreeItem} | 13 * @extends {TreeItem} |
14 */ | 14 */ |
15 function CertificateTreeItem(data) { | 15 function CertificateTreeItem(data) { |
16 // TODO(mattm): other columns | 16 // TODO(mattm): other columns |
17 var treeItem = new TreeItem({ | 17 var treeItem = new TreeItem({ |
18 label: data.name, | 18 label: data.name, |
19 data: data | 19 data: data |
20 }); | 20 }); |
21 treeItem.__proto__ = CertificateTreeItem.prototype; | 21 treeItem.__proto__ = CertificateTreeItem.prototype; |
22 | 22 |
23 if (data.icon) { | 23 if (data.icon) { |
24 treeItem.icon = data.icon; | 24 treeItem.icon = data.icon; |
25 } | 25 } |
26 | 26 |
| 27 if (data.untrusted) { |
| 28 var badge = document.createElement('span'); |
| 29 badge.setAttribute('class', 'certUntrusted'); |
| 30 badge.textContent = localStrings.getString("badgeCertUntrusted"); |
| 31 treeItem.labelElement.insertBefore( |
| 32 badge, treeItem.labelElement.firstChild); |
| 33 } |
| 34 |
27 return treeItem; | 35 return treeItem; |
28 } | 36 } |
29 | 37 |
30 CertificateTreeItem.prototype = { | 38 CertificateTreeItem.prototype = { |
31 __proto__: TreeItem.prototype, | 39 __proto__: TreeItem.prototype, |
32 | 40 |
33 /** | 41 /** |
34 * The tree path id/. | 42 * The tree path id/. |
35 * @type {string} | 43 * @type {string} |
36 */ | 44 */ |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 119 |
112 cr.dispatchSimpleEvent(this, 'change'); | 120 cr.dispatchSimpleEvent(this, 'change'); |
113 }, | 121 }, |
114 }; | 122 }; |
115 | 123 |
116 return { | 124 return { |
117 CertificatesTree: CertificatesTree | 125 CertificatesTree: CertificatesTree |
118 }; | 126 }; |
119 }); | 127 }); |
120 | 128 |
OLD | NEW |