| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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-manager-page' is the settings page | 6 * @fileoverview 'settings-certificate-manager-page' is the settings page |
| 7 * containing SSL certificate settings. | 7 * containing SSL certificate settings. |
| 8 */ | 8 */ |
| 9 Polymer({ | 9 Polymer({ |
| 10 is: 'settings-certificate-manager-page', | 10 is: 'settings-certificate-manager-page', |
| 11 | 11 |
| 12 behaviors: [WebUIListenerBehavior], | 12 behaviors: [WebUIListenerBehavior], |
| 13 | 13 |
| 14 properties: { | 14 properties: { |
| 15 /** @type {number} */ | 15 /** @type {number} */ |
| 16 selected: { | 16 selected: { |
| 17 type: Number, | 17 type: Number, |
| 18 value: 0, | 18 value: 0, |
| 19 }, | 19 }, |
| 20 | 20 |
| 21 /** @type {!Array<!Certificate>} */ | 21 /** @type {!Array<!Certificate>} */ |
| 22 personalCerts: { | 22 personalCerts: { |
| 23 type: Array, | 23 type: Array, |
| 24 value: function() { return []; }, | 24 value: function() { |
| 25 return []; |
| 26 }, |
| 25 }, | 27 }, |
| 26 | 28 |
| 27 /** @type {!Array<!Certificate>} */ | 29 /** @type {!Array<!Certificate>} */ |
| 28 serverCerts: { | 30 serverCerts: { |
| 29 type: Array, | 31 type: Array, |
| 30 value: function() { return []; }, | 32 value: function() { |
| 33 return []; |
| 34 }, |
| 31 }, | 35 }, |
| 32 | 36 |
| 33 /** @type {!Array<!Certificate>} */ | 37 /** @type {!Array<!Certificate>} */ |
| 34 caCerts: { | 38 caCerts: { |
| 35 type: Array, | 39 type: Array, |
| 36 value: function() { return []; }, | 40 value: function() { |
| 41 return []; |
| 42 }, |
| 37 }, | 43 }, |
| 38 | 44 |
| 39 /** @type {!Array<!Certificate>} */ | 45 /** @type {!Array<!Certificate>} */ |
| 40 otherCerts: { | 46 otherCerts: { |
| 41 type: Array, | 47 type: Array, |
| 42 value: function() { return []; }, | 48 value: function() { |
| 49 return []; |
| 50 }, |
| 43 }, | 51 }, |
| 44 | 52 |
| 45 /** @private */ | 53 /** @private */ |
| 46 certificateTypeEnum_: { | 54 certificateTypeEnum_: { |
| 47 type: Object, | 55 type: Object, |
| 48 value: CertificateType, | 56 value: CertificateType, |
| 49 readOnly: true, | 57 readOnly: true, |
| 50 }, | 58 }, |
| 51 | 59 |
| 52 /** @private */ | 60 /** @private */ |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 ready: function() { | 112 ready: function() { |
| 105 this.addEventListener(settings.CertificateActionEvent, function(event) { | 113 this.addEventListener(settings.CertificateActionEvent, function(event) { |
| 106 this.dialogModel_ = event.detail.subnode; | 114 this.dialogModel_ = event.detail.subnode; |
| 107 this.dialogModelCertificateType_ = event.detail.certificateType; | 115 this.dialogModelCertificateType_ = event.detail.certificateType; |
| 108 | 116 |
| 109 if (event.detail.action == CertificateAction.IMPORT) { | 117 if (event.detail.action == CertificateAction.IMPORT) { |
| 110 if (event.detail.certificateType == CertificateType.PERSONAL) { | 118 if (event.detail.certificateType == CertificateType.PERSONAL) { |
| 111 this.openDialog_( | 119 this.openDialog_( |
| 112 'settings-certificate-password-decryption-dialog', | 120 'settings-certificate-password-decryption-dialog', |
| 113 'showPasswordDecryptionDialog_'); | 121 'showPasswordDecryptionDialog_'); |
| 114 } else if (event.detail.certificateType == | 122 } else if (event.detail.certificateType == CertificateType.CA) { |
| 115 CertificateType.CA) { | |
| 116 this.openDialog_( | 123 this.openDialog_( |
| 117 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_'); | 124 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_'); |
| 118 } | 125 } |
| 119 } else { | 126 } else { |
| 120 if (event.detail.action == CertificateAction.EDIT) { | 127 if (event.detail.action == CertificateAction.EDIT) { |
| 121 this.openDialog_( | 128 this.openDialog_( |
| 122 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_'); | 129 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_'); |
| 123 } else if (event.detail.action == CertificateAction.DELETE) { | 130 } else if (event.detail.action == CertificateAction.DELETE) { |
| 124 this.openDialog_( | 131 this.openDialog_( |
| 125 'settings-certificate-delete-confirmation-dialog', | 132 'settings-certificate-delete-confirmation-dialog', |
| 126 'showDeleteConfirmationDialog_'); | 133 'showDeleteConfirmationDialog_'); |
| 127 } else if (event.detail.action == | 134 } else if (event.detail.action == CertificateAction.EXPORT_PERSONAL) { |
| 128 CertificateAction.EXPORT_PERSONAL) { | |
| 129 this.openDialog_( | 135 this.openDialog_( |
| 130 'settings-certificate-password-encryption-dialog', | 136 'settings-certificate-password-encryption-dialog', |
| 131 'showPasswordEncryptionDialog_'); | 137 'showPasswordEncryptionDialog_'); |
| 132 } | 138 } |
| 133 } | 139 } |
| 134 | 140 |
| 135 event.stopPropagation(); | 141 event.stopPropagation(); |
| 136 }.bind(this)); | 142 }.bind(this)); |
| 137 | 143 |
| 138 this.addEventListener('certificates-error', function(event) { | 144 this.addEventListener('certificates-error', function(event) { |
| 139 this.errorDialogModel_ = event.detail; | 145 this.errorDialogModel_ = event.detail; |
| 140 this.openDialog_( | 146 this.openDialog_( |
| 141 'settings-certificates-error-dialog', | 147 'settings-certificates-error-dialog', 'showErrorDialog_'); |
| 142 'showErrorDialog_'); | |
| 143 event.stopPropagation(); | 148 event.stopPropagation(); |
| 144 }.bind(this)); | 149 }.bind(this)); |
| 145 }, | 150 }, |
| 146 | 151 |
| 147 /** | 152 /** |
| 148 * Opens a dialog and registers a listener for removing the dialog from the | 153 * Opens a dialog and registers a listener for removing the dialog from the |
| 149 * DOM once is closed. The listener is destroyed when the dialog is removed | 154 * DOM once is closed. The listener is destroyed when the dialog is removed |
| 150 * (because of 'restamp'). | 155 * (because of 'restamp'). |
| 151 * | 156 * |
| 152 * @param {string} dialogTagName The tag name of the dialog to be shown. | 157 * @param {string} dialogTagName The tag name of the dialog to be shown. |
| 153 * @param {string} domIfBooleanName The name of the boolean variable | 158 * @param {string} domIfBooleanName The name of the boolean variable |
| 154 * corresponding to the dialog. | 159 * corresponding to the dialog. |
| 155 * @private | 160 * @private |
| 156 */ | 161 */ |
| 157 openDialog_: function(dialogTagName, domIfBooleanName) { | 162 openDialog_: function(dialogTagName, domIfBooleanName) { |
| 158 this.set(domIfBooleanName, true); | 163 this.set(domIfBooleanName, true); |
| 159 this.async(function() { | 164 this.async(function() { |
| 160 var dialog = this.$$(dialogTagName); | 165 var dialog = this.$$(dialogTagName); |
| 161 dialog.addEventListener('close', function() { | 166 dialog.addEventListener('close', function() { |
| 162 this.set(domIfBooleanName, false); | 167 this.set(domIfBooleanName, false); |
| 163 }.bind(this)); | 168 }.bind(this)); |
| 164 }.bind(this)); | 169 }.bind(this)); |
| 165 }, | 170 }, |
| 166 }); | 171 }); |
| OLD | NEW |