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 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
7 var Page = cr.ui.pageManager.Page; | 7 var Page = cr.ui.pageManager.Page; |
8 var PageManager = cr.ui.pageManager.PageManager; | 8 var PageManager = cr.ui.pageManager.PageManager; |
9 | 9 |
10 ///////////////////////////////////////////////////////////////////////////// | 10 ///////////////////////////////////////////////////////////////////////////// |
11 // CertificateManagerTab class: | 11 // CertificateManagerTab class: |
12 | 12 |
13 /** | 13 /** |
14 * blah | 14 * blah |
15 * @param {!string} id The id of this tab. | 15 * @param {!string} id The id of this tab. |
16 * @param {boolean} isKiosk True if dialog is shown during CrOS kiosk launch. | 16 * @param {boolean} isKiosk True if dialog is shown during CrOS kiosk launch. |
17 * @constructor | 17 * @constructor |
18 */ | 18 */ |
19 function CertificateManagerTab(id, isKiosk) { | 19 function CertificateManagerTab(id, isKiosk) { |
20 this.tree = $(id + '-tree'); | 20 this.tree = $(id + '-tree'); |
21 | 21 |
22 options.CertificatesTree.decorate(this.tree); | 22 options.CertificatesTree.decorate(this.tree); |
23 this.tree.addEventListener('change', | 23 this.tree.addEventListener( |
24 this.handleCertificatesTreeChange_.bind(this)); | 24 'change', this.handleCertificatesTreeChange_.bind(this)); |
25 | 25 |
26 var tree = this.tree; | 26 var tree = this.tree; |
27 | 27 |
28 this.viewButton = $(id + '-view'); | 28 this.viewButton = $(id + '-view'); |
29 this.viewButton.onclick = function(e) { | 29 this.viewButton.onclick = function(e) { |
30 var selected = tree.selectedItem; | 30 var selected = tree.selectedItem; |
31 chrome.send('viewCertificate', [selected.data.id]); | 31 chrome.send('viewCertificate', [selected.data.id]); |
32 }; | 32 }; |
33 | 33 |
34 this.editButton = $(id + '-edit'); | 34 this.editButton = $(id + '-edit'); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 }; | 110 }; |
111 } | 111 } |
112 } | 112 } |
113 | 113 |
114 this.deleteButton = $(id + '-delete'); | 114 this.deleteButton = $(id + '-delete'); |
115 this.deleteButton.onclick = function(e) { | 115 this.deleteButton.onclick = function(e) { |
116 var data = tree.selectedItem.data; | 116 var data = tree.selectedItem.data; |
117 AlertOverlay.show( | 117 AlertOverlay.show( |
118 loadTimeData.getStringF(id + 'DeleteConfirm', data.name), | 118 loadTimeData.getStringF(id + 'DeleteConfirm', data.name), |
119 loadTimeData.getString(id + 'DeleteImpact'), | 119 loadTimeData.getString(id + 'DeleteImpact'), |
120 loadTimeData.getString('ok'), | 120 loadTimeData.getString('ok'), loadTimeData.getString('cancel'), |
121 loadTimeData.getString('cancel'), | |
122 function() { | 121 function() { |
123 tree.selectedItem = null; | 122 tree.selectedItem = null; |
124 chrome.send('deleteCertificate', [data.id]); | 123 chrome.send('deleteCertificate', [data.id]); |
125 }); | 124 }); |
126 }; | 125 }; |
127 } | 126 } |
128 | 127 |
129 CertificateManagerTab.prototype = { | 128 CertificateManagerTab.prototype = { |
130 /** | 129 /** |
131 * Update button state. | 130 * Update button state. |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 165 |
167 ///////////////////////////////////////////////////////////////////////////// | 166 ///////////////////////////////////////////////////////////////////////////// |
168 // CertificateManager class: | 167 // CertificateManager class: |
169 | 168 |
170 /** | 169 /** |
171 * Encapsulated handling of ChromeOS accounts options page. | 170 * Encapsulated handling of ChromeOS accounts options page. |
172 * @constructor | 171 * @constructor |
173 * @extends {cr.ui.pageManager.Page} | 172 * @extends {cr.ui.pageManager.Page} |
174 */ | 173 */ |
175 function CertificateManager() { | 174 function CertificateManager() { |
176 Page.call(this, 'certificates', | 175 Page.call( |
177 loadTimeData.getString('certificateManagerPageTabTitle'), | 176 this, 'certificates', |
178 'certificateManagerPage'); | 177 loadTimeData.getString('certificateManagerPageTabTitle'), |
| 178 'certificateManagerPage'); |
179 } | 179 } |
180 | 180 |
181 cr.addSingletonGetter(CertificateManager); | 181 cr.addSingletonGetter(CertificateManager); |
182 | 182 |
183 CertificateManager.prototype = { | 183 CertificateManager.prototype = { |
184 __proto__: Page.prototype, | 184 __proto__: Page.prototype, |
185 | 185 |
186 /** @private {boolean} */ | 186 /** @private {boolean} */ |
187 isKiosk_: false, | 187 isKiosk_: false, |
188 | 188 |
189 /** @param {boolean} isKiosk */ | 189 /** @param {boolean} isKiosk */ |
190 setIsKiosk: function(isKiosk) { | 190 setIsKiosk: function(isKiosk) { |
191 this.isKiosk_ = isKiosk; | 191 this.isKiosk_ = isKiosk; |
192 }, | 192 }, |
193 | 193 |
194 /** @override */ | 194 /** @override */ |
195 initializePage: function() { | 195 initializePage: function() { |
196 Page.prototype.initializePage.call(this); | 196 Page.prototype.initializePage.call(this); |
197 | 197 |
198 this.personalTab = new CertificateManagerTab('personalCertsTab', | 198 this.personalTab = |
199 this.isKiosk_); | 199 new CertificateManagerTab('personalCertsTab', this.isKiosk_); |
200 this.serverTab = new CertificateManagerTab('serverCertsTab', | 200 this.serverTab = |
201 this.isKiosk_); | 201 new CertificateManagerTab('serverCertsTab', this.isKiosk_); |
202 this.caTab = new CertificateManagerTab('caCertsTab', this.isKiosk_); | 202 this.caTab = new CertificateManagerTab('caCertsTab', this.isKiosk_); |
203 this.otherTab = new CertificateManagerTab('otherCertsTab', this.isKiosk_); | 203 this.otherTab = new CertificateManagerTab('otherCertsTab', this.isKiosk_); |
204 | 204 |
205 if (this.isKiosk_) { | 205 if (this.isKiosk_) { |
206 // No "Servers" and "Authorities" tab in kiosk mode. | 206 // No "Servers" and "Authorities" tab in kiosk mode. |
207 // See http://crbug.com/719907 for details. | 207 // See http://crbug.com/719907 for details. |
208 $('server-certs-nav-tab').hidden = true; | 208 $('server-certs-nav-tab').hidden = true; |
209 $('ca-certs-nav-tab').hidden = true; | 209 $('ca-certs-nav-tab').hidden = true; |
210 } | 210 } |
211 | 211 |
(...skipping 26 matching lines...) Expand all Loading... |
238 }; | 238 }; |
239 | 239 |
240 CertificateManager.exportPersonalAskPassword = function(args) { | 240 CertificateManager.exportPersonalAskPassword = function(args) { |
241 CertificateBackupOverlay.show(); | 241 CertificateBackupOverlay.show(); |
242 }; | 242 }; |
243 | 243 |
244 CertificateManager.importPersonalAskPassword = function(args) { | 244 CertificateManager.importPersonalAskPassword = function(args) { |
245 CertificateRestoreOverlay.show(); | 245 CertificateRestoreOverlay.show(); |
246 }; | 246 }; |
247 | 247 |
248 CertificateManager.onModelReady = function(userDbAvailable, | 248 CertificateManager.onModelReady = function(userDbAvailable, tpmAvailable) { |
249 tpmAvailable) { | |
250 if (!userDbAvailable) | 249 if (!userDbAvailable) |
251 return; | 250 return; |
252 if (tpmAvailable) | 251 if (tpmAvailable) |
253 $('personalCertsTab-import-and-bind').disabled = false; | 252 $('personalCertsTab-import-and-bind').disabled = false; |
254 $('personalCertsTab-import').disabled = false; | 253 $('personalCertsTab-import').disabled = false; |
255 $('serverCertsTab-import').disabled = false; | 254 $('serverCertsTab-import').disabled = false; |
256 $('caCertsTab-import').disabled = false; | 255 $('caCertsTab-import').disabled = false; |
257 }; | 256 }; |
258 | 257 |
259 // Export | 258 // Export |
260 return { | 259 return { |
261 CertificateManagerTab: CertificateManagerTab, | 260 CertificateManagerTab: CertificateManagerTab, |
262 CertificateManager: CertificateManager | 261 CertificateManager: CertificateManager |
263 }; | 262 }; |
264 }); | 263 }); |
OLD | NEW |