Chromium Code Reviews| Index: chrome/browser/resources/pdf/pdf.js |
| diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
| index d4beae6f9cb67452e8f9801ab982b911f3bd0990..0b91fb880e6df2c88c91fd6dcbb8b94e8ab5fb4a 100644 |
| --- a/chrome/browser/resources/pdf/pdf.js |
| +++ b/chrome/browser/resources/pdf/pdf.js |
| @@ -604,6 +604,17 @@ PDFViewer.prototype = { |
| '&body=' + message.data.body; |
| window.location.href = href; |
| break; |
| + case 'getLinkPositionReply': |
| + var visiblePage = this.viewport_.getMostVisiblePage(); |
|
Lei Zhang
2016/07/08 18:02:35
Can you add a comment to say this translate page c
jaepark
2016/07/08 20:58:16
I used viewportCoordinateX and viewportCoordinateY
|
| + var visiblePageDimensions = |
| + this.viewport_.getPageScreenRect(visiblePage); |
| + this.sendScriptingMessage_({ |
| + type: 'getLinkPositionReply', |
| + x: message.data.x + visiblePageDimensions.x, |
|
Lei Zhang
2016/07/08 18:02:35
What if the plugin fails to find the link? Is x eq
jaepark
2016/07/08 20:58:16
I added linkExists field to check.
|
| + y: message.data.y + visiblePageDimensions.y + |
| + PDFViewer.MATERIAL_TOOLBAR_HEIGHT |
| + }); |
| + break; |
| case 'getPassword': |
| // If the password screen isn't up, put it up. Otherwise we're |
| // responding to an incorrect password so deny it. |
| @@ -779,6 +790,7 @@ PDFViewer.prototype = { |
| } |
| switch (message.data.type.toString()) { |
| + case 'getLinkPosition': |
| case 'getSelectedText': |
| case 'print': |
| case 'selectAll': |