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

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

Issue 169683005: Add shortcuts for zoom, print and saving PDFs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months 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 | « no previous file | no next file » | 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 6cc8421484a0f248ca01fd40d30fedeb6ef68a68..ca9e63b1700a5e12b2edffa563a9e28cf6982247 100644
--- a/chrome/browser/resources/pdf/pdf.js
+++ b/chrome/browser/resources/pdf/pdf.js
@@ -131,7 +131,6 @@ function load() {
$('save-button-link').href = streamDetails.originalURL;
$('print-button').addEventListener('click', print);
-
// Setup keyboard event listeners.
document.onkeydown = function(e) {
switch (e.keyCode) {
@@ -164,6 +163,29 @@ function load() {
e.preventDefault();
}
return;
+ case 187: // +/= key.
+ case 107: // Numpad + key.
+ if (e.ctrlKey)
+ viewport.zoomIn();
+ return;
+ case 189: // -/_ key.
+ case 109: // Numpad - key.
+ if (e.ctrlKey)
+ viewport.zoomOut();
+ return;
+ case 83: // s key.
+ if (e.ctrlKey) {
+ // Simulate a click on the button so that the <a download ...>
+ // attribute is used.
+ $('save-button-link').click();
+ }
+ return;
+ case 80: // p key.
+ if (e.ctrlKey) {
+ print();
+ e.preventDefault();
+ }
+ return;
}
};
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698