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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 /** @override */ | 118 /** @override */ |
111 ready: function() { | 119 ready: function() { |
112 this.addEventListener(settings.CertificateActionEvent, function(event) { | 120 this.addEventListener(settings.CertificateActionEvent, function(event) { |
113 this.dialogModel_ = event.detail.subnode; | 121 this.dialogModel_ = event.detail.subnode; |
114 this.dialogModelCertificateType_ = event.detail.certificateType; | 122 this.dialogModelCertificateType_ = event.detail.certificateType; |
115 | 123 |
116 if (event.detail.action == CertificateAction.IMPORT) { | 124 if (event.detail.action == CertificateAction.IMPORT) { |
117 if (event.detail.certificateType == CertificateType.PERSONAL) { | 125 if (event.detail.certificateType == CertificateType.PERSONAL) { |
118 this.openDialog_( | 126 this.openDialog_( |
119 'settings-certificate-password-decryption-dialog', | 127 'settings-certificate-password-decryption-dialog', |
120 'showPasswordDecryptionDialog_', | 128 'showPasswordDecryptionDialog_', event.detail.anchor); |
121 event.detail.anchor); | 129 } else if (event.detail.certificateType == CertificateType.CA) { |
122 } else if (event.detail.certificateType == | |
123 CertificateType.CA) { | |
124 this.openDialog_( | 130 this.openDialog_( |
125 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_', | 131 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_', |
126 event.detail.anchor); | 132 event.detail.anchor); |
127 } | 133 } |
128 } else { | 134 } else { |
129 if (event.detail.action == CertificateAction.EDIT) { | 135 if (event.detail.action == CertificateAction.EDIT) { |
130 this.openDialog_( | 136 this.openDialog_( |
131 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_', | 137 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_', |
132 event.detail.anchor); | 138 event.detail.anchor); |
133 } else if (event.detail.action == CertificateAction.DELETE) { | 139 } else if (event.detail.action == CertificateAction.DELETE) { |
134 this.openDialog_( | 140 this.openDialog_( |
135 'settings-certificate-delete-confirmation-dialog', | 141 'settings-certificate-delete-confirmation-dialog', |
136 'showDeleteConfirmationDialog_', event.detail.anchor); | 142 'showDeleteConfirmationDialog_', event.detail.anchor); |
137 } else if (event.detail.action == | 143 } else if (event.detail.action == CertificateAction.EXPORT_PERSONAL) { |
138 CertificateAction.EXPORT_PERSONAL) { | |
139 this.openDialog_( | 144 this.openDialog_( |
140 'settings-certificate-password-encryption-dialog', | 145 'settings-certificate-password-encryption-dialog', |
141 'showPasswordEncryptionDialog_', event.detail.anchor); | 146 'showPasswordEncryptionDialog_', event.detail.anchor); |
142 } | 147 } |
143 } | 148 } |
144 | 149 |
145 event.stopPropagation(); | 150 event.stopPropagation(); |
146 }.bind(this)); | 151 }.bind(this)); |
147 | 152 |
148 this.addEventListener('certificates-error', function(event) { | 153 this.addEventListener('certificates-error', function(event) { |
149 var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail); | 154 var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail); |
150 this.errorDialogModel_ = detail.error; | 155 this.errorDialogModel_ = detail.error; |
151 this.openDialog_( | 156 this.openDialog_( |
152 'settings-certificates-error-dialog', | 157 'settings-certificates-error-dialog', 'showErrorDialog_', |
153 'showErrorDialog_', | |
154 detail.anchor); | 158 detail.anchor); |
155 event.stopPropagation(); | 159 event.stopPropagation(); |
156 }.bind(this)); | 160 }.bind(this)); |
157 }, | 161 }, |
158 | 162 |
159 /** | 163 /** |
160 * Opens a dialog and registers a listener for removing the dialog from the | 164 * Opens a dialog and registers a listener for removing the dialog from the |
161 * DOM once is closed. The listener is destroyed when the dialog is removed | 165 * DOM once is closed. The listener is destroyed when the dialog is removed |
162 * (because of 'restamp'). | 166 * (because of 'restamp'). |
163 * | 167 * |
(...skipping 13 matching lines...) Expand all Loading... |
177 this.set(domIfBooleanName, true); | 181 this.set(domIfBooleanName, true); |
178 this.async(function() { | 182 this.async(function() { |
179 var dialog = this.$$(dialogTagName); | 183 var dialog = this.$$(dialogTagName); |
180 dialog.addEventListener('close', function() { | 184 dialog.addEventListener('close', function() { |
181 this.set(domIfBooleanName, false); | 185 this.set(domIfBooleanName, false); |
182 cr.ui.focusWithoutInk(assert(this.activeDialogAnchor_)); | 186 cr.ui.focusWithoutInk(assert(this.activeDialogAnchor_)); |
183 }.bind(this)); | 187 }.bind(this)); |
184 }.bind(this)); | 188 }.bind(this)); |
185 }, | 189 }, |
186 }); | 190 }); |
OLD | NEW |