Chromium Code Reviews| 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 712e390207e2cb443611cab2cfcf26eddbfb633b..b75bac6c4323f6707b869dca0e539b9f9cd02ed1 100644 |
| --- a/chrome/browser/resources/pdf/pdf_scripting_api.js |
| +++ b/chrome/browser/resources/pdf/pdf_scripting_api.js |
| @@ -76,6 +76,13 @@ function PDFScriptingAPI(window, plugin) { |
| if (this.loadCallback_) |
| this.loadCallback_(this.loadState_ == LoadState.SUCCESS); |
| break; |
| + case 'getLinkPositionReply': |
| + if (this.getLinkPositionCallback_) { |
| + this.getLinkPositionCallback_(event.data.x, |
| + event.data.y); |
| + this.getLinkPositionCallback_ = null; |
| + } |
| + break; |
| case 'getSelectedTextReply': |
| if (this.selectedTextCallback_) { |
| this.selectedTextCallback_(event.data.selectedText); |
| @@ -229,6 +236,21 @@ PDFScriptingAPI.prototype = { |
| keyEvent: SerializeKeyEvent(keyEvent) |
| }); |
| }, |
| + |
| + /** |
| + * Get position of the first link in the most visible page of the document. |
|
Dan Beam
2016/07/11 21:03:09
@param {function(number, number):void} callback
|
| + * @return {boolean} true if the function is successful, false if there is an |
| + * outstanding request that has not been answered. |
| + */ |
| + getLinkPosition: function(callback) { |
| + if (this.getLinkPositionCallback_) |
| + return false; |
| + this.getLinkPositionCallback_ = callback; |
| + this.sendMessage_({ |
| + type: 'getLinkPosition', |
| + }); |
| + return true; |
| + }, |
| }; |
| /** |