Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1022)

Unified Diff: chrome/browser/resources/settings/certificate_manager_page/ca_trust_edit_dialog.js

Issue 1863733003: MD Settings: Certificate manager, implement importing CA certificate. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove hasOwnProperty. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a7071316ccca947a7383236491b38c03bd52b514 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',
@@ -17,7 +15,7 @@ Polymer({
/** @private {!settings.CertificatesBrowserProxy} */
browserProxy_: Object,
- /** @type {!CertificateSubnode} */
+ /** @type {!CertificateSubnode|!NewCertificateSubNode} */
model: Object,
/** @private {?CaTrustInfo} */
@@ -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 non existing |model.id| indicates that a new certificate is being
+ // imported, otherwise an existing certificate is being edited.
+ if (this.model.id) {
+ 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 ?
+ this.browserProxy_.editCaCertificateTrust(
+ this.model.id, this.$.ssl.checked,
+ this.$.email.checked, this.$.objSign.checked) :
+ this.browserProxy_.importCaCertificateTrustSelected(
+ 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));
},
});

Powered by Google App Engine
This is Rietveld 408576698