| OLD | NEW |
| 1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" | 7 #include "fpdfsdk/cpdfsdk_formfillenvironment.h" |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 // |m_pAnnotHandlerMgr| will try to access |m_pFormFiller| | 51 // |m_pAnnotHandlerMgr| will try to access |m_pFormFiller| |
| 52 // when it cleans up. So, we must make sure it is cleaned up before | 52 // when it cleans up. So, we must make sure it is cleaned up before |
| 53 // |m_pFormFiller|. | 53 // |m_pFormFiller|. |
| 54 m_pAnnotHandlerMgr.reset(); | 54 m_pAnnotHandlerMgr.reset(); |
| 55 | 55 |
| 56 // Must destroy the |m_pFormFiller| before the environment (|this|) | 56 // Must destroy the |m_pFormFiller| before the environment (|this|) |
| 57 // because any created form widgets hold a pointer to the environment. | 57 // because any created form widgets hold a pointer to the environment. |
| 58 // Those widgets may call things like KillTimer() as they are shutdown. | 58 // Those widgets may call things like KillTimer() as they are shutdown. |
| 59 m_pFormFiller.reset(); | 59 m_pFormFiller.reset(); |
| 60 | 60 |
| 61 #ifdef PDF_ENABLE_XFA |
| 62 CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance(); |
| 63 if (pProvider->m_pFormFillEnvList.GetSize() == 0) |
| 64 pProvider->SetJavaScriptInitialized(FALSE); |
| 65 #endif // PDF_ENABLE_XFA |
| 61 if (m_pInfo && m_pInfo->Release) | 66 if (m_pInfo && m_pInfo->Release) |
| 62 m_pInfo->Release(m_pInfo); | 67 m_pInfo->Release(m_pInfo); |
| 63 } | 68 } |
| 64 | 69 |
| 65 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, | 70 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, |
| 66 const FX_WCHAR* Title, | 71 const FX_WCHAR* Title, |
| 67 uint32_t Type, | 72 uint32_t Type, |
| 68 uint32_t Icon) { | 73 uint32_t Icon) { |
| 69 if (!m_pInfo || !m_pInfo->m_pJsPlatform || | 74 if (!m_pInfo || !m_pInfo->m_pJsPlatform || |
| 70 !m_pInfo->m_pJsPlatform->app_alert) { | 75 !m_pInfo->m_pJsPlatform->app_alert) { |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 756 } else { | 761 } else { |
| 757 m_pFocusAnnot.Reset(pFocusAnnot.Get()); | 762 m_pFocusAnnot.Reset(pFocusAnnot.Get()); |
| 758 } | 763 } |
| 759 } | 764 } |
| 760 return FALSE; | 765 return FALSE; |
| 761 } | 766 } |
| 762 | 767 |
| 763 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { | 768 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { |
| 764 return GetPDFDocument()->GetUserPermissions() & nFlag; | 769 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 765 } | 770 } |
| OLD | NEW |