| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 settings-certificate-subentry represents an SSL certificate | 6 * @fileoverview settings-certificate-subentry represents an SSL certificate |
| 7 * sub-entry. | 7 * sub-entry. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 this.dispatchCertificateActionEvent_( | 134 this.dispatchCertificateActionEvent_( |
| 135 settings.CertificateAction.EXPORT_PERSONAL); | 135 settings.CertificateAction.EXPORT_PERSONAL); |
| 136 }.bind(this), | 136 }.bind(this), |
| 137 this.onRejected_.bind(this)); | 137 this.onRejected_.bind(this)); |
| 138 } else { | 138 } else { |
| 139 this.browserProxy_.exportCertificate(this.model.id); | 139 this.browserProxy_.exportCertificate(this.model.id); |
| 140 } | 140 } |
| 141 }, | 141 }, |
| 142 | 142 |
| 143 /** | 143 /** |
| 144 * @param {string} certificateType The type of this certificate. | 144 * @param {!settings.CertificateType} certificateType |
| 145 * @param {!CertificateSubnode} model |
| 145 * @return {boolean} Whether the certificate can be edited. | 146 * @return {boolean} Whether the certificate can be edited. |
| 146 * @private | 147 * @private |
| 147 */ | 148 */ |
| 148 canEdit_: function(certificateType) { | 149 canEdit_: function(certificateType, model) { |
| 149 return this.certificateType == settings.CertificateType.CA; | 150 return certificateType == settings.CertificateType.CA && !model.policy; |
| 151 }, |
| 152 |
| 153 /** |
| 154 * @param {!settings.CertificateType} certificateType |
| 155 * @param {!CertificateSubnode} model |
| 156 * @return {boolean} Whether the certificate can be exported. |
| 157 * @private |
| 158 */ |
| 159 canExport_: function(certificateType, model) { |
| 160 if (certificateType == settings.CertificateType.PERSONAL) { |
| 161 return model.extractable; |
| 162 } |
| 163 return true; |
| 164 }, |
| 165 |
| 166 /** |
| 167 * @param {!CertificateSubnode} model |
| 168 * @return {boolean} Whether the certificate can be deleted. |
| 169 * @private |
| 170 */ |
| 171 canDelete_: function(model) { |
| 172 return !model.readonly && !model.policy; |
| 150 }, | 173 }, |
| 151 | 174 |
| 152 /** @private */ | 175 /** @private */ |
| 153 closePopupMenu_: function() { | 176 closePopupMenu_: function() { |
| 154 this.$$('iron-dropdown').close(); | 177 this.$$('iron-dropdown').close(); |
| 155 }, | 178 }, |
| 156 }); | 179 }); |
| OLD | NEW |