Tom Sepez | a1fe732 | 2018-04-18 22:48:22 +0000 | [diff] [blame] | 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 | |
Tom Sepez | 2dd06eb | 2018-10-29 21:16:42 +0000 | [diff] [blame] | 24 | // IJS_Runtime: |
Tom Sepez | fe8d4e3 | 2019-08-15 20:15:08 +0000 | [diff] [blame] | 25 | CJS_Runtime* AsCJSRuntime() override; |
Tom Sepez | a1fe732 | 2018-04-18 22:48:22 +0000 | [diff] [blame] | 26 | IJS_EventContext* NewEventContext() override; |
| 27 | void ReleaseEventContext(IJS_EventContext* pContext) override; |
| 28 | CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override; |
| 29 | |
Dan Sinclair | dc5d88b | 2018-05-17 13:53:52 +0000 | [diff] [blame] | 30 | Optional<IJS_Runtime::JS_Error> ExecuteScript( |
| 31 | const WideString& script) override; |
Tom Sepez | a1fe732 | 2018-04-18 22:48:22 +0000 | [diff] [blame] | 32 | |
Tom Sepez | cb79825 | 2018-09-17 18:25:32 +0000 | [diff] [blame] | 33 | private: |
Tom Sepez | a1fe732 | 2018-04-18 22:48:22 +0000 | [diff] [blame] | 34 | UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv; |
| 35 | std::unique_ptr<IJS_EventContext> m_pContext; |
| 36 | }; |
| 37 | |
| 38 | #endif // FXJS_CJS_RUNTIMESTUB_H_ |