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