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

Unified Diff: chrome/browser/resources/print_preview.js

Issue 5574003: Print preview: Display a message when the PDF viewer is missing.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: address comments Created 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/print_preview.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/print_preview.js
===================================================================
--- chrome/browser/resources/print_preview.js (revision 68335)
+++ chrome/browser/resources/print_preview.js (working copy)
@@ -3,6 +3,7 @@
// found in the LICENSE file.
var localStrings = new LocalStrings();
+var hasPDFPlugin = true;
/**
* Window onload handler, sets up the page.
@@ -43,20 +44,30 @@
* Create the PDF plugin or reload the existing one.
*/
function createPDFPlugin(url) {
+ if (!hasPDFPlugin) {
+ return;
+ }
+
if ($('pdf-viewer')) {
- pdfPlugin.reload();
+ $('pdf-viewer').reload();
return;
}
var loadingElement = $('loading');
+ loadingElement.classList.add('hidden');
var mainView = loadingElement.parentNode;
- mainView.removeChild(loadingElement);
- pdfPlugin = document.createElement('object');
+ var pdfPlugin = document.createElement('object');
pdfPlugin.setAttribute('id', 'pdf-viewer');
pdfPlugin.setAttribute('type', 'application/pdf');
pdfPlugin.setAttribute('src', url);
mainView.appendChild(pdfPlugin);
+ if (!pdfPlugin.onload) {
+ hasPDFPlugin = false;
+ mainView.removeChild(pdfPlugin);
+ $('no-plugin').classList.remove('hidden');
+ return;
+ }
pdfPlugin.onload('onPDFLoad()');
}
« no previous file with comments | « chrome/browser/resources/print_preview.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698