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

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

Issue 1867093003: MD Settings: Certificate manager, respect export/edit/delete restrictions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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-subentry represents an SSL certificate 6 * @fileoverview settings-certificate-subentry represents an SSL certificate
7 * sub-entry. 7 * sub-entry.
8 */ 8 */
9 9
10 /** 10 /**
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 this.dispatchCertificateActionEvent_( 134 this.dispatchCertificateActionEvent_(
135 settings.CertificateAction.EXPORT_PERSONAL); 135 settings.CertificateAction.EXPORT_PERSONAL);
136 }.bind(this), 136 }.bind(this),
137 this.onRejected_.bind(this)); 137 this.onRejected_.bind(this));
138 } else { 138 } else {
139 this.browserProxy_.exportCertificate(this.model.id); 139 this.browserProxy_.exportCertificate(this.model.id);
140 } 140 }
141 }, 141 },
142 142
143 /** 143 /**
144 * @param {string} certificateType The type of this certificate.
145 * @return {boolean} Whether the certificate can be edited. 144 * @return {boolean} Whether the certificate can be edited.
146 * @private 145 * @private
147 */ 146 */
148 canEdit_: function(certificateType) { 147 canEdit_: function() {
tommycli 2016/04/07 21:35:01 Can these be pure functions a la the style guide P
dpapad 2016/04/07 22:07:23 Done.
149 return this.certificateType == settings.CertificateType.CA; 148 return this.certificateType == settings.CertificateType.CA &&
149 !this.model.policy;
150 },
151
152 /**
153 * @return {boolean} Whether the certificate can be exported.
154 * @private
155 */
156 canExport_: function() {
157 if (this.certificateType == settings.CertificateType.PERSONAL) {
158 return this.model.extractable;
159 }
160 return true;
161 },
162
163 /**
164 * @return {boolean} Whether the certificate can be deleted.
165 * @private
166 */
167 canDelete_: function() {
168 return !this.model.readonly && !this.model.policy;
150 }, 169 },
151 170
152 /** @private */ 171 /** @private */
153 closePopupMenu_: function() { 172 closePopupMenu_: function() {
154 this.$$('iron-dropdown').close(); 173 this.$$('iron-dropdown').close();
155 }, 174 },
156 }); 175 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698