| 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-ca-trust-edit-dialog' allows the user to | 6 * @fileoverview 'settings-ca-trust-edit-dialog' allows the user to |
| 7 * - specify the trust level of a certificate authority that is being | 7 * - specify the trust level of a certificate authority that is being |
| 8 * imported. | 8 * imported. |
| 9 * - edit the trust level of an already existing certificate authority. | 9 * - edit the trust level of an already existing certificate authority. |
| 10 */ | 10 */ |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 this.explanationText_ = loadTimeData.getStringF( | 35 this.explanationText_ = loadTimeData.getStringF( |
| 36 'certificateManagerCaTrustEditDialogExplanation', | 36 'certificateManagerCaTrustEditDialogExplanation', |
| 37 this.model.name); | 37 this.model.name); |
| 38 | 38 |
| 39 // A non existing |model.id| indicates that a new certificate is being | 39 // A non existing |model.id| indicates that a new certificate is being |
| 40 // imported, otherwise an existing certificate is being edited. | 40 // imported, otherwise an existing certificate is being edited. |
| 41 if (this.model.id) { | 41 if (this.model.id) { |
| 42 this.browserProxy_.getCaCertificateTrust(this.model.id).then( | 42 this.browserProxy_.getCaCertificateTrust(this.model.id).then( |
| 43 /** @param {!CaTrustInfo} trustInfo */ | 43 /** @param {!CaTrustInfo} trustInfo */ |
| 44 function(trustInfo) { | 44 function(trustInfo) { |
| 45 if (!this.isAttached) { |
| 46 // This element might have been detached from the DOM during the |
| 47 // async operation (happens in testing code). Do not attempt to |
| 48 // open the dialog in such case. |
| 49 return; |
| 50 } |
| 51 |
| 45 this.trustInfo_ = trustInfo; | 52 this.trustInfo_ = trustInfo; |
| 46 this.$.dialog.open(); | 53 this.$.dialog.showModal(); |
| 47 }.bind(this)); | 54 }.bind(this)); |
| 48 } else { | 55 } else { |
| 49 /** @type {!CrDialogElement} */ (this.$.dialog).open(); | 56 /** @type {!CrDialogElement} */ (this.$.dialog).showModal(); |
| 50 } | 57 } |
| 51 }, | 58 }, |
| 52 | 59 |
| 53 /** @private */ | 60 /** @private */ |
| 54 onCancelTap_: function() { | 61 onCancelTap_: function() { |
| 55 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 62 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 56 }, | 63 }, |
| 57 | 64 |
| 58 /** @private */ | 65 /** @private */ |
| 59 onOkTap_: function() { | 66 onOkTap_: function() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 70 this.$.spinner.active = false; | 77 this.$.spinner.active = false; |
| 71 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 78 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 72 }.bind(this), | 79 }.bind(this), |
| 73 /** @param {!CertificatesError} error */ | 80 /** @param {!CertificatesError} error */ |
| 74 function(error) { | 81 function(error) { |
| 75 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 82 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 76 this.fire('certificates-error', error); | 83 this.fire('certificates-error', error); |
| 77 }.bind(this)); | 84 }.bind(this)); |
| 78 }, | 85 }, |
| 79 }); | 86 }); |
| OLD | NEW |