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

Unified Diff: pdf/pdfium/pdfium_page.cc

Issue 2959603002: PDF: Use FPDFAction_GetFilePath() to handle launch actions.
Patch Set: Created 3 years, 6 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
« no previous file with comments | « pdf/pdfium/pdfium_page.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_page.cc
diff --git a/pdf/pdfium/pdfium_page.cc b/pdf/pdfium/pdfium_page.cc
index 01a5fb6ad1a3ff5f54749d6beb49ad30940c5aa1..48d0f5c9fa3e26bbf58f729fa0211a73685c233b 100644
--- a/pdf/pdfium/pdfium_page.cc
+++ b/pdf/pdfium/pdfium_page.cc
@@ -336,8 +336,9 @@ PDFiumPage::Area PDFiumPage::GetLinkTarget(FPDF_LINK link,
}
case PDFACTION_URI:
return GetURITarget(action, target);
- // TODO(thestig): Support remaining types for https://crbug.com/55776
case PDFACTION_LAUNCH:
+ return GetLaunchTarget(action, target);
+ // TODO(thestig): Support remaining types for https://crbug.com/55776
case PDFACTION_REMOTEGOTO:
default:
return NONSELECTABLE_AREA;
@@ -368,6 +369,22 @@ PDFiumPage::Area PDFiumPage::GetURITarget(FPDF_ACTION uri_action,
return WEBLINK_AREA;
}
+PDFiumPage::Area PDFiumPage::GetLaunchTarget(FPDF_ACTION launch_action,
+ LinkTarget* target) const {
+ if (target) {
+ size_t buffer_size = FPDFAction_GetFilePath(launch_action, nullptr, 0);
+ if (buffer_size > 0) {
+ PDFiumAPIStringBufferAdapter<std::string> api_string_adapter(
+ &target->url, buffer_size, true);
+ void* data = api_string_adapter.GetData();
+ size_t bytes_written =
+ FPDFAction_GetFilePath(launch_action, data, buffer_size);
+ api_string_adapter.Close(bytes_written);
+ }
+ }
+ return WEBLINK_AREA;
+}
+
int PDFiumPage::GetLink(int char_index, LinkTarget* target) {
if (!available_)
return -1;
« no previous file with comments | « pdf/pdfium/pdfium_page.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698