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

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

Issue 706823004: OOP PDF: Change the save toolbar button to match the save menu behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@embedded-pdfs
Patch Set: rebase Created 6 years, 1 month 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/pdf/index.html ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « chrome/browser/resources/pdf/index.html ('k') | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698