| 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', |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 * @param {number} tabIndex | 110 * @param {number} tabIndex |
| 111 * @return {boolean} Whether to show tab at |tabIndex|. | 111 * @return {boolean} Whether to show tab at |tabIndex|. |
| 112 * @private | 112 * @private |
| 113 */ | 113 */ |
| 114 isTabSelected_: function(selectedIndex, tabIndex) { | 114 isTabSelected_: function(selectedIndex, tabIndex) { |
| 115 return selectedIndex == tabIndex; | 115 return selectedIndex == tabIndex; |
| 116 }, | 116 }, |
| 117 | 117 |
| 118 /** @override */ | 118 /** @override */ |
| 119 ready: function() { | 119 ready: function() { |
| 120 this.addEventListener(settings.CertificateActionEvent, function(event) { | 120 this.addEventListener(settings.CertificateActionEvent, event => { |
| 121 this.dialogModel_ = event.detail.subnode; | 121 this.dialogModel_ = event.detail.subnode; |
| 122 this.dialogModelCertificateType_ = event.detail.certificateType; | 122 this.dialogModelCertificateType_ = event.detail.certificateType; |
| 123 | 123 |
| 124 if (event.detail.action == CertificateAction.IMPORT) { | 124 if (event.detail.action == CertificateAction.IMPORT) { |
| 125 if (event.detail.certificateType == CertificateType.PERSONAL) { | 125 if (event.detail.certificateType == CertificateType.PERSONAL) { |
| 126 this.openDialog_( | 126 this.openDialog_( |
| 127 'settings-certificate-password-decryption-dialog', | 127 'settings-certificate-password-decryption-dialog', |
| 128 'showPasswordDecryptionDialog_', event.detail.anchor); | 128 'showPasswordDecryptionDialog_', event.detail.anchor); |
| 129 } else if (event.detail.certificateType == CertificateType.CA) { | 129 } else if (event.detail.certificateType == CertificateType.CA) { |
| 130 this.openDialog_( | 130 this.openDialog_( |
| (...skipping 10 matching lines...) Expand all Loading... |
| 141 'settings-certificate-delete-confirmation-dialog', | 141 'settings-certificate-delete-confirmation-dialog', |
| 142 'showDeleteConfirmationDialog_', event.detail.anchor); | 142 'showDeleteConfirmationDialog_', event.detail.anchor); |
| 143 } else if (event.detail.action == CertificateAction.EXPORT_PERSONAL) { | 143 } else if (event.detail.action == CertificateAction.EXPORT_PERSONAL) { |
| 144 this.openDialog_( | 144 this.openDialog_( |
| 145 'settings-certificate-password-encryption-dialog', | 145 'settings-certificate-password-encryption-dialog', |
| 146 'showPasswordEncryptionDialog_', event.detail.anchor); | 146 'showPasswordEncryptionDialog_', event.detail.anchor); |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 event.stopPropagation(); | 150 event.stopPropagation(); |
| 151 }.bind(this)); | 151 }); |
| 152 | 152 |
| 153 this.addEventListener('certificates-error', function(event) { | 153 this.addEventListener('certificates-error', event => { |
| 154 var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail); | 154 var detail = /** @type {!CertificatesErrorEventDetail} */ (event.detail); |
| 155 this.errorDialogModel_ = detail.error; | 155 this.errorDialogModel_ = detail.error; |
| 156 this.openDialog_( | 156 this.openDialog_( |
| 157 'settings-certificates-error-dialog', 'showErrorDialog_', | 157 'settings-certificates-error-dialog', 'showErrorDialog_', |
| 158 detail.anchor); | 158 detail.anchor); |
| 159 event.stopPropagation(); | 159 event.stopPropagation(); |
| 160 }.bind(this)); | 160 }); |
| 161 }, | 161 }, |
| 162 | 162 |
| 163 /** | 163 /** |
| 164 * 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 |
| 165 * 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 |
| 166 * (because of 'restamp'). | 166 * (because of 'restamp'). |
| 167 * | 167 * |
| 168 * @param {string} dialogTagName The tag name of the dialog to be shown. | 168 * @param {string} dialogTagName The tag name of the dialog to be shown. |
| 169 * @param {string} domIfBooleanName The name of the boolean variable | 169 * @param {string} domIfBooleanName The name of the boolean variable |
| 170 * corresponding to the dialog. | 170 * corresponding to the dialog. |
| 171 * @param {?HTMLElement} anchor The element to focus when the dialog is | 171 * @param {?HTMLElement} anchor The element to focus when the dialog is |
| 172 * closed. If null, the previous anchor element should be reused. This | 172 * closed. If null, the previous anchor element should be reused. This |
| 173 * happens when a 'settings-certificates-error-dialog' is opened, | 173 * happens when a 'settings-certificates-error-dialog' is opened, |
| 174 * which when closed should focus the anchor of the previous dialog (the | 174 * which when closed should focus the anchor of the previous dialog (the |
| 175 * one that generated the error). | 175 * one that generated the error). |
| 176 * @private | 176 * @private |
| 177 */ | 177 */ |
| 178 openDialog_: function(dialogTagName, domIfBooleanName, anchor) { | 178 openDialog_: function(dialogTagName, domIfBooleanName, anchor) { |
| 179 if (anchor) | 179 if (anchor) |
| 180 this.activeDialogAnchor_ = anchor; | 180 this.activeDialogAnchor_ = anchor; |
| 181 this.set(domIfBooleanName, true); | 181 this.set(domIfBooleanName, true); |
| 182 this.async(function() { | 182 this.async(() => { |
| 183 var dialog = this.$$(dialogTagName); | 183 var dialog = this.$$(dialogTagName); |
| 184 dialog.addEventListener('close', function() { | 184 dialog.addEventListener('close', () => { |
| 185 this.set(domIfBooleanName, false); | 185 this.set(domIfBooleanName, false); |
| 186 cr.ui.focusWithoutInk(assert(this.activeDialogAnchor_)); | 186 cr.ui.focusWithoutInk(assert(this.activeDialogAnchor_)); |
| 187 }.bind(this)); | 187 }); |
| 188 }.bind(this)); | 188 }); |
| 189 }, | 189 }, |
| 190 }); | 190 }); |
| OLD | NEW |