| Index: chrome/browser/resources/pdf/pdf.js
|
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js
|
| index 392838f3578a3dd75f638edb4f1dd2afe1d4a5b2..6cc8421484a0f248ca01fd40d30fedeb6ef68a68 100644
|
| --- a/chrome/browser/resources/pdf/pdf.js
|
| +++ b/chrome/browser/resources/pdf/pdf.js
|
| @@ -32,6 +32,13 @@ var viewport;
|
| // The document dimensions.
|
| var documentDimensions;
|
|
|
| +// Notify the plugin to print.
|
| +function print() {
|
| + plugin.postMessage({
|
| + type: 'print',
|
| + });
|
| +}
|
| +
|
| // Returns true if the fit-to-page button is enabled.
|
| function isFitToPageEnabled() {
|
| return $('fit-to-page-button').classList.contains('polymer-selected');
|
| @@ -107,10 +114,9 @@ function load() {
|
| plugin.id = 'plugin';
|
| plugin.type = 'application/x-google-chrome-pdf';
|
| plugin.addEventListener('message', handleMessage, false);
|
| - // The pdf location is passed in the document url in the format:
|
| - // http://<.../pdf.html>?<pdf location>.
|
| - var url = window.location.search.substring(1);
|
| - plugin.setAttribute('src', url);
|
| + // The pdf location is passed in stream details in the background page.
|
| + var streamDetails = chrome.extension.getBackgroundPage().getStreamDetails();
|
| + plugin.setAttribute('src', streamDetails.streamURL);
|
| document.body.appendChild(plugin);
|
|
|
| // Setup the button event listeners.
|
| @@ -122,6 +128,9 @@ function load() {
|
| viewport.zoomIn.bind(viewport));
|
| $('zoom-out-button').addEventListener('click',
|
| viewport.zoomOut.bind(viewport));
|
| + $('save-button-link').href = streamDetails.originalURL;
|
| + $('print-button').addEventListener('click', print);
|
| +
|
|
|
| // Setup keyboard event listeners.
|
| document.onkeydown = function(e) {
|
|
|