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

Unified Diff: chrome/browser/resources/pdf/pdf_scripting_api.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_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;
+ },
};
/**

Powered by Google App Engine
This is Rietveld 408576698