Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index 43770ad0a7a5fea331cfdfaf26a4e548b84e4417..075a14e4df4a20c9a9f89bdd01efc70f4cb38101 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -36,6 +36,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'); |
@@ -120,10 +127,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().popStreamDetails(); |
+ plugin.setAttribute('src', streamDetails.streamURL); |
document.body.appendChild(plugin); |
// Setup the button event listeners. |
@@ -135,6 +141,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) { |