OLD | NEW |
| (Empty) |
1 // Copyright 2014 PDFium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
6 | |
7 #ifndef FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ | |
8 #define FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ | |
9 | |
10 #include "xfa/fxfa/include/fxfa.h" | |
11 | |
12 class CPDFSDK_Environment; | |
13 class IFXJS_Runtime; | |
14 | |
15 class CPDFXFA_App : public IXFA_AppProvider { | |
16 public: | |
17 static CPDFXFA_App* GetInstance(); | |
18 static void ReleaseInstance(); | |
19 | |
20 CPDFXFA_App(); | |
21 ~CPDFXFA_App() override; | |
22 | |
23 FX_BOOL Initialize(v8::Isolate* pIsolate); | |
24 CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } | |
25 | |
26 FX_BOOL AddFormFillEnv(CPDFSDK_Environment* pEnv); | |
27 FX_BOOL RemoveFormFillEnv(CPDFSDK_Environment* pEnv); | |
28 | |
29 FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } | |
30 void SetJavaScriptInitialized(FX_BOOL bInitialized) { | |
31 m_bJavaScriptInitialized = bInitialized; | |
32 } | |
33 | |
34 v8::Isolate* GetJSERuntime() const { return m_pIsolate; } | |
35 | |
36 // IFXA_AppProvider: | |
37 void GetAppType(CFX_WideString& wsAppType) override; | |
38 void SetAppType(const CFX_WideStringC& wsAppType) override; | |
39 | |
40 void GetLanguage(CFX_WideString& wsLanguage) override; | |
41 void GetPlatform(CFX_WideString& wsPlatform) override; | |
42 void GetVariation(CFX_WideString& wsVariation) override; | |
43 void GetVersion(CFX_WideString& wsVersion) override; | |
44 void GetAppName(CFX_WideString& wsName) override; | |
45 | |
46 void Beep(uint32_t dwType) override; | |
47 int32_t MsgBox(const CFX_WideString& wsMessage, | |
48 const CFX_WideString& wsTitle, | |
49 uint32_t dwIconType, | |
50 uint32_t dwButtonType) override; | |
51 CFX_WideString Response(const CFX_WideString& wsQuestion, | |
52 const CFX_WideString& wsTitle, | |
53 const CFX_WideString& wsDefaultAnswer, | |
54 FX_BOOL bMark) override; | |
55 | |
56 IFX_FileRead* DownloadURL(const CFX_WideString& wsURL) override; | |
57 FX_BOOL PostRequestURL(const CFX_WideString& wsURL, | |
58 const CFX_WideString& wsData, | |
59 const CFX_WideString& wsContentType, | |
60 const CFX_WideString& wsEncode, | |
61 const CFX_WideString& wsHeader, | |
62 CFX_WideString& wsResponse) override; | |
63 FX_BOOL PutRequestURL(const CFX_WideString& wsURL, | |
64 const CFX_WideString& wsData, | |
65 const CFX_WideString& wsEncode) override; | |
66 | |
67 void LoadString(int32_t iStringID, CFX_WideString& wsString) override; | |
68 IFWL_AdapterTimerMgr* GetTimerMgr() override; | |
69 | |
70 CFX_ArrayTemplate<CPDFSDK_Environment*> m_pEnvList; | |
71 | |
72 protected: | |
73 FX_BOOL m_bJavaScriptInitialized; | |
74 std::unique_ptr<CXFA_FFApp> m_pXFAApp; | |
75 v8::Isolate* m_pIsolate; | |
76 CFX_WideString m_csAppType; | |
77 }; | |
78 | |
79 #endif // FPDFSDK_FPDFXFA_INCLUDE_FPDFXFA_APP_H_ | |
OLD | NEW |