blob: 2b5e71349dd9195e0d249b8406f0e8174e5f6268 [file] [log] [blame]
Tom Sepeza1fe7322018-04-18 22:48:22 +00001// 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
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
Dan Sinclairdc5d88b2018-05-17 13:53:52 +000030 Optional<IJS_Runtime::JS_Error> ExecuteScript(
31 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_