blob: e1b96a40dbf0d6bce2ceb4e077973aad378422da [file] [log] [blame]
K. Moon832a6942022-10-31 20:11:31 +00001// Copyright 2018 The PDFium Authors
Tom Sepeza1fe7322018-04-18 22:48:22 +00002// 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
Tom Sepeza1fe7322018-04-18 22:48:22 +000012#include "core/fxcrt/unowned_ptr.h"
Tom Sepez1e151c62021-11-22 23:46:09 +000013#include "core/fxcrt/widestring.h"
Tom Sepeza1fe7322018-04-18 22:48:22 +000014#include "fxjs/ijs_runtime.h"
15
16class CPDFSDK_FormFillEnvironment;
17class IJS_EventContext;
18
19class CJS_RuntimeStub final : public IJS_Runtime {
20 public:
21 explicit CJS_RuntimeStub(CPDFSDK_FormFillEnvironment* pFormFillEnv);
22 ~CJS_RuntimeStub() override;
23
Tom Sepez2dd06eb2018-10-29 21:16:42 +000024 // IJS_Runtime:
Tom Sepezfe8d4e32019-08-15 20:15:08 +000025 CJS_Runtime* AsCJSRuntime() override;
Tom Sepeza1fe7322018-04-18 22:48:22 +000026 IJS_EventContext* NewEventContext() override;
27 void ReleaseEventContext(IJS_EventContext* pContext) override;
28 CPDFSDK_FormFillEnvironment* GetFormFillEnv() const override;
29
Lei Zhang24c6be62024-02-08 20:06:48 +000030 std::optional<IJS_Runtime::JS_Error> ExecuteScript(
Dan Sinclairdc5d88b2018-05-17 13:53:52 +000031 const WideString& script) override;
Tom Sepeza1fe7322018-04-18 22:48:22 +000032
Tom Sepezcb798252018-09-17 18:25:32 +000033 private:
Tom Sepeza1fe7322018-04-18 22:48:22 +000034 UnownedPtr<CPDFSDK_FormFillEnvironment> const m_pFormFillEnv;
35 std::unique_ptr<IJS_EventContext> m_pContext;
36};
37
38#endif // FXJS_CJS_RUNTIMESTUB_H_