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

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

Issue 1921853006: More FWL interface cleanup. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
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_targetimp.h"
11 #include "xfa/fwl/core/fwl_threadimp.h"
12 #include "xfa/fwl/core/fwl_widgetmgrimp.h" 10 #include "xfa/fwl/core/fwl_widgetmgrimp.h"
13 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h" 11 #include "xfa/fwl/core/ifwl_adapterwidgetmgr.h"
14 #include "xfa/fwl/core/ifwl_app.h" 12 #include "xfa/fwl/core/ifwl_app.h"
15 #include "xfa/fwl/core/ifwl_widget.h" 13 #include "xfa/fwl/core/ifwl_widget.h"
16 14
17 IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) { 15 IFWL_App* IFWL_App::Create(IFWL_AdapterNative* pAdapter) {
18 IFWL_App* pApp = new IFWL_App; 16 IFWL_App* pApp = new IFWL_App;
19 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter)); 17 pApp->SetImpl(new CFWL_AppImp(pApp, pAdapter));
20 return pApp; 18 return pApp;
21 } 19 }
20
21 void IFWL_App::Release() {
22 delete m_pImpl;
Tom Sepez 2016/04/27 20:23:33 Can this be unique_ptr instread?
dsinclair 2016/04/27 20:58:55 Done.
23 }
24
22 FWL_ERR IFWL_App::Initialize() { 25 FWL_ERR IFWL_App::Initialize() {
23 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize(); 26 return static_cast<CFWL_AppImp*>(GetImpl())->Initialize();
24 } 27 }
28
25 FWL_ERR IFWL_App::Finalize() { 29 FWL_ERR IFWL_App::Finalize() {
26 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize(); 30 return static_cast<CFWL_AppImp*>(GetImpl())->Finalize();
27 } 31 }
32
28 IFWL_AdapterNative* IFWL_App::GetAdapterNative() { 33 IFWL_AdapterNative* IFWL_App::GetAdapterNative() {
29 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative(); 34 return static_cast<CFWL_AppImp*>(GetImpl())->GetAdapterNative();
30 } 35 }
36
31 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() { 37 IFWL_WidgetMgr* IFWL_App::GetWidgetMgr() {
32 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr(); 38 return static_cast<CFWL_AppImp*>(GetImpl())->GetWidgetMgr();
33 } 39 }
40
34 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() { 41 IFWL_ThemeProvider* IFWL_App::GetThemeProvider() {
35 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider(); 42 return static_cast<CFWL_AppImp*>(GetImpl())->GetThemeProvider();
36 } 43 }
44
37 FWL_ERR IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) { 45 FWL_ERR IFWL_App::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
38 return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider); 46 return static_cast<CFWL_AppImp*>(GetImpl())->SetThemeProvider(pThemeProvider);
39 } 47 }
48
40 FWL_ERR IFWL_App::Exit(int32_t iExitCode) { 49 FWL_ERR IFWL_App::Exit(int32_t iExitCode) {
41 return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode); 50 return static_cast<CFWL_AppImp*>(GetImpl())->Exit(iExitCode);
42 } 51 }
43 52
53 CFWL_NoteDriver* IFWL_App::GetNoteDriver() const {
54 return static_cast<CFWL_AppImp*>(GetImpl())->GetNoteDriver();
55 }
56
44 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter) 57 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter)
45 : CFWL_ThreadImp(pIface), 58 : m_pAdapterNative(pAdapter),
46 m_pAdapterNative(pAdapter), 59 m_pThemeProvider(nullptr),
47 m_pThemeProvider(nullptr) {} 60 m_pNoteDriver(new CFWL_NoteDriver),
61 m_pIface(pIface) {}
48 62
49 CFWL_AppImp::~CFWL_AppImp() { 63 CFWL_AppImp::~CFWL_AppImp() {
50 CFWL_ToolTipContainer::DeleteInstance(); 64 CFWL_ToolTipContainer::DeleteInstance();
65 delete m_pNoteDriver;
Tom Sepez 2016/04/27 20:23:33 can this too be unique_ptr ?
dsinclair 2016/04/27 20:58:55 Done.
51 } 66 }
52 67
53 FWL_ERR CFWL_AppImp::Initialize() { 68 FWL_ERR CFWL_AppImp::Initialize() {
54 if (!m_pWidgetMgr) { 69 if (!m_pWidgetMgr) {
55 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative)); 70 m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative));
56 } 71 }
57 return FWL_ERR_Succeeded; 72 return FWL_ERR_Succeeded;
58 } 73 }
59 FWL_ERR CFWL_AppImp::Finalize() { 74 FWL_ERR CFWL_AppImp::Finalize() {
60 m_pWidgetMgr.reset(); 75 m_pWidgetMgr.reset();
(...skipping 28 matching lines...) Expand all
89 return NULL; 104 return NULL;
90 return pApp->GetAdapterNative(); 105 return pApp->GetAdapterNative();
91 } 106 }
92 static IFWL_App* _theApp = NULL; 107 static IFWL_App* _theApp = NULL;
93 IFWL_App* FWL_GetApp() { 108 IFWL_App* FWL_GetApp() {
94 return _theApp; 109 return _theApp;
95 } 110 }
96 void FWL_SetApp(IFWL_App* pApp) { 111 void FWL_SetApp(IFWL_App* pApp) {
97 _theApp = pApp; 112 _theApp = pApp;
98 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698