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..448c51a487fcfd1e98cf8967ac4d006a870ab64d 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 for a link in the document. |
|
Lei Zhang
2016/07/08 18:02:35
Can you give a little more detail here, since PDFs
jaepark
2016/07/08 20:58:16
Modified to
/**
* Get position of the firs
|
| + * @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; |
| + }, |
| }; |
| /** |