OLD | NEW |
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 OptionsPage = options.OptionsPage; | 6 /** @const */ var Page = cr.ui.pageManager.Page; |
| 7 /** @const */ var PageManager = cr.ui.pageManager.PageManager; |
7 | 8 |
8 /** | 9 /** |
9 * CertificateEditCaTrustOverlay class | 10 * CertificateEditCaTrustOverlay class |
10 * 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. |
11 * @class | 12 * @class |
12 */ | 13 */ |
13 function CertificateEditCaTrustOverlay() { | 14 function CertificateEditCaTrustOverlay() { |
14 OptionsPage.call(this, 'certificateEditCaTrustOverlay', | 15 Page.call(this, 'certificateEditCaTrustOverlay', '', |
15 '', | 16 'certificateEditCaTrustOverlay'); |
16 'certificateEditCaTrustOverlay'); | |
17 } | 17 } |
18 | 18 |
19 cr.addSingletonGetter(CertificateEditCaTrustOverlay); | 19 cr.addSingletonGetter(CertificateEditCaTrustOverlay); |
20 | 20 |
21 CertificateEditCaTrustOverlay.prototype = { | 21 CertificateEditCaTrustOverlay.prototype = { |
22 __proto__: OptionsPage.prototype, | 22 __proto__: Page.prototype, |
23 | 23 |
24 /** | 24 /** |
25 * Dismisses the overlay. | 25 * Dismisses the overlay. |
26 * @private | 26 * @private |
27 */ | 27 */ |
28 dismissOverlay_: function() { | 28 dismissOverlay_: function() { |
29 OptionsPage.closeOverlay(); | 29 PageManager.closeOverlay(); |
30 }, | 30 }, |
31 | 31 |
32 /** | 32 /** |
33 * Enables or disables input fields. | 33 * Enables or disables input fields. |
34 * @private | 34 * @private |
35 */ | 35 */ |
36 enableInputs_: function(enabled) { | 36 enableInputs_: function(enabled) { |
37 $('certificateCaTrustSSLCheckbox').disabled = | 37 $('certificateCaTrustSSLCheckbox').disabled = |
38 $('certificateCaTrustEmailCheckbox').disabled = | 38 $('certificateCaTrustEmailCheckbox').disabled = |
39 $('certificateCaTrustObjSignCheckbox').disabled = | 39 $('certificateCaTrustObjSignCheckbox').disabled = |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 * @param {boolean} trustSSL The initial value of SSL trust checkbox. | 97 * @param {boolean} trustSSL The initial value of SSL trust checkbox. |
98 * @param {boolean} trustEmail The initial value of Email trust checkbox. | 98 * @param {boolean} trustEmail The initial value of Email trust checkbox. |
99 * @param {boolean} trustObjSign The initial value of Object Signing trust. | 99 * @param {boolean} trustObjSign The initial value of Object Signing trust. |
100 */ | 100 */ |
101 CertificateEditCaTrustOverlay.populateTrust = function( | 101 CertificateEditCaTrustOverlay.populateTrust = function( |
102 trustSSL, trustEmail, trustObjSign) { | 102 trustSSL, trustEmail, trustObjSign) { |
103 $('certificateCaTrustSSLCheckbox').checked = trustSSL; | 103 $('certificateCaTrustSSLCheckbox').checked = trustSSL; |
104 $('certificateCaTrustEmailCheckbox').checked = trustEmail; | 104 $('certificateCaTrustEmailCheckbox').checked = trustEmail; |
105 $('certificateCaTrustObjSignCheckbox').checked = trustObjSign; | 105 $('certificateCaTrustObjSignCheckbox').checked = trustObjSign; |
106 CertificateEditCaTrustOverlay.getInstance().enableInputs_(true); | 106 CertificateEditCaTrustOverlay.getInstance().enableInputs_(true); |
107 } | 107 }; |
108 | 108 |
109 /** | 109 /** |
110 * Show the Edit CA Trust overlay. | 110 * Show the Edit CA Trust overlay. |
111 * @param {string} certId The id of the certificate to be passed to the | 111 * @param {string} certId The id of the certificate to be passed to the |
112 * certificate manager model. | 112 * certificate manager model. |
113 * @param {string} certName The display name of the certificate. | 113 * @param {string} certName The display name of the certificate. |
114 * checkbox. | 114 * checkbox. |
115 */ | 115 */ |
116 CertificateEditCaTrustOverlay.show = function(certId, certName) { | 116 CertificateEditCaTrustOverlay.show = function(certId, certName) { |
117 var self = CertificateEditCaTrustOverlay.getInstance(); | 117 var self = CertificateEditCaTrustOverlay.getInstance(); |
118 self.certId = certId; | 118 self.certId = certId; |
119 $('certificateEditCaTrustCancelButton').onclick = function(event) { | 119 $('certificateEditCaTrustCancelButton').onclick = function(event) { |
120 self.cancelEdit_(); | 120 self.cancelEdit_(); |
121 } | 121 }; |
122 $('certificateEditCaTrustOkButton').onclick = function(event) { | 122 $('certificateEditCaTrustOkButton').onclick = function(event) { |
123 self.finishEdit_(); | 123 self.finishEdit_(); |
124 } | 124 }; |
125 $('certificateEditCaTrustDescription').textContent = | 125 $('certificateEditCaTrustDescription').textContent = |
126 loadTimeData.getStringF('certificateEditCaTrustDescriptionFormat', | 126 loadTimeData.getStringF('certificateEditCaTrustDescriptionFormat', |
127 certName); | 127 certName); |
128 self.enableInputs_(false); | 128 self.enableInputs_(false); |
129 OptionsPage.navigateToPage('certificateEditCaTrustOverlay'); | 129 PageManager.showPageByName('certificateEditCaTrustOverlay'); |
130 chrome.send('getCaCertificateTrust', [certId]); | 130 chrome.send('getCaCertificateTrust', [certId]); |
131 } | 131 }; |
132 | 132 |
133 /** | 133 /** |
134 * Show the Import CA overlay. | 134 * Show the Import CA overlay. |
135 * @param {string} certId The id of the certificate to be passed to the | 135 * @param {string} certId The id of the certificate to be passed to the |
136 * certificate manager model. | 136 * certificate manager model. |
137 * @param {string} certName The display name of the certificate. | 137 * @param {string} certName The display name of the certificate. |
138 * checkbox. | 138 * checkbox. |
139 */ | 139 */ |
140 CertificateEditCaTrustOverlay.showImport = function(certName) { | 140 CertificateEditCaTrustOverlay.showImport = function(certName) { |
141 var self = CertificateEditCaTrustOverlay.getInstance(); | 141 var self = CertificateEditCaTrustOverlay.getInstance(); |
142 // 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? |
143 $('certificateEditCaTrustCancelButton').onclick = function(event) { | 143 $('certificateEditCaTrustCancelButton').onclick = function(event) { |
144 self.cancelImport_(); | 144 self.cancelImport_(); |
145 } | 145 }; |
146 $('certificateEditCaTrustOkButton').onclick = function(event) { | 146 $('certificateEditCaTrustOkButton').onclick = function(event) { |
147 self.finishImport_(); | 147 self.finishImport_(); |
148 } | 148 }; |
149 $('certificateEditCaTrustDescription').textContent = | 149 $('certificateEditCaTrustDescription').textContent = |
150 loadTimeData.getStringF('certificateImportCaDescriptionFormat', | 150 loadTimeData.getStringF('certificateImportCaDescriptionFormat', |
151 certName); | 151 certName); |
152 CertificateEditCaTrustOverlay.populateTrust(false, false, false); | 152 CertificateEditCaTrustOverlay.populateTrust(false, false, false); |
153 OptionsPage.navigateToPage('certificateEditCaTrustOverlay'); | 153 PageManager.showPageByName('certificateEditCaTrustOverlay'); |
154 } | 154 }; |
155 | 155 |
156 CertificateEditCaTrustOverlay.dismiss = function() { | 156 CertificateEditCaTrustOverlay.dismiss = function() { |
157 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_(); | 157 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_(); |
158 }; | 158 }; |
159 | 159 |
160 // Export | 160 // Export |
161 return { | 161 return { |
162 CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay | 162 CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay |
163 }; | 163 }; |
164 }); | 164 }); |
OLD | NEW |