| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 v8::Local<v8::Object>() { | 63 v8::Local<v8::Object> ToV8Object() { return m_pV8Object.Get(m_pIsolate); } |
| 64 return v8::Local<v8::Object>::New(m_pIsolate, m_pObject); | |
| 65 } | |
| 66 | 64 |
| 67 // Takes ownership of |pObj|. | 65 // Takes ownership of |pObj|. |
| 68 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } | 66 void SetEmbedObject(CJS_EmbedObj* pObj) { m_pEmbedObj.reset(pObj); } |
| 69 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } | 67 CJS_EmbedObj* GetEmbedObject() const { return m_pEmbedObj.get(); } |
| 70 | 68 |
| 71 static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc); | 69 static CPDFSDK_PageView* JSGetPageView(IFXJS_Context* cc); |
| 72 static int MsgBox(CPDFDoc_Environment* pApp, | 70 static int MsgBox(CPDFDoc_Environment* pApp, |
| 73 CPDFSDK_PageView* pPageView, | 71 CPDFSDK_PageView* pPageView, |
| 74 const FX_WCHAR* swMsg, | 72 const FX_WCHAR* swMsg, |
| 75 const FX_WCHAR* swTitle = NULL, | 73 const FX_WCHAR* swTitle = NULL, |
| 76 FX_UINT nType = 0, | 74 FX_UINT nType = 0, |
| 77 FX_UINT nIcon = 0); | 75 FX_UINT nIcon = 0); |
| 78 static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); | 76 static void Alert(CJS_Context* pContext, const FX_WCHAR* swMsg); |
| 79 | 77 |
| 80 v8::Isolate* GetIsolate() { return m_pIsolate; } | 78 v8::Isolate* GetIsolate() { return m_pIsolate; } |
| 81 | 79 |
| 82 protected: | 80 protected: |
| 83 nonstd::unique_ptr<CJS_EmbedObj> m_pEmbedObj; | 81 nonstd::unique_ptr<CJS_EmbedObj> m_pEmbedObj; |
| 84 v8::Global<v8::Object> m_pObject; | 82 v8::Global<v8::Object> m_pV8Object; |
| 85 v8::Isolate* m_pIsolate; | 83 v8::Isolate* m_pIsolate; |
| 86 }; | 84 }; |
| 87 | 85 |
| 88 class CJS_Timer { | 86 class CJS_Timer { |
| 89 public: | 87 public: |
| 90 CJS_Timer(CJS_EmbedObj* pObj, CPDFDoc_Environment* pApp) | 88 CJS_Timer(CJS_EmbedObj* pObj, CPDFDoc_Environment* pApp) |
| 91 : m_nTimerID(0), | 89 : m_nTimerID(0), |
| 92 m_pEmbedObj(pObj), | 90 m_pEmbedObj(pObj), |
| 93 m_bProcessing(FALSE), | 91 m_bProcessing(FALSE), |
| 94 m_dwStartTime(0), | 92 m_dwStartTime(0), |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 FX_DWORD m_dwTimeOut; | 132 FX_DWORD m_dwTimeOut; |
| 135 FX_DWORD m_dwElapse; | 133 FX_DWORD m_dwElapse; |
| 136 CJS_Runtime* m_pRuntime; | 134 CJS_Runtime* m_pRuntime; |
| 137 CFX_WideString m_swJScript; | 135 CFX_WideString m_swJScript; |
| 138 int m_nType; // 0:Interval; 1:TimeOut | 136 int m_nType; // 0:Interval; 1:TimeOut |
| 139 | 137 |
| 140 CPDFDoc_Environment* m_pApp; | 138 CPDFDoc_Environment* m_pApp; |
| 141 }; | 139 }; |
| 142 | 140 |
| 143 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ | 141 #endif // FPDFSDK_INCLUDE_JAVASCRIPT_JS_OBJECT_H_ |
| OLD | NEW |