summaryrefslogtreecommitdiff
path: root/fpdfsdk/fsdk_actionhandler.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2018-01-30 18:56:50 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-01-30 18:56:50 +0000
commit8cdea72a82aae5e07aa92e9886dbbe635eb8b7cc (patch)
treeff632b087b2770a117581696384bd0a429d86d55 /fpdfsdk/fsdk_actionhandler.h
parent95dd8dad6b1b2ac31aca84afe677205c7ed47f7f (diff)
downloadpdfium-8cdea72a82aae5e07aa92e9886dbbe635eb8b7cc.tar.xz
Cleanup duplicate RunScript code
This CL consolidates the duplicate RunScript code in CPDFSDK_ActionHandler. Change-Id: I08beb7644b6cbaa7906e5bb302372fd8a670f32a Reviewed-on: https://pdfium-review.googlesource.com/24630 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fsdk_actionhandler.h')
-rw-r--r--fpdfsdk/fsdk_actionhandler.h16
1 files changed, 12 insertions, 4 deletions
diff --git a/fpdfsdk/fsdk_actionhandler.h b/fpdfsdk/fsdk_actionhandler.h
index 006aff3995..a77ee77296 100644
--- a/fpdfsdk/fsdk_actionhandler.h
+++ b/fpdfsdk/fsdk_actionhandler.h
@@ -20,6 +20,7 @@ class CPDFSDK_FormFillEnvironment;
class CPDF_Bookmark;
class CPDF_Dictionary;
class CPDF_FormField;
+class IJS_EventContext;
class CPDFSDK_ActionHandler {
public:
@@ -48,14 +49,21 @@ class CPDFSDK_ActionHandler {
CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
- PDFSDK_FieldAction& data);
+ PDFSDK_FieldAction* data);
bool DoAction_FieldJavaScript(const CPDF_Action& JsAction,
CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
- PDFSDK_FieldAction& data);
+ PDFSDK_FieldAction* data);
private:
+ void RunScriptForAction(const CPDF_Action& action,
+ CPDFSDK_FormFillEnvironment* pFormFillEnv,
+ std::function<void(IJS_EventContext* context)> cb);
+ void RunScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
+ const WideString& script,
+ std::function<void(IJS_EventContext* context)> cb);
+
bool ExecuteDocumentOpenAction(const CPDF_Action& action,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
std::set<CPDF_Dictionary*>* visited);
@@ -67,7 +75,7 @@ class CPDFSDK_ActionHandler {
CPDF_AAction::AActionType type,
CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
- PDFSDK_FieldAction& data,
+ PDFSDK_FieldAction* data,
std::set<CPDF_Dictionary*>* visited);
bool ExecuteScreenAction(const CPDF_Action& action,
CPDF_AAction::AActionType type,
@@ -93,7 +101,7 @@ class CPDFSDK_ActionHandler {
void RunFieldJavaScript(CPDFSDK_FormFillEnvironment* pFormFillEnv,
CPDF_FormField* pFormField,
CPDF_AAction::AActionType type,
- PDFSDK_FieldAction& data,
+ PDFSDK_FieldAction* data,
const WideString& script);
bool IsValidField(CPDFSDK_FormFillEnvironment* pFormFillEnv,