| 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 "../../../third_party/base/nonstd_unique_ptr.h" | 7 #include "../../../third_party/base/nonstd_unique_ptr.h" |
| 8 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 8 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
| 9 #include "../../include/javascript/IJavaScript.h" | 9 #include "../../include/javascript/IJavaScript.h" |
| 10 | 10 |
| 11 class CJS_ContextStub final : public IJS_Context { | 11 class CJS_ContextStub final : public IJS_Context { |
| 12 public: | 12 public: |
| 13 CJS_ContextStub() {} | 13 CJS_ContextStub() {} |
| 14 ~CJS_ContextStub() override {} | 14 ~CJS_ContextStub() override {} |
| 15 | 15 |
| 16 // IJS_Context: | 16 // IJS_Context: |
| 17 FX_BOOL RunScript(const CFX_WideString& script, | 17 FX_BOOL RunScript(const CFX_WideString& script, |
| 18 CFX_WideString& info) override { | 18 CFX_WideString* info) override { |
| 19 return FALSE; | 19 return FALSE; |
| 20 } | 20 } |
| 21 | 21 |
| 22 void OnApp_Init() override {} | 22 void OnApp_Init() override {} |
| 23 void OnDoc_Open(CPDFSDK_Document* pDoc, | 23 void OnDoc_Open(CPDFSDK_Document* pDoc, |
| 24 const CFX_WideString& strTargetName) override {} | 24 const CFX_WideString& strTargetName) override {} |
| 25 void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override {} | 25 void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override {} |
| 26 void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override {} | 26 void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override {} |
| 27 void OnDoc_WillSave(CPDFSDK_Document* pDoc) override {} | 27 void OnDoc_WillSave(CPDFSDK_Document* pDoc) override {} |
| 28 void OnDoc_DidSave(CPDFSDK_Document* pDoc) override {} | 28 void OnDoc_DidSave(CPDFSDK_Document* pDoc) override {} |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); } | 131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); } |
| 132 void ReleaseContext(IJS_Context* pContext) override {} | 132 void ReleaseContext(IJS_Context* pContext) override {} |
| 133 | 133 |
| 134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override { | 134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override { |
| 135 m_pDoc = pReaderDoc; | 135 m_pDoc = pReaderDoc; |
| 136 } | 136 } |
| 137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } | 137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; } |
| 138 | 138 |
| 139 int Execute(IJS_Context* cc, |
| 140 const wchar_t* script, |
| 141 CFX_WideString* info) override { |
| 142 return 0; |
| 143 } |
| 144 |
| 139 protected: | 145 protected: |
| 140 CPDFSDK_Document* m_pDoc; | 146 CPDFSDK_Document* m_pDoc; |
| 141 nonstd::unique_ptr<CJS_ContextStub> m_pContext; | 147 nonstd::unique_ptr<CJS_ContextStub> m_pContext; |
| 142 }; | 148 }; |
| 143 | 149 |
| 144 // static | 150 // static |
| 145 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { | 151 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) { |
| 146 } | 152 } |
| 147 | 153 |
| 148 // static | 154 // static |
| 149 IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { | 155 IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) { |
| 150 return new CJS_RuntimeStub; | 156 return new CJS_RuntimeStub; |
| 151 } | 157 } |
| OLD | NEW |