Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index 0ca054f9059e8a300f5d05c4ce8f4a4a648bf0d4..826aaf16abbab6ed7b5b2a3f65e42f3a4c35be09 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -106,7 +106,7 @@ function PDFViewer(streamDetails) { |
this.viewport_.zoomIn.bind(this.viewport_)); |
$('zoom-out-button').addEventListener('click', |
this.viewport_.zoomOut.bind(this.viewport_)); |
- $('save-button-link').href = this.streamDetails.originalUrl; |
+ $('save-button').addEventListener('click', this.save_.bind(this)); |
$('print-button').addEventListener('click', this.print_.bind(this)); |
// Setup the keyboard event listener. |
@@ -228,15 +228,6 @@ PDFViewer.prototype = { |
}); |
} |
return; |
- case 83: // s key. |
- if (e.ctrlKey || e.metaKey) { |
- // Simulate a click on the button so that the <a download ...> |
- // attribute is used. |
- $('save-button-link').click(); |
- // Since we do the saving of the page. |
- e.preventDefault(); |
- } |
- return; |
case 80: // p key. |
if (e.ctrlKey || e.metaKey) { |
this.print_(); |
@@ -273,6 +264,16 @@ PDFViewer.prototype = { |
/** |
* @private |
+ * Notify the plugin to save. |
+ */ |
+ save_: function() { |
+ this.plugin_.postMessage({ |
+ type: 'save', |
+ }); |
+ }, |
+ |
+ /** |
+ * @private |
* Handle open pdf parameters. This function updates the viewport as per |
* the parameters mentioned in the url while opening pdf. The order is |
* important as later actions can override the effects of previous actions. |