Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 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 | |
dsinclair | bec7692 | 2016-09-29 16:52:30 -0700 | [diff] [blame] | 7 | #ifndef FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ |
| 8 | #define FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 9 | |
dsinclair | 5b49309 | 2016-09-29 20:20:24 -0700 | [diff] [blame^] | 10 | #include "xfa/fxfa/fxfa.h" |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 11 | |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 12 | class CPDFSDK_Environment; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 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 | |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 23 | FX_BOOL Initialize(v8::Isolate* pIsolate); |
weili | 2d5b020 | 2016-08-03 11:06:49 -0700 | [diff] [blame] | 24 | CXFA_FFApp* GetXFAApp() { return m_pXFAApp.get(); } |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 25 | |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 26 | FX_BOOL AddFormFillEnv(CPDFSDK_Environment* pEnv); |
| 27 | FX_BOOL RemoveFormFillEnv(CPDFSDK_Environment* pEnv); |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 28 | |
| 29 | FX_BOOL IsJavaScriptInitialized() const { return m_bJavaScriptInitialized; } |
| 30 | void SetJavaScriptInitialized(FX_BOOL bInitialized) { |
| 31 | m_bJavaScriptInitialized = bInitialized; |
| 32 | } |
| 33 | |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 34 | v8::Isolate* GetJSERuntime() const { return m_pIsolate; } |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 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; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 44 | void GetAppName(CFX_WideString& wsName) override; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 45 | |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 46 | void Beep(uint32_t dwType) override; |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 47 | int32_t MsgBox(const CFX_WideString& wsMessage, |
| 48 | const CFX_WideString& wsTitle, |
tsepez | c3255f5 | 2016-03-25 14:52:27 -0700 | [diff] [blame] | 49 | uint32_t dwIconType, |
| 50 | uint32_t dwButtonType) override; |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 51 | CFX_WideString Response(const CFX_WideString& wsQuestion, |
| 52 | const CFX_WideString& wsTitle, |
| 53 | const CFX_WideString& wsDefaultAnswer, |
| 54 | FX_BOOL bMark) override; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 55 | |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 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, |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 62 | CFX_WideString& wsResponse) override; |
tsepez | 3f80c86 | 2016-05-16 12:03:24 -0700 | [diff] [blame] | 63 | FX_BOOL PutRequestURL(const CFX_WideString& wsURL, |
| 64 | const CFX_WideString& wsData, |
| 65 | const CFX_WideString& wsEncode) override; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 66 | |
| 67 | void LoadString(int32_t iStringID, CFX_WideString& wsString) override; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 68 | IFWL_AdapterTimerMgr* GetTimerMgr() override; |
| 69 | |
dsinclair | 79db609 | 2016-09-14 07:27:21 -0700 | [diff] [blame] | 70 | CFX_ArrayTemplate<CPDFSDK_Environment*> m_pEnvList; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 71 | |
| 72 | protected: |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 73 | FX_BOOL m_bJavaScriptInitialized; |
weili | 2d5b020 | 2016-08-03 11:06:49 -0700 | [diff] [blame] | 74 | std::unique_ptr<CXFA_FFApp> m_pXFAApp; |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 75 | v8::Isolate* m_pIsolate; |
Lei Zhang | 9429368 | 2016-01-27 18:27:56 -0800 | [diff] [blame] | 76 | CFX_WideString m_csAppType; |
| 77 | }; |
| 78 | |
dsinclair | bec7692 | 2016-09-29 16:52:30 -0700 | [diff] [blame] | 79 | #endif // FPDFSDK_FPDFXFA_FPDFXFA_APP_H_ |