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

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

Issue 1784553004: MD Settings: Certificate manager, delete confirmation dialog. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@certificates_catrustedit
Patch Set: Address comments. 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
(Empty)
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
3 // found in the LICENSE file.
4
5 /**
6 * @fileoverview A confirmation dialog allowing the user to delete various types
7 * of certificates.
8 */
9 Polymer({
10 is: 'settings-certificate-delete-confirmation-dialog',
11
12 properties: {
13 /** @private {!settings.CertificatesBrowserProxy} */
14 browserProxy_: Object,
15
16 /** @type {!CertificateSubnode} */
17 model: Object,
18
19 /** @type {!settings.CertificateType} */
20 certificateType: String,
21 },
22
23 /** @override */
24 ready: function() {
25 this.browserProxy_ = settings.CertificatesBrowserProxyImpl.getInstance();
26 },
27
28 /** @override */
29 attached: function() {
30 this.$.dialog.open();
31 },
32
33 /**
34 * @private
35 * @return {string}
36 */
37 getTitleText_: function() {
38 var localizedMessageId = null;
39 switch (this.certificateType) {
40 case settings.CertificateType.PERSONAL:
41 localizedMessageId = 'certificateManagerDeleteUserTitle';
42 break;
43 case settings.CertificateType.SERVER:
44 localizedMessageId = 'certificateManagerDeleteServerTitle';
45 break;
46 case settings.CertificateType.CA:
47 localizedMessageId = 'certificateManagerDeleteCaTitle';
48 break;
49 case settings.CertificateType.OTHER:
50 localizedMessageId = 'certificateManagerDeleteOtherTitle';
51 break;
52 default:
Dan Beam 2016/03/10 19:01:26 if you're enumerating every case, remove the defau
Dan Beam 2016/03/10 19:53:53 here's some examples of doing this to make both co
dpapad 2016/03/10 20:21:12 Changed per suggestion. As a side-comment, sugges
Dan Beam 2016/03/10 21:44:13 feel free to fix this however you see fit
53 assertNotReached();
54 }
55 return loadTimeData.getStringF(localizedMessageId, this.model.name);
56 },
57
58 /**
59 * @private
60 * @return {string}
61 */
62 getDescriptionText_: function() {
63 var localizedMessageId = null;
Dan Beam 2016/03/10 19:01:26 nit: why null over undefined?
dpapad 2016/03/10 20:21:12 Removed. For the record, I think "null" serves as
Dan Beam 2016/03/10 21:44:13 either one is fine, null just requires an assignme
64 switch (this.certificateType) {
65 case settings.CertificateType.PERSONAL:
66 localizedMessageId = 'certificateManagerDeleteUserDescription';
67 break;
68 case settings.CertificateType.SERVER:
69 localizedMessageId = 'certificateManagerDeleteServerDescription';
70 break;
71 case settings.CertificateType.CA:
72 localizedMessageId = 'certificateManagerDeleteCaDescription';
73 break;
74 case settings.CertificateType.OTHER:
75 break;
76 default:
77 assertNotReached();
78 }
79 return localizedMessageId == null ? '' :
Dan Beam 2016/03/10 19:01:26 nit: use === when multiple falsy values are involv
dpapad 2016/03/10 20:21:12 Removed.
80 loadTimeData.getString(localizedMessageId);
81 },
82
83 /** @private */
84 onCancelTap_: function() {
85 this.$.dialog.close();
86 },
87
88 /** @private */
89 onOkTap_: function() {
90 this.browserProxy_.deleteCertificate(this.model.id).then(function() {
91 this.$.dialog.close();
92 }.bind(this),
93 /** @param {!CertificatesError} error */
94 function(error) {
95 // TODO(dpapad): Display error here.
96 });
97 },
98 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698