| 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_GLOBAL_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_ |
| 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_ |
| 9 | 9 |
| 10 #include "JS_Define.h" | 10 #include "JS_Define.h" |
| 11 | 11 |
| 12 class CJS_GlobalData; | 12 class CJS_GlobalData; |
| 13 class CJS_GlobalVariableArray; | 13 class CJS_GlobalVariableArray; |
| 14 class CJS_KeyValue; | 14 class CJS_KeyValue; |
| 15 | 15 |
| 16 struct js_global_data { | 16 struct JSGlobalData { |
| 17 js_global_data() { | 17 JSGlobalData() { |
| 18 nType = 0; | 18 nType = 0; |
| 19 dData = 0; | 19 dData = 0; |
| 20 bData = FALSE; | 20 bData = FALSE; |
| 21 sData = ""; | 21 sData = ""; |
| 22 bPersistent = FALSE; | 22 bPersistent = FALSE; |
| 23 bDeleted = FALSE; | 23 bDeleted = FALSE; |
| 24 } | 24 } |
| 25 | 25 |
| 26 ~js_global_data() { pData.Reset(); } | 26 ~JSGlobalData() { pData.Reset(); } |
| 27 int nType; // 0:int 1:bool 2:string 3:obj | 27 int nType; // 0:int 1:bool 2:string 3:obj |
| 28 double dData; | 28 double dData; |
| 29 bool bData; | 29 bool bData; |
| 30 CFX_ByteString sData; | 30 CFX_ByteString sData; |
| 31 v8::Global<v8::Object> pData; | 31 v8::Global<v8::Object> pData; |
| 32 bool bPersistent; | 32 bool bPersistent; |
| 33 bool bDeleted; | 33 bool bDeleted; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 class global_alternate : public CJS_EmbedObj { | 36 class JSGlobalAlternate : public CJS_EmbedObj { |
| 37 public: | 37 public: |
| 38 global_alternate(CJS_Object* pJSObject); | 38 JSGlobalAlternate(CJS_Object* pJSObject); |
| 39 ~global_alternate() override; | 39 ~JSGlobalAlternate() override; |
| 40 | 40 |
| 41 public: | |
| 42 FX_BOOL setPersistent(IFXJS_Context* cc, | 41 FX_BOOL setPersistent(IFXJS_Context* cc, |
| 43 const CJS_Parameters& params, | 42 const CJS_Parameters& params, |
| 44 CJS_Value& vRet, | 43 CJS_Value& vRet, |
| 45 CFX_WideString& sError); | 44 CFX_WideString& sError); |
| 46 | |
| 47 public: | |
| 48 FX_BOOL QueryProperty(const FX_WCHAR* propname); | 45 FX_BOOL QueryProperty(const FX_WCHAR* propname); |
| 49 FX_BOOL DoProperty(IFXJS_Context* cc, | 46 FX_BOOL DoProperty(IFXJS_Context* cc, |
| 50 const FX_WCHAR* propname, | 47 const FX_WCHAR* propname, |
| 51 CJS_PropValue& vp, | 48 CJS_PropValue& vp, |
| 52 CFX_WideString& sError); | 49 CFX_WideString& sError); |
| 53 FX_BOOL DelProperty(IFXJS_Context* cc, | 50 FX_BOOL DelProperty(IFXJS_Context* cc, |
| 54 const FX_WCHAR* propname, | 51 const FX_WCHAR* propname, |
| 55 CFX_WideString& sError); | 52 CFX_WideString& sError); |
| 56 | |
| 57 void Initial(CPDFDoc_Environment* pApp); | 53 void Initial(CPDFDoc_Environment* pApp); |
| 58 | 54 |
| 59 private: | 55 private: |
| 60 void UpdateGlobalPersistentVariables(); | 56 void UpdateGlobalPersistentVariables(); |
| 61 void CommitGlobalPersisitentVariables(); | 57 void CommitGlobalPersisitentVariables(); |
| 62 void DestroyGlobalPersisitentVariables(); | 58 void DestroyGlobalPersisitentVariables(); |
| 63 FX_BOOL SetGlobalVariables(const FX_CHAR* propname, | 59 FX_BOOL SetGlobalVariables(const FX_CHAR* propname, |
| 64 int nType, | 60 int nType, |
| 65 double dData, | 61 double dData, |
| 66 bool bData, | 62 bool bData, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 82 class CJS_Global : public CJS_Object { | 78 class CJS_Global : public CJS_Object { |
| 83 public: | 79 public: |
| 84 explicit CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {} | 80 explicit CJS_Global(JSFXObject pObject) : CJS_Object(pObject) {} |
| 85 ~CJS_Global() override {} | 81 ~CJS_Global() override {} |
| 86 | 82 |
| 87 // CJS_Object | 83 // CJS_Object |
| 88 FX_BOOL InitInstance(IFXJS_Context* cc) override; | 84 FX_BOOL InitInstance(IFXJS_Context* cc) override; |
| 89 | 85 |
| 90 DECLARE_SPECIAL_JS_CLASS(CJS_Global); | 86 DECLARE_SPECIAL_JS_CLASS(CJS_Global); |
| 91 | 87 |
| 92 JS_SPECIAL_STATIC_METHOD(setPersistent, global_alternate, global); | 88 JS_SPECIAL_STATIC_METHOD(setPersistent, JSGlobalAlternate, global); |
| 93 }; | 89 }; |
| 94 | 90 |
| 95 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_ | 91 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_GLOBAL_H_ |
| OLD | NEW |