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

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 830433002: Navigation to relative fragments does not work correctly for OOP pdf. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing nameddest directory. Created 5 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
« pdf/pdfium/pdfium_engine.h ('K') | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index 228a8899cc4f5436c1ca4b7f7015ce40e68d05da..9cba47d0734dd3c7ed60fc0b51f2015cade802c4 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -30,6 +30,7 @@
#include "ppapi/cpp/trusted/browser_font_trusted.h"
#include "ppapi/cpp/url_response_info.h"
#include "ppapi/cpp/var.h"
+#include "ppapi/cpp/var_dictionary.h"
#include "third_party/pdfium/fpdfsdk/include/fpdf_ext.h"
#include "third_party/pdfium/fpdfsdk/include/fpdf_flatten.h"
#include "third_party/pdfium/fpdfsdk/include/fpdf_searchex.h"
@@ -1188,6 +1189,28 @@ void PDFiumEngine::OnDocumentComplete() {
FinishLoadingDocument();
}
+pp::VarDictionary PDFiumEngine::GetAllNamedDestinations() {
raymes 2015/01/14 00:19:01 nit: Can we move this function down near GetNamedD
Deepak 2015/01/14 06:29:01 Done.
+ pp::VarDictionary named_destinations;
+ for (unsigned long i = 0; i < GetNameDestCount(); i++) {
raymes 2015/01/14 00:19:01 Sorry when I said "inline" I just meant actually c
Deepak 2015/01/14 06:29:01 Done.
+ base::string16 name;
+ size_t buffer_bytes;
raymes 2015/01/14 00:19:01 use unsigned long here (as in the API)
Deepak 2015/01/14 06:29:01 Done.
+ FPDF_GetNamedDest(doc_, i, NULL, buffer_bytes);
+ if (buffer_bytes > 1) {
raymes 2015/01/14 00:19:01 We should compute the length of the string here be
Deepak 2015/01/14 06:29:01 Done.
+ FPDF_DEST dest = FPDF_GetNamedDest(
+ doc_, i, WriteInto(&name, buffer_bytes + 1), buffer_bytes);
+ if (dest) {
+ std::string name_dest = base::UTF16ToUTF8(name);
+ int page_number = GetNamedDestinationPage(name_dest);
+ if (page_number >= 0) {
+ named_destinations.Set(pp::Var(name_dest.c_str()),
+ pp::Var(page_number));
+ }
+ }
+ }
+ }
+ return named_destinations;
+}
+
void PDFiumEngine::FinishLoadingDocument() {
DCHECK(doc_loader_.IsDocumentComplete() && doc_);
if (called_do_document_action_)
« pdf/pdfium/pdfium_engine.h ('K') | « pdf/pdfium/pdfium_engine.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698