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> |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
13 #include "fpdfsdk/include/fsdk_define.h" | 13 #include "fpdfsdk/include/fsdk_define.h" |
14 #include "fpdfsdk/javascript/cjs_runtime.h" | 14 #include "fpdfsdk/javascript/cjs_runtime.h" |
15 #include "fxjs/include/fxjs_v8.h" | 15 #include "fxjs/include/fxjs_v8.h" |
16 | 16 |
17 class CJS_Context; | 17 class CJS_Context; |
18 class CJS_Object; | 18 class CJS_Object; |
19 class CPDFDoc_Environment; | 19 class CPDFDoc_Environment; |
20 | 20 |
21 class CJS_EmbedObj { | 21 class CJS_EmbedObj { |
22 public: | 22 public: |
23 explicit CJS_EmbedObj(CJS_Object* pJSObject); | 23 explicit CJS_EmbedObj(CJS_Object* pJSObject); |
24 virtual ~CJS_EmbedObj(); | 24 virtual ~CJS_EmbedObj(); |
25 | 25 |
26 CJS_Object* GetJSObject() const { return m_pJSObject; } | 26 CJS_Object* GetJSObject() const { return m_pJSObject; } |
27 | 27 |
28 int MsgBox(CPDFDoc_Environment* pApp, | |
29 const FX_WCHAR* swMsg, | |
30 const FX_WCHAR* swTitle, | |
31 FX_UINT nType, | |
32 FX_UINT nIcon); | |
33 void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); | |
34 | |
35 protected: | 28 protected: |
36 CJS_Object* m_pJSObject; | 29 CJS_Object* m_pJSObject; |
37 }; | 30 }; |
38 | 31 |
39 class CJS_Object { | 32 class CJS_Object { |
40 public: | 33 public: |
41 explicit CJS_Object(v8::Local<v8::Object> pObject); | 34 explicit CJS_Object(v8::Local<v8::Object> pObject); |
42 virtual ~CJS_Object(); | 35 virtual ~CJS_Object(); |
43 | 36 |
44 void MakeWeak(); | 37 void MakeWeak(); |
(...skipping 13 matching lines...) Expand all Loading... |
58 v8::Isolate* GetIsolate() { return m_pIsolate; } | 51 v8::Isolate* GetIsolate() { return m_pIsolate; } |
59 | 52 |
60 protected: | 53 protected: |
61 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; | 54 std::unique_ptr<CJS_EmbedObj> m_pEmbedObj; |
62 v8::Global<v8::Object> m_pV8Object; | 55 v8::Global<v8::Object> m_pV8Object; |
63 v8::Isolate* m_pIsolate; | 56 v8::Isolate* m_pIsolate; |
64 }; | 57 }; |
65 | 58 |
66 | 59 |
67 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ | 60 #endif // FPDFSDK_JAVASCRIPT_JS_OBJECT_H_ |
OLD | NEW |