Chromium Code Reviews| 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_FWL_CORE_IFWL_APP_H_ | 7 #ifndef XFA_FWL_CORE_IFWL_APP_H_ |
| 8 #define XFA_FWL_CORE_IFWL_APP_H_ | 8 #define XFA_FWL_CORE_IFWL_APP_H_ |
| 9 | 9 |
| 10 // The FWL thread/app code contains three parallel classes, which reference each | |
| 11 // other via pointers as follows: | |
| 12 // | |
| 13 // m_pIface m_pImpl | |
| 14 // CXFA_FFApp ------------> IFWL_App -----------> CFWL_AppImp | |
| 15 // <----------- | |
| 16 // m_pIface | |
| 17 | |
| 18 #include <memory> | |
| 19 | |
| 10 #include "core/fxcrt/include/fx_string.h" | 20 #include "core/fxcrt/include/fx_string.h" |
| 11 #include "xfa/fwl/core/ifwl_thread.h" | 21 #include "xfa/fwl/core/fwl_appimp.h" |
| 22 #include "xfa/fwl/core/fwl_error.h" | |
| 12 | 23 |
| 24 class CFWL_NoteDriver; | |
| 13 class IFWL_AdapterNative; | 25 class IFWL_AdapterNative; |
| 26 class IFWL_AdapterWidgetMgr; | |
| 27 class IFWL_ThemeProvider; | |
| 14 class IFWL_Widget; | 28 class IFWL_Widget; |
| 15 class IFWL_WidgetMgr; | 29 class IFWL_WidgetMgr; |
| 16 class IFWL_ThemeProvider; | |
| 17 class IFWL_AdapterWidgetMgr; | |
| 18 | 30 |
| 19 class IFWL_App : public IFWL_Thread { | 31 class IFWL_App { |
| 20 public: | 32 public: |
| 21 static IFWL_App* Create(IFWL_AdapterNative* pAdapter); | 33 static IFWL_App* Create(IFWL_AdapterNative* pAdapter); |
| 22 | 34 |
| 35 virtual ~IFWL_App() {} | |
| 36 | |
| 23 FWL_ERR Initialize(); | 37 FWL_ERR Initialize(); |
| 24 FWL_ERR Finalize(); | 38 FWL_ERR Finalize(); |
| 25 IFWL_AdapterNative* GetAdapterNative(); | 39 IFWL_AdapterNative* GetAdapterNative(); |
| 26 IFWL_WidgetMgr* GetWidgetMgr(); | 40 IFWL_WidgetMgr* GetWidgetMgr(); |
| 27 IFWL_ThemeProvider* GetThemeProvider(); | 41 IFWL_ThemeProvider* GetThemeProvider(); |
| 28 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); | 42 FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider); |
| 29 FWL_ERR Exit(int32_t iExitCode); | 43 FWL_ERR Exit(int32_t iExitCode); |
| 30 | 44 |
| 45 // These call into polymorphic methods in the impl; no need to override. | |
| 46 void Release(); | |
| 47 | |
| 48 CFWL_AppImp* GetImpl() const { return m_pImpl.get(); } | |
| 49 void SetImpl(CFWL_AppImp* pImpl) { m_pImpl.reset(pImpl); } | |
|
Tom Sepez
2016/04/28 16:59:29
nit: comment // Takes ownership of |pImpl|.
dsinclair
2016/04/28 18:00:59
Done.
| |
| 50 | |
| 51 CFWL_NoteDriver* GetNoteDriver() const; | |
| 52 | |
| 31 private: | 53 private: |
| 32 IFWL_App() {} | 54 IFWL_App() {} |
| 55 | |
| 56 std::unique_ptr<CFWL_AppImp> m_pImpl; | |
| 33 }; | 57 }; |
| 34 | 58 |
| 35 IFWL_App* FWL_GetApp(); | 59 IFWL_App* FWL_GetApp(); |
| 36 void FWL_SetApp(IFWL_App* pApp); | 60 void FWL_SetApp(IFWL_App* pApp); |
| 37 | 61 |
| 38 IFWL_AdapterNative* FWL_GetAdapterNative(); | 62 IFWL_AdapterNative* FWL_GetAdapterNative(); |
| 39 IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr(); | 63 IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr(); |
| 40 | 64 |
| 41 #endif // XFA_FWL_CORE_IFWL_APP_H_ | 65 #endif // XFA_FWL_CORE_IFWL_APP_H_ |
| OLD | NEW |