OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 cr.define('options', function() { | |
6 | |
7 var OptionsPage = options.OptionsPage; | |
8 | |
9 /** | |
10 * CertificateImportErrorOverlay class | |
11 * Displays a list of certificates and errors. | |
12 * @class | |
13 */ | |
14 function CertificateImportErrorOverlay() { | |
15 OptionsPage.call(this, 'certificateImportErrorOverlay', '', | |
16 'certificateImportErrorOverlay'); | |
17 } | |
18 | |
19 cr.addSingletonGetter(CertificateImportErrorOverlay); | |
20 | |
21 CertificateImportErrorOverlay.prototype = { | |
22 // Inherit CertificateImportErrorOverlay from OptionsPage. | |
23 __proto__: OptionsPage.prototype, | |
24 | |
25 /** | |
26 * Initialize the page. | |
27 */ | |
28 initializePage: function() { | |
29 // Call base class implementation to start preference initialization. | |
30 OptionsPage.prototype.initializePage.call(this); | |
31 | |
32 $('certificateImportErrorOverlayOk').onclick = function(event) { | |
33 OptionsPage.closeOverlay(); | |
34 }; | |
35 }, | |
36 }; | |
37 | |
38 /** | |
39 * Show an alert overlay with the given message, button titles, and | |
40 * callbacks. | |
41 * @param {string} title The alert title to display to the user. | |
42 * @param {string} message The alert message to display to the user. | |
43 * @param {Array} certErrors The list of cert errors. Each error should have | |
44 * a .name and .error attribute. | |
45 */ | |
46 CertificateImportErrorOverlay.show = function(title, message, certErrors) { | |
47 $('certificateImportErrorOverlayTitle').textContent = title; | |
48 $('certificateImportErrorOverlayMessage').textContent = message; | |
49 | |
50 ul = $('certificateImportErrorOverlayCertErrors'); | |
51 ul.innerHTML = ''; | |
52 for (var i = 0; i < certErrors.length; ++i) { | |
53 li = document.createElement('li'); | |
54 li.textContent = loadTimeData.getStringF('certificateImportErrorFormat', | |
55 certErrors[i].name, | |
56 certErrors[i].error); | |
57 ul.appendChild(li); | |
58 } | |
59 | |
60 OptionsPage.navigateToPage('certificateImportErrorOverlay'); | |
61 } | |
62 | |
63 // Export | |
64 return { | |
65 CertificateImportErrorOverlay: CertificateImportErrorOverlay | |
66 }; | |
67 | |
68 }); | |
OLD | NEW |