OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef XFA_FXFA_XFA_FFAPP_H_ | 7 #ifndef XFA_FXFA_XFA_FFAPP_H_ |
8 #define XFA_FXFA_XFA_FFAPP_H_ | 8 #define XFA_FXFA_XFA_FFAPP_H_ |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "core/fpdfapi/parser/cpdf_stream.h" | 13 #include "core/fpdfapi/parser/cpdf_stream.h" |
14 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 14 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
15 #include "xfa/fgas/font/fgas_font.h" | 15 #include "xfa/fgas/font/cfgas_fontmgr.h" |
16 #include "xfa/fwl/core/ifwl_app.h" | 16 #include "xfa/fwl/core/ifwl_app.h" |
17 #include "xfa/fxfa/fxfa.h" | 17 #include "xfa/fxfa/fxfa.h" |
18 | 18 |
19 class CFWL_WidgetMgrDelegate; | 19 class CFWL_WidgetMgrDelegate; |
20 class CXFA_DefFontMgr; | 20 class CXFA_DefFontMgr; |
21 class CXFA_FWLAdapterWidgetMgr; | 21 class CXFA_FWLAdapterWidgetMgr; |
22 class CXFA_FWLTheme; | 22 class CXFA_FWLTheme; |
23 class CXFA_FFDocHandler; | 23 class CXFA_FFDocHandler; |
24 class CXFA_FontMgr; | 24 class CXFA_FontMgr; |
25 class IFWL_AdapterTimerMgr; | 25 class IFWL_AdapterTimerMgr; |
(...skipping 19 matching lines...) Expand all Loading... |
45 | 45 |
46 CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, | 46 CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, |
47 IFX_SeekableReadStream* pStream, | 47 IFX_SeekableReadStream* pStream, |
48 bool bTakeOverFile); | 48 bool bTakeOverFile); |
49 CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, | 49 CXFA_FFDoc* CreateDoc(IXFA_DocEnvironment* pDocEnvironment, |
50 CPDF_Document* pPDFDoc); | 50 CPDF_Document* pPDFDoc); |
51 void SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); | 51 void SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr); |
52 | 52 |
53 CXFA_FFDocHandler* GetDocHandler(); | 53 CXFA_FFDocHandler* GetDocHandler(); |
54 CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(CFWL_WidgetMgrDelegate* pDelegate); | 54 CXFA_FWLAdapterWidgetMgr* GetWidgetMgr(CFWL_WidgetMgrDelegate* pDelegate); |
55 IFGAS_FontMgr* GetFDEFontMgr(); | 55 CFGAS_FontMgr* GetFDEFontMgr(); |
56 CXFA_FWLTheme* GetFWLTheme(); | 56 CXFA_FWLTheme* GetFWLTheme(); |
57 | 57 |
58 IXFA_AppProvider* GetAppProvider() const { return m_pProvider; } | 58 IXFA_AppProvider* GetAppProvider() const { return m_pProvider; } |
59 const IFWL_App* GetFWLApp() const { return m_pFWLApp.get(); } | 59 const IFWL_App* GetFWLApp() const { return m_pFWLApp.get(); } |
60 IFWL_AdapterTimerMgr* GetTimerMgr() const; | 60 IFWL_AdapterTimerMgr* GetTimerMgr() const; |
61 CXFA_FontMgr* GetXFAFontMgr() const; | 61 CXFA_FontMgr* GetXFAFontMgr() const; |
62 CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { | 62 CFWL_WidgetMgrDelegate* GetWidgetMgrDelegate() const { |
63 return m_pWidgetMgrDelegate; | 63 return m_pWidgetMgrDelegate; |
64 } | 64 } |
65 | 65 |
66 void ClearEventTargets(); | 66 void ClearEventTargets(); |
67 | 67 |
68 protected: | 68 protected: |
69 std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; | 69 std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; |
70 IXFA_AppProvider* const m_pProvider; | 70 IXFA_AppProvider* const m_pProvider; |
71 | 71 |
72 // The fonts stored in the font manager may have been created by the default | 72 // The fonts stored in the font manager may have been created by the default |
73 // font manager. The GEFont::LoadFont call takes the manager as a param and | 73 // font manager. The GEFont::LoadFont call takes the manager as a param and |
74 // stores it internally. When you destroy the GEFont it tries to unregister | 74 // stores it internally. When you destroy the GEFont it tries to unregister |
75 // from the font manager and if the default font manager was destroyed first | 75 // from the font manager and if the default font manager was destroyed first |
76 // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont | 76 // get get a use-after-free. The m_pFWLTheme can try to cleanup a GEFont |
77 // when it frees, so make sure it gets cleaned up first. That requires | 77 // when it frees, so make sure it gets cleaned up first. That requires |
78 // m_pFWLApp to be cleaned up as well. | 78 // m_pFWLApp to be cleaned up as well. |
79 // | 79 // |
80 // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead | 80 // TODO(dsinclair): The GEFont should have the FontMgr as the pointer instead |
81 // of the DEFFontMgr so this goes away. Bug 561. | 81 // of the DEFFontMgr so this goes away. Bug 561. |
82 std::unique_ptr<IFGAS_FontMgr> m_pFDEFontMgr; | 82 std::unique_ptr<CFGAS_FontMgr> m_pFDEFontMgr; |
83 std::unique_ptr<CXFA_FontMgr> m_pFontMgr; | 83 std::unique_ptr<CXFA_FontMgr> m_pFontMgr; |
84 | 84 |
85 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ | 85 #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ |
86 std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource; | 86 std::unique_ptr<CFX_FontSourceEnum_File> m_pFontSource; |
87 #endif | 87 #endif |
88 std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr; | 88 std::unique_ptr<CXFA_FWLAdapterWidgetMgr> m_pAdapterWidgetMgr; |
89 CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. | 89 CFWL_WidgetMgrDelegate* m_pWidgetMgrDelegate; // not owned. |
90 | 90 |
91 // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former | 91 // |m_pFWLApp| has to be released first, then |m_pFWLTheme| since the former |
92 // may refers to theme manager and the latter refers to font manager. | 92 // may refers to theme manager and the latter refers to font manager. |
93 std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme; | 93 std::unique_ptr<CXFA_FWLTheme> m_pFWLTheme; |
94 std::unique_ptr<IFWL_App> m_pFWLApp; | 94 std::unique_ptr<IFWL_App> m_pFWLApp; |
95 }; | 95 }; |
96 | 96 |
97 #endif // XFA_FXFA_XFA_FFAPP_H_ | 97 #endif // XFA_FXFA_XFA_FFAPP_H_ |
OLD | NEW |