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

Side by Side Diff: chrome/browser/resources/options/certificate_edit_ca_trust_overlay.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager;
8 8
9 /** 9 /**
10 * CertificateEditCaTrustOverlay class 10 * CertificateEditCaTrustOverlay class
11 * Encapsulated handling of the 'edit ca trust' and 'import ca' overlay pages. 11 * Encapsulated handling of the 'edit ca trust' and 'import ca' overlay pages.
12 * @class 12 * @class
13 */ 13 */
14 function CertificateEditCaTrustOverlay() { 14 function CertificateEditCaTrustOverlay() {
15 Page.call(this, 'certificateEditCaTrustOverlay', '', 15 Page.call(
16 'certificateEditCaTrustOverlay'); 16 this, 'certificateEditCaTrustOverlay', '',
17 'certificateEditCaTrustOverlay');
17 } 18 }
18 19
19 cr.addSingletonGetter(CertificateEditCaTrustOverlay); 20 cr.addSingletonGetter(CertificateEditCaTrustOverlay);
20 21
21 CertificateEditCaTrustOverlay.prototype = { 22 CertificateEditCaTrustOverlay.prototype = {
22 __proto__: Page.prototype, 23 __proto__: Page.prototype,
23 24
24 /** 25 /**
25 * Dismisses the overlay. 26 * Dismisses the overlay.
26 * @private 27 * @private
27 */ 28 */
28 dismissOverlay_: function() { 29 dismissOverlay_: function() {
29 PageManager.closeOverlay(); 30 PageManager.closeOverlay();
30 }, 31 },
31 32
32 /** 33 /**
33 * Enables or disables input fields. 34 * Enables or disables input fields.
34 * @private 35 * @private
35 */ 36 */
36 enableInputs_: function(enabled) { 37 enableInputs_: function(enabled) {
37 $('certificateCaTrustSSLCheckbox').disabled = 38 $('certificateCaTrustSSLCheckbox').disabled =
38 $('certificateCaTrustEmailCheckbox').disabled = 39 $('certificateCaTrustEmailCheckbox').disabled =
39 $('certificateCaTrustObjSignCheckbox').disabled = 40 $('certificateCaTrustObjSignCheckbox').disabled =
40 $('certificateEditCaTrustCancelButton').disabled = 41 $('certificateEditCaTrustCancelButton').disabled =
41 $('certificateEditCaTrustOkButton').disabled = !enabled; 42 $('certificateEditCaTrustOkButton').disabled = !enabled;
42 }, 43 },
43 44
44 /** 45 /**
45 * Attempt the Edit operation. 46 * Attempt the Edit operation.
46 * The overlay will be left up with inputs disabled until the backend 47 * The overlay will be left up with inputs disabled until the backend
47 * finishes and dismisses it. 48 * finishes and dismisses it.
48 * @private 49 * @private
49 */ 50 */
50 finishEdit_: function() { 51 finishEdit_: function() {
51 // TODO(mattm): Send checked values as booleans. For now send them as 52 // TODO(mattm): Send checked values as booleans. For now send them as
52 // strings, since WebUIBindings::send does not support any other types :( 53 // strings, since WebUIBindings::send does not support any other types :(
53 chrome.send('editCaCertificateTrust', 54 chrome.send('editCaCertificateTrust', [
54 [this.certId, 55 this.certId, $('certificateCaTrustSSLCheckbox').checked.toString(),
55 $('certificateCaTrustSSLCheckbox').checked.toString(), 56 $('certificateCaTrustEmailCheckbox').checked.toString(),
56 $('certificateCaTrustEmailCheckbox').checked.toString(), 57 $('certificateCaTrustObjSignCheckbox').checked.toString()
57 $('certificateCaTrustObjSignCheckbox').checked.toString()]); 58 ]);
58 this.enableInputs_(false); 59 this.enableInputs_(false);
59 }, 60 },
60 61
61 /** 62 /**
62 * Cancel the Edit operation. 63 * Cancel the Edit operation.
63 * @private 64 * @private
64 */ 65 */
65 cancelEdit_: function() { 66 cancelEdit_: function() {
66 this.dismissOverlay_(); 67 this.dismissOverlay_();
67 }, 68 },
68 69
69 /** 70 /**
70 * Attempt the Import operation. 71 * Attempt the Import operation.
71 * The overlay will be left up with inputs disabled until the backend 72 * The overlay will be left up with inputs disabled until the backend
72 * finishes and dismisses it. 73 * finishes and dismisses it.
73 * @private 74 * @private
74 */ 75 */
75 finishImport_: function() { 76 finishImport_: function() {
76 // TODO(mattm): Send checked values as booleans. For now send them as 77 // TODO(mattm): Send checked values as booleans. For now send them as
77 // strings, since WebUIBindings::send does not support any other types :( 78 // strings, since WebUIBindings::send does not support any other types :(
78 chrome.send('importCaCertificateTrustSelected', 79 chrome.send('importCaCertificateTrustSelected', [
79 [$('certificateCaTrustSSLCheckbox').checked.toString(), 80 $('certificateCaTrustSSLCheckbox').checked.toString(),
80 $('certificateCaTrustEmailCheckbox').checked.toString(), 81 $('certificateCaTrustEmailCheckbox').checked.toString(),
81 $('certificateCaTrustObjSignCheckbox').checked.toString()]); 82 $('certificateCaTrustObjSignCheckbox').checked.toString()
83 ]);
82 this.enableInputs_(false); 84 this.enableInputs_(false);
83 }, 85 },
84 86
85 /** 87 /**
86 * Cancel the Import operation. 88 * Cancel the Import operation.
87 * @private 89 * @private
88 */ 90 */
89 cancelImport_: function() { 91 cancelImport_: function() {
90 chrome.send('cancelImportExportCertificate'); 92 chrome.send('cancelImportExportCertificate');
91 this.dismissOverlay_(); 93 this.dismissOverlay_();
(...skipping 24 matching lines...) Expand all
116 CertificateEditCaTrustOverlay.show = function(certId, certName) { 118 CertificateEditCaTrustOverlay.show = function(certId, certName) {
117 var self = CertificateEditCaTrustOverlay.getInstance(); 119 var self = CertificateEditCaTrustOverlay.getInstance();
118 self.certId = certId; 120 self.certId = certId;
119 $('certificateEditCaTrustCancelButton').onclick = function(event) { 121 $('certificateEditCaTrustCancelButton').onclick = function(event) {
120 self.cancelEdit_(); 122 self.cancelEdit_();
121 }; 123 };
122 $('certificateEditCaTrustOkButton').onclick = function(event) { 124 $('certificateEditCaTrustOkButton').onclick = function(event) {
123 self.finishEdit_(); 125 self.finishEdit_();
124 }; 126 };
125 $('certificateEditCaTrustDescription').textContent = 127 $('certificateEditCaTrustDescription').textContent =
126 loadTimeData.getStringF('certificateEditCaTrustDescriptionFormat', 128 loadTimeData.getStringF(
127 certName); 129 'certificateEditCaTrustDescriptionFormat', certName);
128 self.enableInputs_(false); 130 self.enableInputs_(false);
129 PageManager.showPageByName('certificateEditCaTrustOverlay'); 131 PageManager.showPageByName('certificateEditCaTrustOverlay');
130 chrome.send('getCaCertificateTrust', [certId]); 132 chrome.send('getCaCertificateTrust', [certId]);
131 }; 133 };
132 134
133 /** 135 /**
134 * Show the Import CA overlay. 136 * Show the Import CA overlay.
135 * @param {string} certName The display name of the certificate. 137 * @param {string} certName The display name of the certificate.
136 * checkbox. 138 * checkbox.
137 */ 139 */
138 CertificateEditCaTrustOverlay.showImport = function(certName) { 140 CertificateEditCaTrustOverlay.showImport = function(certName) {
139 var self = CertificateEditCaTrustOverlay.getInstance(); 141 var self = CertificateEditCaTrustOverlay.getInstance();
140 // TODO(mattm): do we want a view certificate button here like firefox has? 142 // TODO(mattm): do we want a view certificate button here like firefox has?
141 $('certificateEditCaTrustCancelButton').onclick = function(event) { 143 $('certificateEditCaTrustCancelButton').onclick = function(event) {
142 self.cancelImport_(); 144 self.cancelImport_();
143 }; 145 };
144 $('certificateEditCaTrustOkButton').onclick = function(event) { 146 $('certificateEditCaTrustOkButton').onclick = function(event) {
145 self.finishImport_(); 147 self.finishImport_();
146 }; 148 };
147 $('certificateEditCaTrustDescription').textContent = 149 $('certificateEditCaTrustDescription').textContent =
148 loadTimeData.getStringF('certificateImportCaDescriptionFormat', 150 loadTimeData.getStringF(
149 certName); 151 'certificateImportCaDescriptionFormat', certName);
150 CertificateEditCaTrustOverlay.populateTrust(false, false, false); 152 CertificateEditCaTrustOverlay.populateTrust(false, false, false);
151 PageManager.showPageByName('certificateEditCaTrustOverlay'); 153 PageManager.showPageByName('certificateEditCaTrustOverlay');
152 }; 154 };
153 155
154 CertificateEditCaTrustOverlay.dismiss = function() { 156 CertificateEditCaTrustOverlay.dismiss = function() {
155 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_(); 157 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_();
156 }; 158 };
157 159
158 // Export 160 // Export
159 return { 161 return {CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay};
160 CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay
161 };
162 }); 162 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698