Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Side by Side Diff: chrome/browser/resources/options/certificate_import_error_overlay.js

Issue 410293004: Split OptionsPage into Page and PageManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ugh just no Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 var Page = cr.ui.pageManager.Page;
7 var OptionsPage = options.OptionsPage; 7 var PageManager = cr.ui.pageManager.PageManager;
8 8
9 /** 9 /**
10 * CertificateImportErrorOverlay class 10 * CertificateImportErrorOverlay class
11 * Displays a list of certificates and errors. 11 * Displays a list of certificates and errors.
12 * @class 12 * @class
13 */ 13 */
14 function CertificateImportErrorOverlay() { 14 function CertificateImportErrorOverlay() {
15 OptionsPage.call(this, 'certificateImportErrorOverlay', '', 15 Page.call(this, 'certificateImportErrorOverlay', '',
16 'certificateImportErrorOverlay'); 16 'certificateImportErrorOverlay');
17 } 17 }
18 18
19 cr.addSingletonGetter(CertificateImportErrorOverlay); 19 cr.addSingletonGetter(CertificateImportErrorOverlay);
20 20
21 CertificateImportErrorOverlay.prototype = { 21 CertificateImportErrorOverlay.prototype = {
22 // Inherit CertificateImportErrorOverlay from OptionsPage. 22 // Inherit CertificateImportErrorOverlay from Page.
23 __proto__: OptionsPage.prototype, 23 __proto__: Page.prototype,
24 24
25 /** @override */ 25 /** @override */
26 initializePage: function() { 26 initializePage: function() {
27 // Call base class implementation to start preference initialization. 27 Page.prototype.initializePage.call(this);
28 OptionsPage.prototype.initializePage.call(this);
29 28
30 $('certificateImportErrorOverlayOk').onclick = function(event) { 29 $('certificateImportErrorOverlayOk').onclick = function(event) {
31 OptionsPage.closeOverlay(); 30 PageManager.closeOverlay();
32 }; 31 };
33 }, 32 },
34 }; 33 };
35 34
36 /** 35 /**
37 * Show an alert overlay with the given message, button titles, and 36 * Show an alert overlay with the given message, button titles, and
38 * callbacks. 37 * callbacks.
39 * @param {string} title The alert title to display to the user. 38 * @param {string} title The alert title to display to the user.
40 * @param {string} message The alert message to display to the user. 39 * @param {string} message The alert message to display to the user.
41 * @param {Array} certErrors The list of cert errors. Each error should have 40 * @param {Array} certErrors The list of cert errors. Each error should have
42 * a .name and .error attribute. 41 * a .name and .error attribute.
43 */ 42 */
44 CertificateImportErrorOverlay.show = function(title, message, certErrors) { 43 CertificateImportErrorOverlay.show = function(title, message, certErrors) {
45 $('certificateImportErrorOverlayTitle').textContent = title; 44 $('certificateImportErrorOverlayTitle').textContent = title;
46 $('certificateImportErrorOverlayMessage').textContent = message; 45 $('certificateImportErrorOverlayMessage').textContent = message;
47 46
48 ul = $('certificateImportErrorOverlayCertErrors'); 47 ul = $('certificateImportErrorOverlayCertErrors');
49 ul.innerHTML = ''; 48 ul.innerHTML = '';
50 for (var i = 0; i < certErrors.length; ++i) { 49 for (var i = 0; i < certErrors.length; ++i) {
51 li = document.createElement('li'); 50 li = document.createElement('li');
52 li.textContent = loadTimeData.getStringF('certificateImportErrorFormat', 51 li.textContent = loadTimeData.getStringF('certificateImportErrorFormat',
53 certErrors[i].name, 52 certErrors[i].name,
54 certErrors[i].error); 53 certErrors[i].error);
55 ul.appendChild(li); 54 ul.appendChild(li);
56 } 55 }
57 56
58 OptionsPage.navigateToPage('certificateImportErrorOverlay'); 57 PageManager.showPageByName('certificateImportErrorOverlay');
59 }; 58 };
60 59
61 // Export 60 // Export
62 return { 61 return {
63 CertificateImportErrorOverlay: CertificateImportErrorOverlay 62 CertificateImportErrorOverlay: CertificateImportErrorOverlay
64 }; 63 };
65 64
66 }); 65 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698