Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / browser / resources / options / certificate_import_error_overlay.js
blob2e291859ce83f11f7aec094d8fb2eb515033111a
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.
5 cr.define('options', function() {
6 var Page = cr.ui.pageManager.Page;
7 var PageManager = cr.ui.pageManager.PageManager;
9 /**
10 * CertificateImportErrorOverlay class
11 * Displays a list of certificates and errors.
12 * @class
14 function CertificateImportErrorOverlay() {
15 Page.call(this, 'certificateImportErrorOverlay', '',
16 'certificateImportErrorOverlay');
19 cr.addSingletonGetter(CertificateImportErrorOverlay);
21 CertificateImportErrorOverlay.prototype = {
22 // Inherit CertificateImportErrorOverlay from Page.
23 __proto__: Page.prototype,
25 /** @override */
26 initializePage: function() {
27 Page.prototype.initializePage.call(this);
29 $('certificateImportErrorOverlayOk').onclick = function(event) {
30 PageManager.closeOverlay();
35 /**
36 * Show an alert overlay with the given message, button titles, and
37 * callbacks.
38 * @param {string} title The alert title to display to the user.
39 * @param {string} message The alert message to display to the user.
40 * @param {Array} certErrors The list of cert errors. Each error should have
41 * a .name and .error attribute.
43 CertificateImportErrorOverlay.show = function(title, message, certErrors) {
44 $('certificateImportErrorOverlayTitle').textContent = title;
45 $('certificateImportErrorOverlayMessage').textContent = message;
47 var ul = $('certificateImportErrorOverlayCertErrors');
48 ul.innerHTML = '';
49 for (var i = 0; i < certErrors.length; ++i) {
50 var li = document.createElement('li');
51 li.textContent = loadTimeData.getStringF('certificateImportErrorFormat',
52 certErrors[i].name,
53 certErrors[i].error);
54 ul.appendChild(li);
57 PageManager.showPageByName('certificateImportErrorOverlay');
60 // Export
61 return {
62 CertificateImportErrorOverlay: CertificateImportErrorOverlay
65 });