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

Unified Diff: pdf/out_of_process_instance.cc

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: Open hyperlinks in PDF in a new tab when middle mouse clicking. 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: pdf/out_of_process_instance.cc
diff --git a/pdf/out_of_process_instance.cc b/pdf/out_of_process_instance.cc
index ae680bde0ef41160c4487df8622cdda65e16f750..019d2c01f5b52dbd7af715d357e5df7d4b8005ac 100644
--- a/pdf/out_of_process_instance.cc
+++ b/pdf/out_of_process_instance.cc
@@ -138,6 +138,14 @@ const char kJSIsSelecting[] = "isSelecting";
const char kJSFieldFocusType[] = "formFocusChange";
const char kJSFieldFocus[] = "focused";
+// Get link position in document (Page -> Plugin)
+const char kJSGetLinkPositionType[] = "getLinkPosition";
+
+// Reply with link position (Plugin -> Page)
+const char kJSGetLinkPositionReplyType[] = "getLinkPositionReply";
+const char kJSGetLinkPositionX[] = "x";
+const char kJSGetLinkPositionY[] = "y";
+
const int kFindResultCooldownMs = 100;
// A delay to wait between each accessibility page to keep the system
@@ -467,6 +475,16 @@ void OutOfProcessInstance::HandleMessage(const pp::Var& message) {
if (page_number >= 0)
reply.Set(pp::Var(kJSNamedDestinationPageNumber), page_number);
PostMessage(reply);
+ } else if (type == kJSGetLinkPositionType) {
+ std::vector<pp::Rect> rects = engine_->GetLinkRects();
+
+ pp::VarDictionary reply;
+ reply.Set(pp::Var(kType), pp::Var(kJSGetLinkPositionReplyType));
+ if (!rects.empty()) {
+ reply.Set(pp::Var(kJSGetLinkPositionX), pp::Var(rects[0].x()));
+ reply.Set(pp::Var(kJSGetLinkPositionY), pp::Var(rects[0].y()));
+ }
+ PostMessage(reply);
} else {
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698