OLD | NEW |
1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 /** | 5 /** |
6 * Namespace object for the client side code. | 6 * Namespace object for the client side code. |
7 */ | 7 */ |
8 var client = new Object(); | 8 var client = new Object(); |
9 | 9 |
10 /** | 10 /** |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 270 |
271 /** | 271 /** |
272 * Initiate a certificate installation. | 272 * Initiate a certificate installation. |
273 * | 273 * |
274 * This causes the certificate progress dialog to be shown, and manages | 274 * This causes the certificate progress dialog to be shown, and manages |
275 * the asynchronous installation of a certificate. | 275 * the asynchronous installation of a certificate. |
276 */ | 276 */ |
277 client.installCert = | 277 client.installCert = |
278 function installCert(cert, variables) { | 278 function installCert(cert, variables) { |
279 var key = cert.key; | 279 var key = cert.key; |
280 var isInstallComplete = false; | |
281 | 280 |
282 // Called for any kind of error from the enterprise daemon. | 281 // Called for any kind of error from the enterprise daemon. |
283 function onerror(retval) { | 282 function onerror(retval) { |
284 if (retval instanceof client.CallbackError) { | 283 if (retval instanceof client.CallbackError) { |
285 client.hideModal(function () { | 284 client.hideModal(function () { |
286 if (retval && retval.arg_ && retval.arg_.variables && | 285 if (retval && retval.arg_ && retval.arg_.variables && |
287 retval.arg_.variables.password) { | 286 retval.arg_.variables.password) { |
288 retval.arg_.variables.password = '** PASSWORD WAS HERE **'; | 287 retval.arg_.variables.password = '** PASSWORD WAS HERE **'; |
289 } | 288 } |
290 client.showError(retval.data, 'Error', | 289 client.showError(retval.data, 'Error', |
(...skipping 27 matching lines...) Expand all Loading... |
318 client.invokePolicyCallback('getCert', { certificateId: cert.id }, | 317 client.invokePolicyCallback('getCert', { certificateId: cert.id }, |
319 onerror); | 318 onerror); |
320 } else if (cert.state == 'stop:cert') { | 319 } else if (cert.state == 'stop:cert') { |
321 // Cert is fetched, configure the network. | 320 // Cert is fetched, configure the network. |
322 $('#cert-status').find('.cert-request').attr('status', 'green'); | 321 $('#cert-status').find('.cert-request').attr('status', 'green'); |
323 $('#cert-status').find('.cert-install').attr('status', 'progress'); | 322 $('#cert-status').find('.cert-install').attr('status', 'progress'); |
324 client.invokePolicyCallback('installCert', { certificateId: cert.id }, | 323 client.invokePolicyCallback('installCert', { certificateId: cert.id }, |
325 onerror); | 324 onerror); |
326 } else if (cert.state == 'stop:ready') { | 325 } else if (cert.state == 'stop:ready') { |
327 $('#cert-status').find('.cert-install').attr('status', 'green'); | 326 $('#cert-status').find('.cert-install').attr('status', 'green'); |
328 if (!isInstallComplete) { | 327 client.showSuccess('Your certificate has been installed', |
329 isInstallComplete = true; | 328 'Certificate Installed'); |
330 client.showSuccess('Your certificate has been installed', | |
331 'Certificate Installed'); | |
332 } | |
333 return; | 329 return; |
334 } else if (cert.state == 'stop:error') { | 330 } else if (cert.state == 'stop:error') { |
335 client.showCertDetails(cert); | 331 client.showCertDetails(cert); |
336 return; | 332 return; |
337 } | 333 } |
338 | 334 |
339 setTimeout(function () { | 335 setTimeout(function () { |
340 client.invokePolicyCallback('listCertificates', null, | 336 client.invokePolicyCallback('listCertificates', null, |
341 oncomplete_list); | 337 oncomplete_list); |
342 }, 1000); | 338 }, 1000); |
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1181 * @param {string} name The name of the callback that returned this data. | 1177 * @param {string} name The name of the callback that returned this data. |
1182 * @param {Object} arg The argument object originally passed to the callback. | 1178 * @param {Object} arg The argument object originally passed to the callback. |
1183 * @param {Object} data The data returned by the callback. | 1179 * @param {Object} data The data returned by the callback. |
1184 */ | 1180 */ |
1185 client.CallbackError = | 1181 client.CallbackError = |
1186 function CallbackError(name, arg, data) { | 1182 function CallbackError(name, arg, data) { |
1187 this.init_(name, arg, data); | 1183 this.init_(name, arg, data); |
1188 }; | 1184 }; |
1189 | 1185 |
1190 client.CallbackError.prototype.init_ = client.CallbackSuccess.prototype.init_; | 1186 client.CallbackError.prototype.init_ = client.CallbackSuccess.prototype.init_; |
OLD | NEW |