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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 1654683002: PDF: Allow external navigation links in PDF bookmarks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index e44b2dc18b80f0582b406164c5e2a00d0054d336..ffe8ee9c421489cbd1c0d57ec59ce3381a15db60 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -427,6 +427,18 @@ pp::VarDictionary TraverseBookmarks(FPDF_DOCUMENT doc,
if (dest) {
int page_index = FPDFDest_GetPageIndex(doc, dest);
dict.Set(pp::Var("page"), pp::Var(page_index));
+ } else {
+ // Extract URI for bookmarks linking to an external page.
+ FPDF_ACTION action = FPDFBookmark_GetAction(bookmark);
+ buffer_size = FPDFAction_GetURIPath(doc, action, NULL, 0);
raymes 2016/02/01 04:44:32 nit: nullptr
tsergeant 2016/02/01 06:01:00 Done (and the one above)
+ std::string uri;
raymes 2016/02/01 04:44:32 nit: move into if statement
tsergeant 2016/02/01 06:01:00 Done.
+ if (buffer_size > 0) {
+ PDFiumAPIStringBufferAdapter<std::string>
+ api_string_adapter(&uri, buffer_size, true);
+ api_string_adapter.Close(FPDFAction_GetURIPath(
+ doc, action, api_string_adapter.GetData(), buffer_size));
+ dict.Set(pp::Var("uri"), pp::Var(uri));
+ }
}
pp::VarArray children;

Powered by Google App Engine
This is Rietveld 408576698