Chromium Code Reviews| 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.textContent = (new LocalStrings()).getString("badgeUntrusted"); | |
|
mattm
2011/06/29 01:12:07
localStrings.getString
agl
2011/06/29 14:31:11
Done.
| |
| 30 badge.style.backgroundColor = 'pink' | |
| 31 badge.style.border = '1px solid red' | |
| 32 badge.style.borderRadius = '3px' | |
| 33 badge.style.marginLeft = '3px' | |
| 34 badge.style.paddingLeft = '1px' | |
| 35 badge.style.paddingRight = '1px' | |
|
mattm
2011/06/29 01:12:07
Create a certificate_tree.css and put the style st
agl
2011/06/29 14:31:11
Done.
| |
| 36 treeItem.labelElement.appendChild(badge) | |
|
mattm
2011/06/29 01:12:07
From a UI perspective I wonder if it would look be
agl
2011/06/29 14:31:11
I agree that there's a danger that a long cert nam
| |
| 37 } | |
| 38 | |
| 27 return treeItem; | 39 return treeItem; |
| 28 } | 40 } |
| 29 | 41 |
| 30 CertificateTreeItem.prototype = { | 42 CertificateTreeItem.prototype = { |
| 31 __proto__: TreeItem.prototype, | 43 __proto__: TreeItem.prototype, |
| 32 | 44 |
| 33 /** | 45 /** |
| 34 * The tree path id/. | 46 * The tree path id/. |
| 35 * @type {string} | 47 * @type {string} |
| 36 */ | 48 */ |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 111 | 123 |
| 112 cr.dispatchSimpleEvent(this, 'change'); | 124 cr.dispatchSimpleEvent(this, 'change'); |
| 113 }, | 125 }, |
| 114 }; | 126 }; |
| 115 | 127 |
| 116 return { | 128 return { |
| 117 CertificatesTree: CertificatesTree | 129 CertificatesTree: CertificatesTree |
| 118 }; | 130 }; |
| 119 }); | 131 }); |
| 120 | 132 |
| OLD | NEW |