1 // Copyright 2018 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef FXJS_CJS_RUNTIMESTUB_H_ 8 #define FXJS_CJS_RUNTIMESTUB_H_ 9 10 #include <memory> 11 12 #include "core/fxcrt/fx_string.h" 13 #include "core/fxcrt/unowned_ptr.h" 14 #include "fxjs/ijs_runtime.h" 15 16 class CPDFSDK_FormFillEnvironment; 17 class IJS_EventContext; 18 19 class CJS_RuntimeStub final : public IJS_Runtime { 20 public: 21 explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv); 22 ~CJS_RuntimeStub() override; 23 24 // IJS_Runtime: 25 CJS_Runtime* AsCJSRuntime() override; 26 IJS_EventContext* NewEventContext() override; 27 void ReleaseEventContext(IJS_EventContext* pContext) override; 28 CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override; 29 30 Optional<IJS_Runtime::JS_Error> ExecuteScript( 31 const WideString& script) override; 32 33 private: 34 UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; 35 std::unique_ptr<IJS_EventContext> m_pContext; 36 }; 37 38 #endif // FXJS_CJS_RUNTIMESTUB_H_ 39