diff options
Diffstat (limited to 'fxjs/cjs_runtimestub.cpp')
-rw-r--r-- | fxjs/cjs_runtimestub.cpp | 70 |
1 files changed, 25 insertions, 45 deletions
diff --git a/fxjs/cjs_runtimestub.cpp b/fxjs/cjs_runtimestub.cpp index 105bb6f114..98c7679a04 100644 --- a/fxjs/cjs_runtimestub.cpp +++ b/fxjs/cjs_runtimestub.cpp @@ -4,60 +4,40 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com -#include <memory> +#include "fxjs/cjs_runtimestub.h" -#include "core/fxcrt/unowned_ptr.h" #include "fxjs/cjs_event_context_stub.h" -#include "fxjs/ijs_runtime.h" #include "third_party/base/ptr_util.h" -class CJS_RuntimeStub final : public IJS_Runtime { - public: - explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv) - : m_pFormFillEnv(pFormFillEnv) {} - ~CJS_RuntimeStub() override {} +CJS_RuntimeStub::CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv) + : m_pFormFillEnv(pFormFillEnv) {} - IJS_EventContext* NewEventContext() override { - if (!m_pContext) - m_pContext = pdfium::MakeUnique<CJS_EventContextStub>(); - return m_pContext.get(); - } +CJS_RuntimeStub::~CJS_RuntimeStub() = default; - void ReleaseEventContext(IJS_EventContext* pContext) override {} - - CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override { - return m_pFormFillEnv.Get(); - } - -#ifdef PDF_ENABLE_XFA - bool GetValueByNameFromGlobalObject(const ByteStringView&, - CFXJSE_Value*) override { - return false; - } - - bool SetValueByNameInGlobalObject(const ByteStringView&, - CFXJSE_Value*) override { - return false; - } -#endif // PDF_ENABLE_XFA +IJS_EventContext* CJS_RuntimeStub::NewEventContext() { + if (!m_pContext) + m_pContext = pdfium::MakeUnique<CJS_EventContextStub>(); + return m_pContext.get(); +} - int ExecuteScript(const WideString& script, WideString* info) override { - return 0; - } +void CJS_RuntimeStub::ReleaseEventContext(IJS_EventContext* pContext) {} - protected: - UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; - std::unique_ptr<CJS_EventContextStub> m_pContext; -}; +CPDFSDK_FormFillEnvironment* CJS_RuntimeStub::GetFormFillEnv() const { + return m_pFormFillEnv.Get(); +} -// static -void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {} +#ifdef PDF_ENABLE_XFA +bool CJS_RuntimeStub::GetValueByNameFromGlobalObject(const ByteStringView&, + CFXJSE_Value*) { + return false; +} -// static -void IJS_Runtime::Destroy() {} +bool CJS_RuntimeStub::SetValueByNameInGlobalObject(const ByteStringView&, + CFXJSE_Value*) { + return false; +} +#endif // PDF_ENABLE_XFA -// static -std::unique_ptr<IJS_Runtime> IJS_Runtime::Create( - CPDFSDK_FormFillEnvironment* pFormFillEnv) { - return pdfium::MakeUnique<CJS_RuntimeStub>(pFormFillEnv); +int CJS_RuntimeStub::ExecuteScript(const WideString& script, WideString* info) { + return 0; } |