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

Side by Side Diff: chrome/browser/resources/settings/certificate_manager_page/certificate_manager_page.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 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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 * @return {boolean} Whether to show tab at |tabIndex|. 96 * @return {boolean} Whether to show tab at |tabIndex|.
97 * @private 97 * @private
98 */ 98 */
99 isTabSelected_: function(selectedIndex, tabIndex) { 99 isTabSelected_: function(selectedIndex, tabIndex) {
100 return selectedIndex == tabIndex; 100 return selectedIndex == tabIndex;
101 }, 101 },
102 102
103 /** @override */ 103 /** @override */
104 ready: function() { 104 ready: function() {
105 this.addEventListener(settings.CertificateActionEvent, function(event) { 105 this.addEventListener(settings.CertificateActionEvent, function(event) {
106 this.dialogModel_ = event.detail.subnode;
107 this.dialogModelCertificateType_ = event.detail.certificateType;
108
106 if (event.detail.action == settings.CertificateAction.IMPORT) { 109 if (event.detail.action == settings.CertificateAction.IMPORT) {
107 this.handleImportAction_(event.detail); 110 if (event.detail.certificateType == settings.CertificateType.PERSONAL) {
111 this.openDialog_(
112 'settings-certificate-password-decryption-dialog',
113 'showPasswordDecryptionDialog_');
114 } else if (event.detail.certificateType ==
115 settings.CertificateType.CA) {
116 this.openDialog_(
117 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
118 }
108 } else { 119 } else {
109 this.dialogModel_ = event.detail.subnode;
110 this.dialogModelCertificateType_ = event.detail.certificateType;
111 if (event.detail.action == settings.CertificateAction.EDIT) { 120 if (event.detail.action == settings.CertificateAction.EDIT) {
112 this.openDialog_( 121 this.openDialog_(
113 'settings-ca-trust-edit-dialog', 122 'settings-ca-trust-edit-dialog', 'showCaTrustEditDialog_');
114 'showCaTrustEditDialog_');
115 } else if (event.detail.action == settings.CertificateAction.DELETE) { 123 } else if (event.detail.action == settings.CertificateAction.DELETE) {
116 this.openDialog_( 124 this.openDialog_(
117 'settings-certificate-delete-confirmation-dialog', 125 'settings-certificate-delete-confirmation-dialog',
118 'showDeleteConfirmationDialog_'); 126 'showDeleteConfirmationDialog_');
119 } else if (event.detail.action == 127 } else if (event.detail.action ==
120 settings.CertificateAction.EXPORT_PERSONAL) { 128 settings.CertificateAction.EXPORT_PERSONAL) {
121 this.openDialog_( 129 this.openDialog_(
122 'settings-certificate-password-encryption-dialog', 130 'settings-certificate-password-encryption-dialog',
123 'showPasswordEncryptionDialog_'); 131 'showPasswordEncryptionDialog_');
124 } 132 }
125 } 133 }
126 134
127 event.stopPropagation(); 135 event.stopPropagation();
128 }.bind(this)); 136 }.bind(this));
129 137
130 this.addEventListener('certificates-error', function(event) { 138 this.addEventListener('certificates-error', function(event) {
131 this.errorDialogModel_ = event.detail; 139 this.errorDialogModel_ = event.detail;
132 this.openDialog_( 140 this.openDialog_(
133 'settings-certificates-error-dialog', 141 'settings-certificates-error-dialog',
134 'showErrorDialog_'); 142 'showErrorDialog_');
135 event.stopPropagation(); 143 event.stopPropagation();
136 }.bind(this)); 144 }.bind(this));
137 }, 145 },
138 146
139 /** 147 /**
140 * Handles a |CertificateAction.IMPORT| for cases where a dialog needs to be
141 * displayed to the user.
142 * @param {!CertificateActionEventDetail} eventdetail
143 * @private
144 */
145 handleImportAction_: function(actionEvent) {
146 if (actionEvent.certificateType == settings.CertificateType.PERSONAL) {
147 this.openDialog_(
148 'settings-certificate-password-decryption-dialog',
149 'showPasswordDecryptionDialog_');
150 } else if (actionEvent.certificateType == settings.CertificateType.CA) {
151 // TODO(dpapad): Implement this.
152 }
153 },
154
155 /**
156 * Opens a dialog and registers a listener for removing the dialog from the 148 * Opens a dialog and registers a listener for removing the dialog from the
157 * DOM once is closed. The listener is destroyed when the dialog is removed 149 * DOM once is closed. The listener is destroyed when the dialog is removed
158 * (because of 'restamp'). 150 * (because of 'restamp').
159 * 151 *
160 * @param {string} dialogTagName The tag name of the dialog to be shown. 152 * @param {string} dialogTagName The tag name of the dialog to be shown.
161 * @param {string} domIfBooleanName The name of the boolean variable 153 * @param {string} domIfBooleanName The name of the boolean variable
162 * corresponding to the dialog. 154 * corresponding to the dialog.
163 * @private 155 * @private
164 */ 156 */
165 openDialog_: function(dialogTagName, domIfBooleanName) { 157 openDialog_: function(dialogTagName, domIfBooleanName) {
166 this.set(domIfBooleanName, true); 158 this.set(domIfBooleanName, true);
167 this.async(function() { 159 this.async(function() {
168 var dialog = this.$$(dialogTagName); 160 var dialog = this.$$(dialogTagName);
169 dialog.addEventListener('iron-overlay-closed', function() { 161 dialog.addEventListener('iron-overlay-closed', function() {
170 this.set(domIfBooleanName, false); 162 this.set(domIfBooleanName, false);
171 }.bind(this)); 163 }.bind(this));
172 }.bind(this)); 164 }.bind(this));
173 }, 165 },
174 }); 166 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698