Chromium Code Reviews| Index: chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js |
| diff --git a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js |
| index 3f911ec7bd9583680975a6500d5a68b054239ae6..3891d01573703c8908b07cd1ac498406d08fe535 100644 |
| --- a/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js |
| +++ b/chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js |
| @@ -3,12 +3,10 @@ |
| // found in the LICENSE file. |
| /** |
| - * @fileoverview |
| - * 'settings-ca-trust-edit-dialog' is the a dialog allowing the user to edit the |
| - * trust lever of a given certificate authority. |
| - * |
| - * @group Chrome Settings Elements |
| - * @element settings-ca-trust-edit-dialog |
| + * @fileoverview 'settings-ca-trust-edit-dialog' allows the user to |
| + * - specify the trust level of a certificate authority that is being |
| + * imported. |
| + * - edit the trust level of an already existing certificate authority. |
| */ |
| Polymer({ |
| is: 'settings-ca-trust-edit-dialog', |
| @@ -37,12 +35,19 @@ Polymer({ |
| this.explanationText_ = loadTimeData.getStringF( |
| 'certificateManagerCaTrustEditDialogExplanation', |
| this.model.name); |
| - this.browserProxy_.getCaCertificateTrust(this.model.id).then( |
| - /** @param {!CaTrustInfo} trustInfo */ |
| - function(trustInfo) { |
| - this.trustInfo_ = trustInfo; |
| - this.$.dialog.open(); |
| - }.bind(this)); |
| + |
| + // A null |model.id| indicates that a certificate is being imported, |
| + // otherwise an existing certificate is being edited. |
| + if (this.model.id !== null) { |
|
dschuyler
2016/04/05 23:58:11
Should the definition of CertificateSubnode
in cer
dpapad
2016/04/06 00:59:00
Yes, to be accurate id should be marked an nullabl
Dan Beam
2016/04/06 18:31:09
why not just (!this.model.id)?
dpapad
2016/04/06 18:56:52
Because 'id' can be zero, and it should still cons
Dan Beam
2016/04/06 19:00:54
I thought CertificateSubnode#id is a string?
dpapad
2016/04/06 19:08:10
Ah right, in this case zero is not a possibility,
|
| + this.browserProxy_.getCaCertificateTrust(this.model.id).then( |
| + /** @param {!CaTrustInfo} trustInfo */ |
| + function(trustInfo) { |
| + this.trustInfo_ = trustInfo; |
| + this.$.dialog.open(); |
| + }.bind(this)); |
| + } else { |
| + this.$.dialog.open(); |
| + } |
| }, |
| /** @private */ |
| @@ -53,17 +58,22 @@ Polymer({ |
| /** @private */ |
| onOkTap_: function() { |
| this.$.spinner.active = true; |
| - this.browserProxy_.editCaCertificateTrust( |
| - this.model.id, this.$.ssl.checked, |
| - this.$.email.checked, this.$.objSign.checked).then( |
| - function() { |
| - this.$.spinner.active = false; |
| - this.$.dialog.close(); |
| - }.bind(this), |
| - /** @param {!CertificatesError} error */ |
| - function(error) { |
| - this.$.dialog.close(); |
| - this.fire('certificates-error', error); |
| - }.bind(this)); |
| + |
| + var whenDone = this.model.id === null ? |
| + this.browserProxy_.importCaCertificateTrustSelected( |
| + this.$.ssl.checked, this.$.email.checked, this.$.objSign.checked) : |
| + this.browserProxy_.editCaCertificateTrust( |
| + this.model.id, this.$.ssl.checked, |
| + this.$.email.checked, this.$.objSign.checked); |
| + |
| + whenDone.then(function() { |
| + this.$.spinner.active = false; |
| + this.$.dialog.close(); |
| + }.bind(this), |
| + /** @param {!CertificatesError} error */ |
| + function(error) { |
| + this.$.dialog.close(); |
| + this.fire('certificates-error', error); |
| + }.bind(this)); |
| }, |
| }); |