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_JS_OBJECT_H_ | 7 #ifndef FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 8 #define FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 30 matching lines...) Expand all Loading... |
41 FX_UINT nType = 0, | 41 FX_UINT nType = 0, |
42 FX_UINT nIcon = 0); | 42 FX_UINT nIcon = 0); |
43 void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); | 43 void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); |
44 | 44 |
45 protected: | 45 protected: |
46 CJS_Object* m_pJSObject; | 46 CJS_Object* m_pJSObject; |
47 }; | 47 }; |
48 | 48 |
49 class CJS_Object { | 49 class CJS_Object { |
50 public: | 50 public: |
51 explicit CJS_Object(JSFXObject pObject); | 51 explicit CJS_Object(v8::Local<v8::Object> pObject); |
52 virtual ~CJS_Object(); | 52 virtual ~CJS_Object(); |
53 | 53 |
54 void MakeWeak(); | 54 void MakeWeak(); |
55 void Dispose(); | 55 void Dispose(); |
56 | 56 |
57 virtual FX_BOOL IsType(const FX_CHAR* sClassName) { return TRUE; } | 57 virtual FX_BOOL IsType(const FX_CHAR* sClassName) { return TRUE; } |
58 virtual CFX_ByteString GetClassName() { return ""; } | 58 virtual CFX_ByteString GetClassName() { return ""; } |
59 | 59 |
60 virtual FX_BOOL InitInstance(IFXJS_Context* cc) { return TRUE; } | 60 virtual FX_BOOL InitInstance(IFXJS_Context* cc) { return TRUE; } |
61 virtual FX_BOOL ExitInstance() { return TRUE; } | 61 virtual FX_BOOL ExitInstance() { return TRUE; } |
62 | 62 |
63 operator JSFXObject() { | 63 operator v8::Local<v8::Object>() { |
64 return v8::Local<v8::Object>::New(m_pIsolate, m_pObject); | 64 return v8::Local<v8::Object>::New(m_pIsolate, m_pObject); |
65 } | 65 } |
66 | 66 |
67 // Takes ownership of |pObj|. | 67 // Takes ownership of |pObj|. |
68 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } | 68 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } |
69 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } | 69 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } |
70 | 70 |
71 static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc); | 71 static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc); |
72 static int MsgBox(CPDFDoc_Environment* pApp, | 72 static int MsgBox(CPDFDoc_Environment* pApp, |
73 CPDFSDK_PageView* pPageView, | 73 CPDFSDK_PageView* pPageView, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 FX_DWORD m_dwTimeOut; | 134 FX_DWORD m_dwTimeOut; |
135 FX_DWORD m_dwElapse; | 135 FX_DWORD m_dwElapse; |
136 CJS_Runtime* m_pRuntime; | 136 CJS_Runtime* m_pRuntime; |
137 CFX_WideString m_swJScript; | 137 CFX_WideString m_swJScript; |
138 int m_nType; // 0:Interval; 1:TimeOut | 138 int m_nType; // 0:Interval; 1:TimeOut |
139 | 139 |
140 CPDFDoc_Environment* m_pApp; | 140 CPDFDoc_Environment* m_pApp; |
141 }; | 141 }; |
142 | 142 |
143 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 143 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
OLD | NEW |