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_) |