| OLD | NEW |
| 1 // Copyright 2015 PDFium Authors. All rights reserved. | 1 // Copyright 2015 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <memory> |
| 8 |
| 7 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. | 9 #include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment. |
| 8 #include "fpdfsdk/include/javascript/IJavaScript.h" | 10 #include "fpdfsdk/include/javascript/IJavaScript.h" |
| 9 #include "third_party/base/nonstd_unique_ptr.h" | |
| 10 | 11 |
| 11 class CJS_ContextStub final : public IJS_Context { | 12 class CJS_ContextStub final : public IJS_Context { |
| 12 public: | 13 public: |
| 13 CJS_ContextStub() {} | 14 CJS_ContextStub() {} |
| 14 ~CJS_ContextStub() override {} | 15 ~CJS_ContextStub() override {} |
| 15 | 16 |
| 16 // IJS_Context: | 17 // IJS_Context: |
| 17 FX_BOOL RunScript(const CFX_WideString& script, | 18 FX_BOOL RunScript(const CFX_WideString& script, |
| 18 CFX_WideString* info) override { | 19 CFX_WideString* info) override { |
| 19 return FALSE; | 20 return FALSE; |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } | 138 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } |
| 138 | 139 |
| 139 int Execute(IJS_Context* cc, | 140 int Execute(IJS_Context* cc, |
| 140 const wchar_t* script, | 141 const wchar_t* script, |
| 141 CFX_WideString* info) override { | 142 CFX_WideString* info) override { |
| 142 return 0; | 143 return 0; |
| 143 } | 144 } |
| 144 | 145 |
| 145 protected: | 146 protected: |
| 146 CPDFSDK_Document* m_pDoc; | 147 CPDFSDK_Document* m_pDoc; |
| 147 nonstd::unique_ptr<CJS_ContextStub> m_pContext; | 148 std::unique_ptr<CJS_ContextStub> m_pContext; |
| 148 }; | 149 }; |
| 149 | 150 |
| 150 // static | 151 // static |
| 151 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { | 152 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { |
| 152 } | 153 } |
| 153 | 154 |
| 154 // static | 155 // static |
| 155 IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { | 156 IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { |
| 156 return new CJS_RuntimeStub; | 157 return new CJS_RuntimeStub; |
| 157 } | 158 } |
| OLD | NEW |