Chromium Code Reviews| 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(); |
|
Lei Zhang
2010/12/06 08:31:55
Typo in previous CL.
|
| return; |
| } |
| var loadingElement = $('loading'); |
| + loadingElement.classList.add('hidden'); |
| var mainView = loadingElement.parentNode; |
| - mainView.removeChild(loadingElement); |
| - pdfPlugin = document.createElement('object'); |
| + var pdfPlugin = document.createElement('object'); |
|
Lei Zhang
2010/12/06 08:31:55
Typo in previous CL.
|
| pdfPlugin.setAttribute('id', 'pdf-viewer'); |
| pdfPlugin.setAttribute('type', 'application/pdf'); |
| pdfPlugin.setAttribute('src', url); |
| mainView.appendChild(pdfPlugin); |
| + if (typeof pdfPlugin.onload != 'function') { |
|
Lei Zhang
2010/12/06 08:31:55
This check does not work until we add the plugin t
James Hawkins
2010/12/06 18:23:36
You should just be able to check if (pdfPlugin.onl
Lei Zhang
2010/12/06 20:47:14
Done, but this still needs to happen after the plu
|
| + hasPDFPlugin = false; |
| + mainView.removeChild(pdfPlugin); |
| + $('no-plugin').classList.remove('hidden'); |
|
James Hawkins
2010/12/06 18:23:36
You don't ever set 'hidden' for 'no-plugin', so th
Lei Zhang
2010/12/06 20:47:14
Whoops, added class="hidden" in the html file.
|
| + return; |
| + } |
| pdfPlugin.onload('onPDFLoad()'); |
| } |