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

Side by Side Diff: xfa/fwl/core/fwl_appimp.cpp

Issue 1928963004: Cleanup IFWL_Adapter interfaces. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase to master Created 4 years, 7 months 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 | « xfa/fwl/core/fwl_appimp.h ('k') | xfa/fwl/core/fwl_formimp.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 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 #include "xfa/fwl/core/fwl_appimp.h" 7 #include "xfa/fwl/core/fwl_appimp.h"
8 8
9 #include "xfa/fwl/core/fwl_noteimp.h" 9 #include "xfa/fwl/core/fwl_noteimp.h"
10 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 10 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
11 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
12 #include "xfa/fwl/core/ifwl_app.h" 11 #include "xfa/fwl/core/ifwl_app.h"
13 #include "xfa/fwl/core/ifwl_widget.h" 12 #include "xfa/fwl/core/ifwl_widget.h"
13 #include "xfa/fxfa/app/xfa_fwladapter.h"
14 14
15 IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) { 15 IFWL_App* IFWL_App::Create(CXFA_FFApp* pAdapter) {
16 IFWL_App* pApp = new IFWL_App; 16 IFWL_App* pApp = new IFWL_App;
17 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter)); 17 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter));
18 return pApp; 18 return pApp;
19 } 19 }
20 20
21 void IFWL_App::Release() {} 21 void IFWL_App::Release() {}
22 22
23 FWL_ERR IFWL_App::Initialize() { 23 FWL_ERR IFWL_App::Initialize() {
24 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); 24 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize();
25 } 25 }
26 26
27 FWL_ERR IFWL_App::Finalize() { 27 FWL_ERR IFWL_App::Finalize() {
28 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); 28 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize();
29 } 29 }
30 30
31 IFWL_AdapterNative* IFWL_App::GetAdapterNative() { 31 CXFA_FFApp* IFWL_App::GetAdapterNative() {
32 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative(); 32 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative();
33 } 33 }
34 34
35 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() { 35 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() {
36 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr(); 36 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr();
37 } 37 }
38 38
39 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() { 39 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() {
40 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider(); 40 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider();
41 } 41 }
42 42
43 FWL_ERR IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { 43 void IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
44 return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider); 44 static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider);
45 } 45 }
46 46
47 FWL_ERR IFWL_App::Exit(int32_t iExitCode) { 47 void IFWL_App::Exit(int32_t iExitCode) {
48 return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode); 48 static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode);
49 } 49 }
50 50
51 CFWL_NoteDriver* IFWL_App::GetNoteDriver() const { 51 CFWL_NoteDriver* IFWL_App::GetNoteDriver() const {
52 return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver(); 52 return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver();
53 } 53 }
54 54
55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter) 55 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, CXFA_FFApp* pAdapter)
56 : m_pAdapterNative(pAdapter), 56 : m_pAdapterNative(pAdapter),
57 m_pThemeProvider(nullptr), 57 m_pThemeProvider(nullptr),
58 m_pNoteDriver(new CFWL_NoteDriver), 58 m_pNoteDriver(new CFWL_NoteDriver),
59 m_pIface(pIface) {} 59 m_pIface(pIface) {}
60 60
61 CFWL_AppImp::~CFWL_AppImp() { 61 CFWL_AppImp::~CFWL_AppImp() {
62 CFWL_ToolTipContainer::DeleteInstance(); 62 CFWL_ToolTipContainer::DeleteInstance();
63 } 63 }
64 64
65 FWL_ERR CFWL_AppImp::Initialize() { 65 FWL_ERR CFWL_AppImp::Initialize() {
66 if (!m_pWidgetMgr) { 66 if (!m_pWidgetMgr) {
67 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); 67 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative));
68 } 68 }
69 return FWL_ERR_Succeeded; 69 return FWL_ERR_Succeeded;
70 } 70 }
71 FWL_ERR CFWL_AppImp::Finalize() { 71 FWL_ERR CFWL_AppImp::Finalize() {
72 m_pWidgetMgr.reset(); 72 m_pWidgetMgr.reset();
73 return FWL_ERR_Succeeded; 73 return FWL_ERR_Succeeded;
74 } 74 }
75 IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const { 75 CXFA_FFApp* CFWL_AppImp::GetAdapterNative() const {
76 return m_pAdapterNative; 76 return m_pAdapterNative;
77 } 77 }
78 IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() { 78 CXFA_FWLAdapterWidgetMgr* FWL_GetAdapterWidgetMgr() {
79 return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr()) 79 return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr())
80 ->GetAdapterWidgetMgr(); 80 ->GetAdapterWidgetMgr();
81 } 81 }
82 IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const { 82 IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const {
83 return m_pWidgetMgr.get(); 83 return m_pWidgetMgr.get();
84 } 84 }
85 FWL_ERR CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { 85 void CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
86 m_pThemeProvider = pThemeProvider; 86 m_pThemeProvider = pThemeProvider;
87 return FWL_ERR_Succeeded;
88 } 87 }
89 FWL_ERR CFWL_AppImp::Exit(int32_t iExitCode) { 88
89 void CFWL_AppImp::Exit(int32_t iExitCode) {
90 while (m_pNoteDriver->PopNoteLoop()) { 90 while (m_pNoteDriver->PopNoteLoop()) {
91 continue; 91 continue;
92 } 92 }
93 return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0);
94 } 93 }
94
95 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const { 95 IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const {
96 return m_pThemeProvider; 96 return m_pThemeProvider;
97 } 97 }
98 IFWL_AdapterNative* FWL_GetAdapterNative() { 98
99 CXFA_FFApp* FWL_GetAdapterNative() {
99 IFWL_App* pApp = FWL_GetApp(); 100 IFWL_App* pApp = FWL_GetApp();
100 if (!pApp) 101 if (!pApp)
101 return NULL; 102 return NULL;
102 return pApp->GetAdapterNative(); 103 return pApp->GetAdapterNative();
103 } 104 }
104 static IFWL_App* _theApp = NULL; 105
106 static IFWL_App* g_theApp = nullptr;
105 IFWL_App* FWL_GetApp() { 107 IFWL_App* FWL_GetApp() {
106 return _theApp; 108 return g_theApp;
107 } 109 }
110
108 void FWL_SetApp(IFWL_App* pApp) { 111 void FWL_SetApp(IFWL_App* pApp) {
109 _theApp = pApp; 112 g_theApp = pApp;
110 } 113 }
OLDNEW
« no previous file with comments | « xfa/fwl/core/fwl_appimp.h ('k') | xfa/fwl/core/fwl_formimp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698