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_JAVASCRIPT_JS_OBJECT_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 8 #define FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 28 matching lines...) Expand all Loading... |
39 }; | 39 }; |
40 | 40 |
41 class CJS_Object { | 41 class CJS_Object { |
42 public: | 42 public: |
43 explicit CJS_Object(v8::Local<v8::Object> pObject); | 43 explicit CJS_Object(v8::Local<v8::Object> pObject); |
44 virtual ~CJS_Object(); | 44 virtual ~CJS_Object(); |
45 | 45 |
46 void MakeWeak(); | 46 void MakeWeak(); |
47 void Dispose(); | 47 void Dispose(); |
48 | 48 |
49 virtual FX_BOOL IsType(const FX_CHAR* sClassName); | |
50 virtual CFX_ByteString GetClassName(); | |
51 | |
52 virtual void InitInstance(IJS_Runtime* pIRuntime); | 49 virtual void InitInstance(IJS_Runtime* pIRuntime); |
53 virtual void ExitInstance(); | 50 virtual void ExitInstance(); |
54 | 51 |
55 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } | 52 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } |
56 | 53 |
57 // Takes ownership of |pObj|. | 54 // Takes ownership of |pObj|. |
58 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } | 55 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } |
59 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } | 56 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } |
60 | 57 |
61 static int MsgBox(CPDFDoc_Environment* pApp, | |
62 const FX_WCHAR* swMsg, | |
63 const FX_WCHAR* swTitle, | |
64 FX_UINT nType, | |
65 FX_UINT nIcon); | |
66 static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); | 58 static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); |
67 | 59 |
68 v8::Isolate* GetIsolate() { return m_pIsolate; } | 60 v8::Isolate* GetIsolate() { return m_pIsolate; } |
69 | 61 |
70 protected: | 62 protected: |
71 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; | 63 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; |
72 v8::Global<v8::Object> m_pV8Object; | 64 v8::Global<v8::Object> m_pV8Object; |
73 v8::Isolate* m_pIsolate; | 65 v8::Isolate* m_pIsolate; |
74 }; | 66 }; |
75 | 67 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 | 99 |
108 // data | 100 // data |
109 const int m_nType; // 0:Interval; 1:TimeOut | 101 const int m_nType; // 0:Interval; 1:TimeOut |
110 const uint32_t m_dwTimeOut; | 102 const uint32_t m_dwTimeOut; |
111 const CFX_WideString m_swJScript; | 103 const CFX_WideString m_swJScript; |
112 CJS_Runtime* const m_pRuntime; | 104 CJS_Runtime* const m_pRuntime; |
113 CPDFDoc_Environment* const m_pApp; | 105 CPDFDoc_Environment* const m_pApp; |
114 }; | 106 }; |
115 | 107 |
116 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 108 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
OLD | NEW |