| 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 | |
| 66 if (m_pInfo && m_pInfo->Release) | 61 if (m_pInfo && m_pInfo->Release) |
| 67 m_pInfo->Release(m_pInfo); | 62 m_pInfo->Release(m_pInfo); |
| 68 } | 63 } |
| 69 | 64 |
| 70 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, | 65 int CPDFSDK_FormFillEnvironment::JS_appAlert(const FX_WCHAR* Msg, |
| 71 const FX_WCHAR* Title, | 66 const FX_WCHAR* Title, |
| 72 uint32_t Type, | 67 uint32_t Type, |
| 73 uint32_t Icon) { | 68 uint32_t Icon) { |
| 74 if (!m_pInfo || !m_pInfo->m_pJsPlatform || | 69 if (!m_pInfo || !m_pInfo->m_pJsPlatform || |
| 75 !m_pInfo->m_pJsPlatform->app_alert) { | 70 !m_pInfo->m_pJsPlatform->app_alert) { |
| (...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } else { | 756 } else { |
| 762 m_pFocusAnnot.Reset(pFocusAnnot.Get()); | 757 m_pFocusAnnot.Reset(pFocusAnnot.Get()); |
| 763 } | 758 } |
| 764 } | 759 } |
| 765 return FALSE; | 760 return FALSE; |
| 766 } | 761 } |
| 767 | 762 |
| 768 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { | 763 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { |
| 769 return GetPDFDocument()->GetUserPermissions() & nFlag; | 764 return GetPDFDocument()->GetUserPermissions() & nFlag; |
| 770 } | 765 } |
| OLD | NEW |