OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
9 | 9 |
10 #include "../../../core/include/fxcrt/fx_string.h" | 10 #include "../../../core/include/fxcrt/fx_string.h" |
11 #include "../../../core/include/fxcrt/fx_system.h" | 11 #include "../../../core/include/fxcrt/fx_system.h" |
12 #include "../../../xfa/include/fxjse/fxjse.h" | 12 #include "../../../xfa/include/fxjse/fxjse.h" |
13 | 13 |
| 14 class CPDFDoc_Environment; |
| 15 class CPDFSDK_Annot; |
| 16 class CPDFSDK_Document; |
14 class CPDF_Bookmark; | 17 class CPDF_Bookmark; |
15 class CPDF_FormField; | 18 class CPDF_FormField; |
16 class CPDFSDK_Annot; | |
17 class CPDFSDK_Document; | |
18 | 19 |
19 class IFXJS_Context { | 20 class IFXJS_Context { |
20 public: | 21 public: |
21 virtual FX_BOOL RunScript(const CFX_WideString& script, | 22 virtual FX_BOOL RunScript(const CFX_WideString& script, |
22 CFX_WideString& info) = 0; | 23 CFX_WideString& info) = 0; |
23 | 24 |
24 virtual void OnApp_Init() = 0; | 25 virtual void OnApp_Init() = 0; |
25 | 26 |
26 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, | 27 virtual void OnDoc_Open(CPDFSDK_Document* pDoc, |
27 const CFX_WideString& strTargetName) = 0; | 28 const CFX_WideString& strTargetName) = 0; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 144 |
144 virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, | 145 virtual FX_BOOL GetHValueByName(const CFX_ByteStringC& utf8Name, |
145 FXJSE_HVALUE hValue) = 0; | 146 FXJSE_HVALUE hValue) = 0; |
146 virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, | 147 virtual FX_BOOL SetHValueByName(const CFX_ByteStringC& utf8Name, |
147 FXJSE_HVALUE hValue) = 0; | 148 FXJSE_HVALUE hValue) = 0; |
148 | 149 |
149 protected: | 150 protected: |
150 virtual ~IFXJS_Runtime() {} | 151 virtual ~IFXJS_Runtime() {} |
151 }; | 152 }; |
152 | 153 |
153 class CPDFDoc_Environment; | |
154 class CJS_GlobalData; | |
155 | |
156 class CJS_RuntimeFactory { | 154 class CJS_RuntimeFactory { |
157 public: | 155 public: |
158 CJS_RuntimeFactory() | 156 CJS_RuntimeFactory() : m_bInit(FALSE), m_nRef(0) {} |
159 : m_bInit(FALSE), m_nRef(0), m_pGlobalData(NULL), m_nGlobalDataCount(0) {} | |
160 ~CJS_RuntimeFactory(); | 157 ~CJS_RuntimeFactory(); |
| 158 |
161 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); | 159 IFXJS_Runtime* NewJSRuntime(CPDFDoc_Environment* pApp); |
162 void DeleteJSRuntime(IFXJS_Runtime* pRuntime); | 160 void DeleteJSRuntime(IFXJS_Runtime* pRuntime); |
163 void AddRef(); | 161 void AddRef(); |
164 void Release(); | 162 void Release(); |
165 | 163 |
166 CJS_GlobalData* NewGlobalData(CPDFDoc_Environment* pApp); | |
167 void ReleaseGlobalData(); | |
168 | |
169 private: | 164 private: |
170 FX_BOOL m_bInit; | 165 FX_BOOL m_bInit; |
171 int m_nRef; | 166 int m_nRef; |
172 CJS_GlobalData* m_pGlobalData; | |
173 int32_t m_nGlobalDataCount; | |
174 }; | 167 }; |
175 | 168 |
176 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ | 169 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_IJAVASCRIPT_H_ |
OLD | NEW |