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(); |
} |