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

Unified Diff: chrome/browser/resources/pdf/pdf.js

Issue 2127383002: Open hyperlinks in PDF in a new tab when middle mouse clicking. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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/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':

Powered by Google App Engine
This is Rietveld 408576698