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

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

Issue 1819563002: MD Settings: Certificate manager, populate UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 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/certificate_subentry.js
diff --git a/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js
new file mode 100644
index 0000000000000000000000000000000000000000..b750ebbb3cdf58cfd2ec6a43cb9cb40fda073123
--- /dev/null
+++ b/chrome/browser/resources/settings/certificate_manager_page/certificate_subentry.js
@@ -0,0 +1,111 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/**
+ * @fileoverview settings-certificate-subentry represents an SSL certificate
+ * sub-entry.
+ */
+Polymer({
+ is: 'settings-certificate-subentry',
+
+ properties: {
+ /** @type {!CertificateSubnode>} */
+ model: Object,
+
+ /** @type {!settings.CertificateType} */
+ certificateType: String,
+ },
+
+ /** @private {!settings.CertificatesManagerBrowserProxy} */
+ browserProxy_: null,
+
+ /** @override */
+ ready: function() {
+ this.browserProxy_ = settings.CertificatesBrowserProxyImpl.getInstance();
+ },
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ onViewTap_: function(event) {
+ this.closePopupMenu_();
+ this.browserProxy_.viewCertificate(this.model.id);
+ },
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ onEditTap_: function(event) {
+ this.closePopupMenu_();
+ // TODO(dpapad): Open edit dialog.
+ },
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ onDeleteTap_: function(event) {
+ this.closePopupMenu_();
+ // TODO(dpapad): Open delete confirmation dialog.
+ },
+
+ /**
+ * @param {!Event} event
+ * @private
+ */
+ onExportTap_: function(event) {
+ this.closePopupMenu_();
+ if (this.certificateType == settings.CertificateType.PERSONAL) {
+ // TODO(dpapad): Open password encryption dialog.
+ } else {
+ this.browserProxy_.exportCertificate(this.model.id);
+ }
+ },
+
+ /** @private */
+ onImportTap_: function() {
+ this.closePopupMenu_();
+ if (this.certificateType == settings.CertificateType.PERSONAL) {
+ // TODO(dpapad): Figure out when to pass true (ChromeOS?).
+ this.browserProxy_.importPersonalCertificate(false).then(
+ function(showPasswordPrompt) {
+ if (showPasswordPrompt) {
+ // TODO(dpapad): Show password decryption dialog.
+ }
+ }.bind(this));
+ } else if (this.certificateType == settings.CertificateType.CA) {
+ this.browserProxy_.importCaCertificate().then(
+ function(certificateName) {
+ // TODO(dpapad): Show import dialog.
+ }.bind(this));
+ } else if (this.certificateType == settings.CertificateType.SERVER) {
+ this.browserProxy_.importServerCertificate();
+ }
+ },
+
+ /**
+ * @param {string} certificateType The type of this certificate.
+ * @return {boolean} Whether the certificate can be edited.
+ * @private
+ */
+ canEdit_: function(certificateType) {
+ return this.certificateType == settings.CertificateType.CA;
+ },
+
+ /**
+ * @param {string} certificateType The type of this certificate.
+ * @return {boolean} Whether a certificate can be imported.
+ * @private
+ */
+ canImport_: function(certificateType) {
+ return this.certificateType != settings.CertificateType.OTHER;
+ },
+
+ /** @private */
+ closePopupMenu_: function() {
+ this.$$('iron-dropdown').close();
+ },
+});

Powered by Google App Engine
This is Rietveld 408576698