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

Side by Side Diff: chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.js

Issue 1815733004: MD Settings: Certificate manager, hooking up all dialogs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@certificates_basic_ui
Patch Set: Adding more tests. 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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-certificate-manager-page' is the settings page 6 * @fileoverview 'settings-certificate-manager-page' is the settings page
7 * containing SSL certificate settings. 7 * containing SSL certificate settings.
8 */ 8 */
9 Polymer({ 9 Polymer({
10 is: 'settings-certificate-manager-page', 10 is: 'settings-certificate-manager-page',
(...skipping 30 matching lines...) Expand all
41 type: Array, 41 type: Array,
42 value: function() { return []; }, 42 value: function() { return []; },
43 }, 43 },
44 44
45 /** @private */ 45 /** @private */
46 certificateTypeEnum_: { 46 certificateTypeEnum_: {
47 type: Object, 47 type: Object,
48 value: settings.CertificateType, 48 value: settings.CertificateType,
49 readonly: true, 49 readonly: true,
50 }, 50 },
51
52 /** @private */
53 showCaTrustEditDialog_: Boolean,
54
55 /** @private */
56 showDeleteConfirmationDialog_: Boolean,
57
58 /** @private */
59 showPasswordEncryptionDialog_: Boolean,
60
61 /** @private */
62 showPasswordDecryptionDialog_: Boolean,
63
64 /** @private */
65 showErrorDialog_: Boolean,
66
67 /**
68 * The model to be passed to dialogs that refer to a given certificate.
69 * @private {?CertificateSubnode}
70 */
71 dialogModel_: Object,
72
73 /**
74 * The certificate type to be passed to dialogs that refer to a given
75 * certificate.
76 * @private {?settings.CertificateType}
77 */
78 dialogModelCertificateType_: String,
79
80 /**
81 * The model to be passed to the error dialog.
82 * @private {null|!CertificatesError|!CertificatesImportError}
83 */
84 errorDialogModel_: Object,
51 }, 85 },
52 86
53 /** @override */ 87 /** @override */
54 attached: function() { 88 attached: function() {
55 this.addWebUIListener('certificates-changed', this.set.bind(this)); 89 this.addWebUIListener('certificates-changed', this.set.bind(this));
56 settings.CertificatesBrowserProxyImpl.getInstance().refreshCertificates(); 90 settings.CertificatesBrowserProxyImpl.getInstance().refreshCertificates();
57 }, 91 },
58 92
59 /** 93 /**
60 * @param {number} selectedIndex 94 * @param {number} selectedIndex
61 * @param {number} tabIndex 95 * @param {number} tabIndex
62 * @return {boolean} Whether to show tab at |tabIndex|. 96 * @return {boolean} Whether to show tab at |tabIndex|.
63 * @private 97 * @private
64 */ 98 */
65 isTabSelected_: function(selectedIndex, tabIndex) { 99 isTabSelected_: function(selectedIndex, tabIndex) {
66 return selectedIndex == tabIndex; 100 return selectedIndex == tabIndex;
67 }, 101 },
102
103 /** @override */
104 ready: function() {
105 this.addEventListener(settings.CertificateActionEvent, function(event) {
106 this.dialogModel_ = event.detail.subnode;
107 this.dialogModelCertificateType_ = event.detail.certificateType;
108 if (event.detail.action == settings.CertificateAction.EDIT) {
109 this.openDialog_(
110 'settings-ca-trust-edit-dialog',
111 'showCaTrustEditDialog_');
112 } else if (event.detail.action == settings.CertificateAction.DELETE) {
113 this.openDialog_(
114 'settings-certificate-delete-confirmation-dialog',
115 'showDeleteConfirmationDialog_');
116 } else if (event.detail.action ==
117 settings.CertificateAction.EXPORT_PERSONAL) {
118 this.openDialog_(
119 'settings-certificate-password-encryption-dialog',
120 'showPasswordEncryptionDialog_');
121 } else if (event.detail.action ==
122 settings.CertificateAction.IMPORT_PERSONAL) {
123 this.openDialog_(
124 'settings-certificate-password-decryption-dialog',
125 'showPasswordDecryptionDialog_');
126 } else if (event.detail.action == settings.CertificateAction.IMPORT_CA) {
127 // TODO(dpapad): Implement this.
128 }
129 event.stopPropagation();
130 }.bind(this));
131 },
132
133 /**
134 * Opens a dialog and registers listeners for
135 * 1) Removing the dialog from the DOM once is closed.
136 * 2) Showing an error dialog if necessary.
137 * The listeners are destroyed when the dialog is removed (because of
138 * 'restamp');
139 *
140 * @param {string} dialogTagName The tag name of the dialog to be shown.
141 * @param {string} domIfBooleanName The name of the boolean variable
142 * corresponding to the dialog.
143 * @private
144 */
145 openDialog_: function(dialogTagName, domIfBooleanName) {
tommycli 2016/03/23 19:28:04 The comment above really helps me understand it!
dpapad 2016/03/24 22:06:10 Great!
146 this.set(domIfBooleanName, true);
147 this.async(function() {
148 var dialog = this.$$(dialogTagName);
149 dialog.addEventListener('iron-overlay-closed', function() {
150 this.set(domIfBooleanName, false);
151 }.bind(this));
152 dialog.addEventListener('certificates-error', function(event) {
153 this.errorDialogModel_ = event.detail;
154 this.openDialog_(
155 'settings-certificates-error-dialog',
156 'showErrorDialog_');
157 }.bind(this));
158 }.bind(this));
159 },
68 }); 160 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698