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 #include "xfa/fxfa/include/xfa_ffapp.h" | 7 #include "xfa/fxfa/include/xfa_ffapp.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 | 110 |
| 111 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { | 111 CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { |
| 112 if (!m_pDocHandler) { | 112 if (!m_pDocHandler) { |
| 113 m_pDocHandler = new CXFA_FFDocHandler; | 113 m_pDocHandler = new CXFA_FFDocHandler; |
| 114 } | 114 } |
| 115 return m_pDocHandler; | 115 return m_pDocHandler; |
| 116 } | 116 } |
| 117 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, | 117 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, |
| 118 IFX_FileRead* pStream, | 118 IFX_FileRead* pStream, |
| 119 FX_BOOL bTakeOverFile) { | 119 FX_BOOL bTakeOverFile) { |
| 120 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); | 120 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); |
|
Lei Zhang
2016/06/23 18:21:44
unique_ptr here and below?
dsinclair
2016/06/23 18:46:53
Done.
| |
| 121 FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); | 121 FX_BOOL bSuccess = pDoc->OpenDoc(pStream, bTakeOverFile); |
| 122 if (!bSuccess) { | 122 if (!bSuccess) { |
| 123 delete pDoc; | 123 delete pDoc; |
| 124 pDoc = NULL; | 124 pDoc = nullptr; |
| 125 } | 125 } |
| 126 return pDoc; | 126 return pDoc; |
| 127 } | 127 } |
| 128 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, | 128 CXFA_FFDoc* CXFA_FFApp::CreateDoc(IXFA_DocProvider* pProvider, |
| 129 CPDF_Document* pPDFDoc) { | 129 CPDF_Document* pPDFDoc) { |
| 130 if (pPDFDoc == NULL) { | 130 if (!pPDFDoc) { |
| 131 return NULL; | 131 return nullptr; |
| 132 } | 132 } |
| 133 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); | 133 CXFA_FFDoc* pDoc = new CXFA_FFDoc(this, pProvider); |
| 134 FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc); | 134 FX_BOOL bSuccess = pDoc->OpenDoc(pPDFDoc); |
| 135 if (!bSuccess) { | 135 if (!bSuccess) { |
| 136 delete pDoc; | 136 delete pDoc; |
| 137 pDoc = NULL; | 137 pDoc = nullptr; |
| 138 } | 138 } |
| 139 return pDoc; | 139 return pDoc; |
| 140 } | 140 } |
| 141 | 141 |
| 142 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { | 142 void CXFA_FFApp::SetDefaultFontMgr(std::unique_ptr<CXFA_DefFontMgr> pFontMgr) { |
| 143 if (!m_pFontMgr) | 143 if (!m_pFontMgr) |
| 144 m_pFontMgr = new CXFA_FontMgr(); | 144 m_pFontMgr = new CXFA_FontMgr(); |
| 145 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr)); | 145 m_pFontMgr->SetDefFontMgr(std::move(pFontMgr)); |
| 146 } | 146 } |
| 147 | 147 |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 172 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr; | 172 m_pAdapterWidgetMgr = new CXFA_FWLAdapterWidgetMgr; |
| 173 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | | 173 pDelegate->OnSetCapability(FWL_WGTMGR_DisableThread | |
| 174 FWL_WGTMGR_DisableForm); | 174 FWL_WGTMGR_DisableForm); |
| 175 m_pWidgetMgrDelegate = pDelegate; | 175 m_pWidgetMgrDelegate = pDelegate; |
| 176 } | 176 } |
| 177 return m_pAdapterWidgetMgr; | 177 return m_pAdapterWidgetMgr; |
| 178 } | 178 } |
| 179 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() { | 179 IFWL_AdapterTimerMgr* CXFA_FFApp::GetTimerMgr() { |
| 180 return m_pProvider->GetTimerMgr(); | 180 return m_pProvider->GetTimerMgr(); |
| 181 } | 181 } |
| OLD | NEW |