diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-06 18:18:31 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-06 18:18:31 +0000 |
commit | 52f011adbf4216e3507ccd5be6753762e0ff7b64 (patch) | |
tree | b6a72c452af94f781f52ffdd530062adff705d91 | |
parent | 472bb7f919736ae58461f653597eb6854119cca9 (diff) | |
download | pdfium-52f011adbf4216e3507ccd5be6753762e0ff7b64.tar.xz |
Remove CXFA_FFDocHandler
None of the methods on this class are ever called. We check it once
to make sure it exists, but the call to get it will create it so
it will always exist.
Change-Id: I5b53567c4835f4bb4fe52c42baf28d4290ea517f
Reviewed-on: https://pdfium-review.googlesource.com/17852
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_context.cpp | 6 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffapp.cpp | 7 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffapp.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdochandler.cpp | 61 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_ffdochandler.h | 29 |
6 files changed, 0 insertions, 108 deletions
@@ -1687,8 +1687,6 @@ if (pdf_enable_xfa) { "xfa/fxfa/cxfa_ffdatetimeedit.h", "xfa/fxfa/cxfa_ffdoc.cpp", "xfa/fxfa/cxfa_ffdoc.h", - "xfa/fxfa/cxfa_ffdochandler.cpp", - "xfa/fxfa/cxfa_ffdochandler.h", "xfa/fxfa/cxfa_ffdocview.cpp", "xfa/fxfa/cxfa_ffdocview.h", "xfa/fxfa/cxfa_ffdraw.cpp", diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp index 6496042e7d..4b67d0cf3f 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_context.cpp @@ -101,12 +101,6 @@ bool CPDFXFA_Context::LoadXFADoc() { return false; } - CXFA_FFDocHandler* pDocHandler = pApp->GetDocHandler(); - if (!pDocHandler) { - SetLastError(FPDF_ERR_XFALOAD); - return false; - } - m_pXFADoc->StartLoad(); int iStatus = m_pXFADoc->DoLoad(); if (iStatus != XFA_PARSESTATUS_Done) { diff --git a/xfa/fxfa/cxfa_ffapp.cpp b/xfa/fxfa/cxfa_ffapp.cpp index e3ca42c129..4cb9deb466 100644 --- a/xfa/fxfa/cxfa_ffapp.cpp +++ b/xfa/fxfa/cxfa_ffapp.cpp @@ -17,7 +17,6 @@ #include "xfa/fwl/cfwl_notedriver.h" #include "xfa/fwl/cfwl_widgetmgr.h" #include "xfa/fxfa/cxfa_ffdoc.h" -#include "xfa/fxfa/cxfa_ffdochandler.h" #include "xfa/fxfa/cxfa_ffwidgethandler.h" #include "xfa/fxfa/cxfa_fontmgr.h" #include "xfa/fxfa/cxfa_fwladapterwidgetmgr.h" @@ -30,12 +29,6 @@ CXFA_FFApp::CXFA_FFApp(IXFA_AppProvider* pProvider) : m_pProvider(pProvider) { CXFA_FFApp::~CXFA_FFApp() {} -CXFA_FFDocHandler* CXFA_FFApp::GetDocHandler() { - if (!m_pDocHandler) - m_pDocHandler = pdfium::MakeUnique<CXFA_FFDocHandler>(); - return m_pDocHandler.get(); -} - std::unique_ptr<CXFA_FFDoc> CXFA_FFApp::CreateDoc( IXFA_DocEnvironment* pDocEnvironment, CPDF_Document* pPDFDoc) { diff --git a/xfa/fxfa/cxfa_ffapp.h b/xfa/fxfa/cxfa_ffapp.h index 2ce718a36a..f4bd9eb7a8 100644 --- a/xfa/fxfa/cxfa_ffapp.h +++ b/xfa/fxfa/cxfa_ffapp.h @@ -35,8 +35,6 @@ class CXFA_FFApp { CPDF_Document* pPDFDoc); void SetDefaultFontMgr(std::unique_ptr<CFGAS_DefaultFontManager> pFontMgr); - CXFA_FFDocHandler* GetDocHandler(); - CXFA_FWLAdapterWidgetMgr* GetFWLAdapterWidgetMgr(); CFWL_WidgetMgr* GetFWLWidgetMgr() const { return m_pFWLApp->GetWidgetMgr(); } @@ -51,7 +49,6 @@ class CXFA_FFApp { void ClearEventTargets(); private: - std::unique_ptr<CXFA_FFDocHandler> m_pDocHandler; UnownedPtr<IXFA_AppProvider> const m_pProvider; // The fonts stored in the font manager may have been created by the default diff --git a/xfa/fxfa/cxfa_ffdochandler.cpp b/xfa/fxfa/cxfa_ffdochandler.cpp deleted file mode 100644 index 86e493084b..0000000000 --- a/xfa/fxfa/cxfa_ffdochandler.cpp +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "xfa/fxfa/cxfa_ffdochandler.h" - -#include "core/fxcrt/cfx_checksumcontext.h" -#include "fxjs/cfxjse_engine.h" -#include "xfa/fxfa/cxfa_ffdoc.h" -#include "xfa/fxfa/parser/cxfa_node.h" -#include "xfa/fxfa/parser/xfa_resolvenode_rs.h" - -CXFA_FFDocHandler::CXFA_FFDocHandler() {} - -CXFA_FFDocHandler::~CXFA_FFDocHandler() {} - -CFXJSE_Value* CXFA_FFDocHandler::GetXFAScriptObject(CXFA_FFDoc* hDoc) { - CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) - return nullptr; - - CFXJSE_Engine* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) - return nullptr; - return pScriptContext->GetJSValueFromMap(pXFADoc->GetRoot()); -} - -XFA_ATTRIBUTEENUM CXFA_FFDocHandler::GetRestoreState(CXFA_FFDoc* hDoc) { - CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) - return XFA_ATTRIBUTEENUM_Unknown; - - CXFA_Node* pForm = ToNode(pXFADoc->GetXFAObject(XFA_HASHCODE_Form)); - if (!pForm) - return XFA_ATTRIBUTEENUM_Unknown; - - CXFA_Node* pSubForm = pForm->GetFirstChildByClass(XFA_Element::Subform); - if (!pSubForm) - return XFA_ATTRIBUTEENUM_Unknown; - return pSubForm->JSNode()->GetEnum(XFA_ATTRIBUTE_RestoreState); -} - -bool CXFA_FFDocHandler::RunDocScript(CXFA_FFDoc* hDoc, - XFA_SCRIPTTYPE eScriptType, - const WideStringView& wsScript, - CFXJSE_Value* pRetValue, - CFXJSE_Value* pThisValue) { - CXFA_Document* pXFADoc = hDoc->GetXFADoc(); - if (!pXFADoc) - return false; - - CFXJSE_Engine* pScriptContext = pXFADoc->GetScriptContext(); - if (!pScriptContext) - return false; - - return pScriptContext->RunScript( - (XFA_SCRIPTLANGTYPE)eScriptType, wsScript, pRetValue, - pThisValue ? CFXJSE_Engine::ToObject(pThisValue, nullptr) : nullptr); -} diff --git a/xfa/fxfa/cxfa_ffdochandler.h b/xfa/fxfa/cxfa_ffdochandler.h deleted file mode 100644 index 7da03b0148..0000000000 --- a/xfa/fxfa/cxfa_ffdochandler.h +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FXFA_CXFA_FFDOCHANDLER_H_ -#define XFA_FXFA_CXFA_FFDOCHANDLER_H_ - -#include "xfa/fxfa/fxfa.h" - -class CFX_ChecksumContext; - -class CXFA_FFDocHandler { - public: - CXFA_FFDocHandler(); - ~CXFA_FFDocHandler(); - - CFXJSE_Value* GetXFAScriptObject(CXFA_FFDoc* hDoc); - XFA_ATTRIBUTEENUM GetRestoreState(CXFA_FFDoc* hDoc); - - bool RunDocScript(CXFA_FFDoc* hDoc, - XFA_SCRIPTTYPE eScriptType, - const WideStringView& wsScript, - CFXJSE_Value* pRetValue, - CFXJSE_Value* pThisObject); -}; - -#endif // XFA_FXFA_CXFA_FFDOCHANDLER_H_ |