summaryrefslogtreecommitdiff
path: root/fxjs/cjx_object.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-11-01 16:06:07 +0000
committerChromium commit bot <commit-bot@chromium.org>2017-11-01 16:06:07 +0000
commita85e5ca5f2dfadcf9f3812a8ef039d1f206833a4 (patch)
tree5d44e797d038158cdc19b14ac6951435eb85c912 /fxjs/cjx_object.h
parente5434b5531f2c081c1d69f67125b6665070ea969 (diff)
downloadpdfium-a85e5ca5f2dfadcf9f3812a8ef039d1f206833a4.tar.xz
Split JS methods out of CXFA_Object
This CL moves the javascript code from CXFA_Object to CJX_Object. The Script_* methods are proxied to CJX_Object. The ownership of the CJX_ object was removed from CXFA_Node and moved up to CXFA_Object. Change-Id: I58d286e6bb0151aa88d4f673bc7729987417bde6 Reviewed-on: https://pdfium-review.googlesource.com/17310 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fxjs/cjx_object.h')
-rw-r--r--fxjs/cjx_object.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/fxjs/cjx_object.h b/fxjs/cjx_object.h
new file mode 100644
index 0000000000..9e957d88ba
--- /dev/null
+++ b/fxjs/cjx_object.h
@@ -0,0 +1,41 @@
+// Copyright 2017 PDFium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
+
+#ifndef FXJS_CJX_OBJECT_H_
+#define FXJS_CJX_OBJECT_H_
+
+#include "core/fxcrt/unowned_ptr.h"
+#include "core/fxcrt/widestring.h"
+#include "xfa/fxfa/fxfa_basic.h"
+
+class CFXJSE_Value;
+class CXFA_Object;
+
+class CJX_Object {
+ public:
+ explicit CJX_Object(CXFA_Object* object);
+ virtual ~CJX_Object();
+
+ CXFA_Object* GetXFAObject() { return object_.Get(); }
+ const CXFA_Object* GetXFAObject() const { return object_.Get(); }
+
+ void Script_ObjectClass_ClassName(CFXJSE_Value* pValue,
+ bool bSetting,
+ XFA_ATTRIBUTE eAttribute);
+
+ void ThrowInvalidPropertyException() const;
+ void ThrowArgumentMismatchException() const;
+ void ThrowIndexOutOfBoundsException() const;
+ void ThrowParamCountMismatchException(const WideString& method) const;
+
+ // Make this protected when the cscript_* objects are converted to CJX.
+ void ThrowException(const wchar_t* str, ...) const;
+
+ private:
+ UnownedPtr<CXFA_Object> object_;
+};
+
+#endif // FXJS_CJX_OBJECT_H_