| Index: chrome/browser/resources/pdf/pdf_scripting_api.js
|
| diff --git a/chrome/browser/resources/pdf/pdf_scripting_api.js b/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| index 33556b994fda8cafe273c55fb86deff19e3bed5e..e8dd4bca03a412020645901432979cf911758427 100644
|
| --- a/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| +++ b/chrome/browser/resources/pdf/pdf_scripting_api.js
|
| @@ -39,6 +39,12 @@ function PDFScriptingAPI(window, plugin) {
|
| this.accessibilityCallback_ = null;
|
| }
|
| break;
|
| + case 'getSelectedTextReply':
|
| + if (this.selectedTextCallback_) {
|
| + this.selectedTextCallback_(event.data.selectedText);
|
| + this.selectedTextCallback_ = null;
|
| + }
|
| + break;
|
| }
|
| }.bind(this), false);
|
| }
|
| @@ -129,7 +135,8 @@ PDFScriptingAPI.prototype = {
|
| },
|
|
|
| /**
|
| - * Get accessibility JSON for the document.
|
| + * Get accessibility JSON for the document. May only be called after document
|
| + * load.
|
| * @param {Function} callback a callback to be called with the accessibility
|
| * json that has been retrieved.
|
| * @param {number} [page] the 0-indexed page number to get accessibility data
|
| @@ -152,6 +159,42 @@ PDFScriptingAPI.prototype = {
|
| },
|
|
|
| /**
|
| + * Select all the text in the document. May only be called after document
|
| + * load.
|
| + */
|
| + selectAll: function() {
|
| + this.sendMessage_({
|
| + type: 'selectAll'
|
| + });
|
| + },
|
| +
|
| + /**
|
| + * Get the selected text in the document. The callback will be called with the
|
| + * text that is selected. May only be called after document load.
|
| + * @param {Function} callback a callback to be called with the selected text.
|
| + * @return {boolean} true if the function is successful, false if there is an
|
| + * outstanding request for selected text that has not been answered.
|
| + */
|
| + getSelectedText: function(callback) {
|
| + if (this.selectedTextCallback_)
|
| + return false;
|
| + this.selectedTextCallback_ = callback;
|
| + this.sendMessage_({
|
| + type: 'getSelectedText'
|
| + });
|
| + return true;
|
| + },
|
| +
|
| + /**
|
| + * Print the document. May only be called after document load.
|
| + */
|
| + print: function() {
|
| + this.sendMessage_({
|
| + type: 'print'
|
| + });
|
| + },
|
| +
|
| + /**
|
| * Send a key event to the extension.
|
| * @param {number} keyCode the key code to send to the extension.
|
| */
|
|
|