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

Unified Diff: chrome/browser/resources/print_preview/previewarea/preview_area.js

Issue 885813003: OOP PDF: Allow print preview to handle key events when the plugin has focus (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
Index: chrome/browser/resources/print_preview/previewarea/preview_area.js
diff --git a/chrome/browser/resources/print_preview/previewarea/preview_area.js b/chrome/browser/resources/print_preview/previewarea/preview_area.js
index ca06dd84122a92a0d6854a651f76977d59aa6dcf..e43762158302c1f7e52d49e1ed516f5834555d19 100644
--- a/chrome/browser/resources/print_preview/previewarea/preview_area.js
+++ b/chrome/browser/resources/print_preview/previewarea/preview_area.js
@@ -301,11 +301,21 @@ cr.define('print_preview', function() {
// No scroll bar anywhere, or the active element is something else, like a
// button. Note: buttons have a bigger scrollHeight than clientHeight.
- this.plugin_.sendKeyEvent(e.keyCode);
+ this.plugin_.sendKeyEvent(e);
e.preventDefault();
},
/**
+ * Set a callback that gets called when a key event is received that
+ * originates in the plugin.
+ * @param {function(Event)} callback The callback to be called with a key
+ * event.
+ */
+ setPluginKeyEventCallback: function(callback) {
+ this.keyEventCallback_ = callback;
+ },
+
+ /**
* Shows a custom message on the preview area's overlay.
* @param {string} message Custom message to show.
*/
@@ -564,6 +574,7 @@ cr.define('print_preview', function() {
} else {
this.plugin_ = /** @type {print_preview.PDFPlugin} */(
PDFCreateOutOfProcessPlugin(srcUrl));
+ this.plugin_.setKeyEventCallback(this.keyEventCallback_);
}
this.plugin_.setAttribute('class', 'preview-area-plugin');
« no previous file with comments | « chrome/browser/resources/pdf/pdf_scripting_api.js ('k') | chrome/browser/resources/print_preview/print_preview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698