Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(369)

Side by Side Diff: fpdfsdk/cpdfsdk_formfillenvironment.cpp

Issue 2421603002: Reland: Make the CPDFXFA_App non-global (Closed)
Patch Set: Review feedback Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/DEPS ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 } else { 755 } else {
761 m_pFocusAnnot.Reset(pFocusAnnot.Get()); 756 m_pFocusAnnot.Reset(pFocusAnnot.Get());
762 } 757 }
763 } 758 }
764 return FALSE; 759 return FALSE;
765 } 760 }
766 761
767 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) { 762 FX_BOOL CPDFSDK_FormFillEnvironment::GetPermissions(int nFlag) {
768 return !!(GetPDFDocument()->GetUserPermissions() & nFlag); 763 return !!(GetPDFDocument()->GetUserPermissions() & nFlag);
769 } 764 }
OLDNEW
« no previous file with comments | « fpdfsdk/DEPS ('k') | fpdfsdk/fpdfdoc_unittest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698