| 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 '', |
| 16 '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__: OptionsPage.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 OptionsPage.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 = |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 $('certificateEditCaTrustCancelButton').onclick = function(event) { | 120 $('certificateEditCaTrustCancelButton').onclick = function(event) { |
| 120 self.cancelEdit_(); | 121 self.cancelEdit_(); |
| 121 } | 122 } |
| 122 $('certificateEditCaTrustOkButton').onclick = function(event) { | 123 $('certificateEditCaTrustOkButton').onclick = function(event) { |
| 123 self.finishEdit_(); | 124 self.finishEdit_(); |
| 124 } | 125 } |
| 125 $('certificateEditCaTrustDescription').textContent = | 126 $('certificateEditCaTrustDescription').textContent = |
| 126 loadTimeData.getStringF('certificateEditCaTrustDescriptionFormat', | 127 loadTimeData.getStringF('certificateEditCaTrustDescriptionFormat', |
| 127 certName); | 128 certName); |
| 128 self.enableInputs_(false); | 129 self.enableInputs_(false); |
| 129 OptionsPage.navigateToPage('certificateEditCaTrustOverlay'); | 130 PageManager.navigateToPage('certificateEditCaTrustOverlay'); |
| 130 chrome.send('getCaCertificateTrust', [certId]); | 131 chrome.send('getCaCertificateTrust', [certId]); |
| 131 } | 132 } |
| 132 | 133 |
| 133 /** | 134 /** |
| 134 * Show the Import CA overlay. | 135 * Show the Import CA overlay. |
| 135 * @param {string} certId The id of the certificate to be passed to the | 136 * @param {string} certId The id of the certificate to be passed to the |
| 136 * certificate manager model. | 137 * certificate manager model. |
| 137 * @param {string} certName The display name of the certificate. | 138 * @param {string} certName The display name of the certificate. |
| 138 * checkbox. | 139 * checkbox. |
| 139 */ | 140 */ |
| 140 CertificateEditCaTrustOverlay.showImport = function(certName) { | 141 CertificateEditCaTrustOverlay.showImport = function(certName) { |
| 141 var self = CertificateEditCaTrustOverlay.getInstance(); | 142 var self = CertificateEditCaTrustOverlay.getInstance(); |
| 142 // TODO(mattm): do we want a view certificate button here like firefox has? | 143 // TODO(mattm): do we want a view certificate button here like firefox has? |
| 143 $('certificateEditCaTrustCancelButton').onclick = function(event) { | 144 $('certificateEditCaTrustCancelButton').onclick = function(event) { |
| 144 self.cancelImport_(); | 145 self.cancelImport_(); |
| 145 } | 146 } |
| 146 $('certificateEditCaTrustOkButton').onclick = function(event) { | 147 $('certificateEditCaTrustOkButton').onclick = function(event) { |
| 147 self.finishImport_(); | 148 self.finishImport_(); |
| 148 } | 149 } |
| 149 $('certificateEditCaTrustDescription').textContent = | 150 $('certificateEditCaTrustDescription').textContent = |
| 150 loadTimeData.getStringF('certificateImportCaDescriptionFormat', | 151 loadTimeData.getStringF('certificateImportCaDescriptionFormat', |
| 151 certName); | 152 certName); |
| 152 CertificateEditCaTrustOverlay.populateTrust(false, false, false); | 153 CertificateEditCaTrustOverlay.populateTrust(false, false, false); |
| 153 OptionsPage.navigateToPage('certificateEditCaTrustOverlay'); | 154 PageManager.navigateToPage('certificateEditCaTrustOverlay'); |
| 154 } | 155 } |
| 155 | 156 |
| 156 CertificateEditCaTrustOverlay.dismiss = function() { | 157 CertificateEditCaTrustOverlay.dismiss = function() { |
| 157 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_(); | 158 CertificateEditCaTrustOverlay.getInstance().dismissOverlay_(); |
| 158 }; | 159 }; |
| 159 | 160 |
| 160 // Export | 161 // Export |
| 161 return { | 162 return { |
| 162 CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay | 163 CertificateEditCaTrustOverlay: CertificateEditCaTrustOverlay |
| 163 }; | 164 }; |
| 164 }); | 165 }); |
| OLD | NEW |