summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript/app.h
diff options
context:
space:
mode:
authordan sinclair <dsinclair@chromium.org>2017-10-19 14:29:33 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-10-19 19:50:07 +0000
commitcbe23dbdff3f6e41843fd99cbf615000b52727ed (patch)
treef2f9e6e5f4dc8818ef15a8f72fdfdab71a848097 /fpdfsdk/javascript/app.h
parentc136b3146257d0f12d1347a9f1a4784372e19a56 (diff)
downloadpdfium-cbe23dbdff3f6e41843fd99cbf615000b52727ed.tar.xz
Refactoring JS Callbacks.
This CL updates the fpdfsdk/javascript callbacks to have explicit get/set methods instead of one method which worked differently depending on the mode. This allows better ownership of the passed in params, (get takes a * and set takes a const&). The Value object was changed to have To* and Set methods to make the code clearer compared to the operator<< and operator>> overloading. Bug: Change-Id: Id6ff20a4e3252adfd0a78b643e50b9f095085018 Reviewed-on: https://pdfium-review.googlesource.com/16330 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/javascript/app.h')
-rw-r--r--fpdfsdk/javascript/app.h123
1 files changed, 91 insertions, 32 deletions
diff --git a/fpdfsdk/javascript/app.h b/fpdfsdk/javascript/app.h
index e77c8cd57b..8c0ac3aefb 100644
--- a/fpdfsdk/javascript/app.h
+++ b/fpdfsdk/javascript/app.h
@@ -41,26 +41,85 @@ class app : public CJS_EmbedObj {
explicit app(CJS_Object* pJSObject);
~app() override;
- bool activeDocs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool calculate(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool formsVersion(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- WideString& sError);
- bool fs(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool fullscreen(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool language(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool media(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool platform(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool runtimeHighlight(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- WideString& sError);
- bool viewerType(CJS_Runtime* pRuntime, CJS_PropValue& vp, WideString& sError);
- bool viewerVariation(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- WideString& sError);
- bool viewerVersion(CJS_Runtime* pRuntime,
- CJS_PropValue& vp,
- WideString& sError);
+ bool get_active_docs(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_active_docs(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_calculate(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_calculate(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_forms_version(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_forms_version(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_fs(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
+ bool set_fs(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_fullscreen(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_fullscreen(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_language(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_language(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_media(CJS_Runtime* pRuntime, CJS_PropValue* vp, WideString* sError);
+ bool set_media(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_platform(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_platform(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_runtime_highlight(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_runtime_highlight(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_viewer_type(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_viewer_type(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_viewer_variation(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_viewer_variation(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
+
+ bool get_viewer_version(CJS_Runtime* pRuntime,
+ CJS_PropValue* vp,
+ WideString* sError);
+ bool set_viewer_version(CJS_Runtime* pRuntime,
+ const CJS_PropValue& vp,
+ WideString* sError);
bool alert(CJS_Runtime* pRuntime,
const std::vector<CJS_Value>& params,
@@ -170,18 +229,18 @@ class CJS_App : public CJS_Object {
DECLARE_JS_CLASS();
- JS_STATIC_PROP(activeDocs, app);
- JS_STATIC_PROP(calculate, app);
- JS_STATIC_PROP(formsVersion, app);
- JS_STATIC_PROP(fs, app);
- JS_STATIC_PROP(fullscreen, app);
- JS_STATIC_PROP(language, app);
- JS_STATIC_PROP(media, app);
- JS_STATIC_PROP(platform, app);
- JS_STATIC_PROP(runtimeHighlight, app);
- JS_STATIC_PROP(viewerType, app);
- JS_STATIC_PROP(viewerVariation, app);
- JS_STATIC_PROP(viewerVersion, app);
+ JS_STATIC_PROP(activeDocs, active_docs, app);
+ JS_STATIC_PROP(calculate, calculate, app);
+ JS_STATIC_PROP(formsVersion, forms_version, app);
+ JS_STATIC_PROP(fs, fs, app);
+ JS_STATIC_PROP(fullscreen, fullscreen, app);
+ JS_STATIC_PROP(language, language, app);
+ JS_STATIC_PROP(media, media, app);
+ JS_STATIC_PROP(platform, platform, app);
+ JS_STATIC_PROP(runtimeHighlight, runtime_highlight, app);
+ JS_STATIC_PROP(viewerType, viewer_type, app);
+ JS_STATIC_PROP(viewerVariation, viewer_variation, app);
+ JS_STATIC_PROP(viewerVersion, viewer_version, app);
JS_STATIC_METHOD(alert, app);
JS_STATIC_METHOD(beep, app);