| 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 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 /** @override */ | 33 /** @override */ |
| 34 attached: function() { | 34 attached: function() { |
| 35 this.explanationText_ = loadTimeData.getStringF( | 35 this.explanationText_ = loadTimeData.getStringF( |
| 36 'certificateManagerCaTrustEditDialogExplanation', this.model.name); | 36 'certificateManagerCaTrustEditDialogExplanation', this.model.name); |
| 37 | 37 |
| 38 // A non existing |model.id| indicates that a new certificate is being | 38 // A non existing |model.id| indicates that a new certificate is being |
| 39 // imported, otherwise an existing certificate is being edited. | 39 // imported, otherwise an existing certificate is being edited. |
| 40 if (this.model.id) { | 40 if (this.model.id) { |
| 41 this.browserProxy_.getCaCertificateTrust(this.model.id) | 41 this.browserProxy_.getCaCertificateTrust(this.model.id) |
| 42 .then( | 42 .then(trustInfo => { |
| 43 /** @param {!CaTrustInfo} trustInfo */ | 43 this.trustInfo_ = trustInfo; |
| 44 function(trustInfo) { | 44 this.$.dialog.showModal(); |
| 45 this.trustInfo_ = trustInfo; | 45 }); |
| 46 this.$.dialog.showModal(); | |
| 47 }.bind(this)); | |
| 48 } else { | 46 } else { |
| 49 /** @type {!CrDialogElement} */ (this.$.dialog).showModal(); | 47 /** @type {!CrDialogElement} */ (this.$.dialog).showModal(); |
| 50 } | 48 } |
| 51 }, | 49 }, |
| 52 | 50 |
| 53 /** @private */ | 51 /** @private */ |
| 54 onCancelTap_: function() { | 52 onCancelTap_: function() { |
| 55 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 53 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 56 }, | 54 }, |
| 57 | 55 |
| 58 /** @private */ | 56 /** @private */ |
| 59 onOkTap_: function() { | 57 onOkTap_: function() { |
| 60 this.$.spinner.active = true; | 58 this.$.spinner.active = true; |
| 61 | 59 |
| 62 var whenDone = this.model.id ? | 60 var whenDone = this.model.id ? |
| 63 this.browserProxy_.editCaCertificateTrust( | 61 this.browserProxy_.editCaCertificateTrust( |
| 64 this.model.id, this.$.ssl.checked, this.$.email.checked, | 62 this.model.id, this.$.ssl.checked, this.$.email.checked, |
| 65 this.$.objSign.checked) : | 63 this.$.objSign.checked) : |
| 66 this.browserProxy_.importCaCertificateTrustSelected( | 64 this.browserProxy_.importCaCertificateTrustSelected( |
| 67 this.$.ssl.checked, this.$.email.checked, this.$.objSign.checked); | 65 this.$.ssl.checked, this.$.email.checked, this.$.objSign.checked); |
| 68 | 66 |
| 69 whenDone.then( | 67 whenDone.then( |
| 70 function() { | 68 () => { |
| 71 this.$.spinner.active = false; | 69 this.$.spinner.active = false; |
| 72 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 70 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 73 }.bind(this), | 71 }, |
| 74 /** @param {!CertificatesError} error */ | 72 error => { |
| 75 function(error) { | |
| 76 /** @type {!CrDialogElement} */ (this.$.dialog).close(); | 73 /** @type {!CrDialogElement} */ (this.$.dialog).close(); |
| 77 this.fire('certificates-error', {error: error, anchor: null}); | 74 this.fire('certificates-error', {error: error, anchor: null}); |
| 78 }.bind(this)); | 75 }); |
| 79 }, | 76 }, |
| 80 }); | 77 }); |
| OLD | NEW |