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 _JS_OBJECT_H_ | 7 #ifndef _JS_OBJECT_H_ |
8 #define _JS_OBJECT_H_ | 8 #define _JS_OBJECT_H_ |
9 | 9 |
10 #include "../fsdk_define.h" // For FX_UINT | 10 #include "../fsdk_define.h" // For FX_UINT |
(...skipping 28 matching lines...) Expand all Loading... |
39 CJS_Object* m_pJSObject; | 39 CJS_Object* m_pJSObject; |
40 }; | 40 }; |
41 | 41 |
42 class CJS_Object | 42 class CJS_Object |
43 { | 43 { |
44 public: | 44 public: |
45 CJS_Object(JSFXObject pObject); | 45 CJS_Object(JSFXObject pObject); |
46 virtual ~CJS_Object(void); | 46 virtual ~CJS_Object(void); |
47 | 47 |
48 void MakeWeak(); | 48 void MakeWeak(); |
| 49 void Dispose(); |
49 | 50 |
50 virtual FX_BOOL IsType(FX_LPCSTR sClassName){ret
urn TRUE;}; | 51 virtual FX_BOOL IsType(FX_LPCSTR sClassName){ret
urn TRUE;}; |
51 virtual CFX_ByteString GetClassName(){return "";}; | 52 virtual CFX_ByteString GetClassName(){return "";}; |
52 | 53 |
53 virtual FX_BOOL InitInstance(IFXJS_Context* cc){
return TRUE;}; | 54 virtual FX_BOOL InitInstance(IFXJS_Context* cc){
return TRUE;}; |
54 virtual FX_BOOL ExitInstance(){return TRUE;}; | 55 virtual FX_BOOL ExitInstance(){return TRUE;}; |
55 | 56 |
56 operator JSFXObject () {return v8
::Local<v8::Object>::New(m_pIsolate, m_pObject);} | 57 operator JSFXObject () {return v8
::Local<v8::Object>::New(m_pIsolate, m_pObject);} |
57 operator CJS_EmbedObj* (){return
m_pEmbedObj;}; | 58 operator CJS_EmbedObj* (){return
m_pEmbedObj;}; |
58 | 59 |
59 void SetEmbedObject(CJS_Embed
Obj* pObj){m_pEmbedObj = pObj;}; | 60 void SetEmbedObject(CJS_Embed
Obj* pObj){m_pEmbedObj = pObj;}; |
60 CJS_EmbedObj * GetEmbedObject(){return m_pEmbed
Obj;}; | 61 CJS_EmbedObj * GetEmbedObject(){return m_pEmbed
Obj;}; |
61 | 62 |
62 static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc); | 63 static CPDFSDK_PageView * JSGetPageView(IFXJS_Context* cc); |
63 static int MsgBox(CPDFDoc_Environme
nt * pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = N
ULL, FX_UINT nType = 0,FX_UINT nIcon = 0); | 64 static int MsgBox(CPDFDoc_Environme
nt * pApp, CPDFSDK_PageView* pPageView, FX_LPCWSTR swMsg, FX_LPCWSTR swTitle = N
ULL, FX_UINT nType = 0,FX_UINT nIcon = 0); |
64 static void Alert(CJS_Context* pCont
ext, FX_LPCWSTR swMsg); | 65 static void Alert(CJS_Context* pCont
ext, FX_LPCWSTR swMsg); |
65 | 66 |
66 v8::Isolate* GetIsolate() {return m_p
Isolate;} | 67 v8::Isolate* GetIsolate() {return m_p
Isolate;} |
67 protected: | 68 protected: |
68 CJS_EmbedObj * m_pEmbedObj; | 69 CJS_EmbedObj * m_pEmbedObj; |
69 » v8::Persistent<v8::Object>» » » m_pObject; | 70 » v8::Global<v8::Object>» » » m_pObject; |
70 v8::Isolate* m_pIsolate; | 71 v8::Isolate* m_pIsolate; |
71 }; | 72 }; |
72 | 73 |
73 struct JS_TIMER_MAP | 74 struct JS_TIMER_MAP |
74 { | 75 { |
75 FX_UINT nID; | 76 FX_UINT nID; |
76 CJS_Timer * pTimer; | 77 CJS_Timer * pTimer; |
77 }; | 78 }; |
78 | 79 |
79 typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray; | 80 typedef CFX_ArrayTemplate<JS_TIMER_MAP*> CTimerMapArray; |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 FX_DWORD m_dwStartTime; | 290 FX_DWORD m_dwStartTime; |
290 FX_DWORD m_dwTimeOut; | 291 FX_DWORD m_dwTimeOut; |
291 FX_DWORD m_dwElapse; | 292 FX_DWORD m_dwElapse; |
292 CJS_Runtime* m_pRuntime; | 293 CJS_Runtime* m_pRuntime; |
293 CFX_WideString m_swJScript; | 294 CFX_WideString m_swJScript; |
294 int m_nType;
//0:Interval; 1:TimeOut | 295 int m_nType;
//0:Interval; 1:TimeOut |
295 | 296 |
296 CPDFDoc_Environment* m_pApp; | 297 CPDFDoc_Environment* m_pApp; |
297 }; | 298 }; |
298 #endif //_JS_OBJECT_H_ | 299 #endif //_JS_OBJECT_H_ |
OLD | NEW |