Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: fpdfsdk/src/javascript/JS_Runtime_Stub.cpp

Issue 1393833006: Merge to XFA: Allow compiling PDFium without V8. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Rebase, fix build, stray include. Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | pdfium.gni » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 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 #include "../../../third_party/base/nonstd_unique_ptr.h"
8 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment.
9 #include "../../include/javascript/IJavaScript.h"
10
11 class CJS_ContextStub final : public IJS_Context {
12 public:
13 CJS_ContextStub() {}
14 ~CJS_ContextStub() override {}
15
16 // IJS_Context:
17 FX_BOOL RunScript(const CFX_WideString& script,
18 CFX_WideString& info) override {
19 return FALSE;
20 }
21
22 void OnApp_Init() override {}
23 void OnDoc_Open(CPDFSDK_Document* pDoc,
24 const CFX_WideString& strTargetName) override {}
25 void OnDoc_WillPrint(CPDFSDK_Document* pDoc) override {}
26 void OnDoc_DidPrint(CPDFSDK_Document* pDoc) override {}
27 void OnDoc_WillSave(CPDFSDK_Document* pDoc) override {}
28 void OnDoc_DidSave(CPDFSDK_Document* pDoc) override {}
29 void OnDoc_WillClose(CPDFSDK_Document* pDoc) override {}
30 void OnPage_Open(CPDFSDK_Document* pTarget) override {}
31 void OnPage_Close(CPDFSDK_Document* pTarget) override {}
32 void OnPage_InView(CPDFSDK_Document* pTarget) override {}
33 void OnPage_OutView(CPDFSDK_Document* pTarget) override {}
34 void OnField_MouseDown(FX_BOOL bModifier,
35 FX_BOOL bShift,
36 CPDF_FormField* pTarget) override {}
37 void OnField_MouseEnter(FX_BOOL bModifier,
38 FX_BOOL bShift,
39 CPDF_FormField* pTarget) override {}
40 void OnField_MouseExit(FX_BOOL bModifier,
41 FX_BOOL bShift,
42 CPDF_FormField* pTarget) override {}
43 void OnField_MouseUp(FX_BOOL bModifier,
44 FX_BOOL bShift,
45 CPDF_FormField* pTarget) override {}
46 void OnField_Focus(FX_BOOL bModifier,
47 FX_BOOL bShift,
48 CPDF_FormField* pTarget,
49 const CFX_WideString& Value) override {}
50 void OnField_Blur(FX_BOOL bModifier,
51 FX_BOOL bShift,
52 CPDF_FormField* pTarget,
53 const CFX_WideString& Value) override {}
54 void OnField_Calculate(CPDF_FormField* pSource,
55 CPDF_FormField* pTarget,
56 CFX_WideString& Value,
57 FX_BOOL& bRc) override {}
58 void OnField_Format(CPDF_FormField* pTarget,
59 CFX_WideString& Value,
60 FX_BOOL bWillCommit) override {}
61 void OnField_Keystroke(CFX_WideString& strChange,
62 const CFX_WideString& strChangeEx,
63 FX_BOOL KeyDown,
64 FX_BOOL bModifier,
65 int& nSelEnd,
66 int& nSelStart,
67 FX_BOOL bShift,
68 CPDF_FormField* pTarget,
69 CFX_WideString& Value,
70 FX_BOOL bWillCommit,
71 FX_BOOL bFieldFull,
72 FX_BOOL& bRc) override {}
73 void OnField_Validate(CFX_WideString& strChange,
74 const CFX_WideString& strChangeEx,
75 FX_BOOL bKeyDown,
76 FX_BOOL bModifier,
77 FX_BOOL bShift,
78 CPDF_FormField* pTarget,
79 CFX_WideString& Value,
80 FX_BOOL& bRc) override {}
81 void OnScreen_Focus(FX_BOOL bModifier,
82 FX_BOOL bShift,
83 CPDFSDK_Annot* pScreen) override {}
84 void OnScreen_Blur(FX_BOOL bModifier,
85 FX_BOOL bShift,
86 CPDFSDK_Annot* pScreen) override {}
87 void OnScreen_Open(FX_BOOL bModifier,
88 FX_BOOL bShift,
89 CPDFSDK_Annot* pScreen) override {}
90 void OnScreen_Close(FX_BOOL bModifier,
91 FX_BOOL bShift,
92 CPDFSDK_Annot* pScreen) override {}
93 void OnScreen_MouseDown(FX_BOOL bModifier,
94 FX_BOOL bShift,
95 CPDFSDK_Annot* pScreen) override {}
96 void OnScreen_MouseUp(FX_BOOL bModifier,
97 FX_BOOL bShift,
98 CPDFSDK_Annot* pScreen) override {}
99 void OnScreen_MouseEnter(FX_BOOL bModifier,
100 FX_BOOL bShift,
101 CPDFSDK_Annot* pScreen) override {}
102 void OnScreen_MouseExit(FX_BOOL bModifier,
103 FX_BOOL bShift,
104 CPDFSDK_Annot* pScreen) override {}
105 void OnScreen_InView(FX_BOOL bModifier,
106 FX_BOOL bShift,
107 CPDFSDK_Annot* pScreen) override {}
108 void OnScreen_OutView(FX_BOOL bModifier,
109 FX_BOOL bShift,
110 CPDFSDK_Annot* pScreen) override {}
111 void OnBookmark_MouseUp(CPDF_Bookmark* pBookMark) override {}
112 void OnLink_MouseUp(CPDFSDK_Document* pTarget) override {}
113 void OnMenu_Exec(CPDFSDK_Document* pTarget, const CFX_WideString&) override {}
114 void OnBatchExec(CPDFSDK_Document* pTarget) override {}
115 void OnConsole_Exec() override {}
116 void OnExternal_Exec() override {}
117 void EnableMessageBox(FX_BOOL bEnable) override {}
118 };
119
120 class CJS_RuntimeStub final : public IJS_Runtime {
121 public:
122 CJS_RuntimeStub() : m_pDoc(nullptr) {}
123 ~CJS_RuntimeStub() override {}
124
125 IJS_Context* NewContext() override {
126 if (!m_pContext)
127 m_pContext.reset(new CJS_ContextStub());
128 return GetCurrentContext();
129 }
130
131 IJS_Context* GetCurrentContext() override { return m_pContext.get(); }
132 void ReleaseContext(IJS_Context* pContext) override {}
133
134 void SetReaderDocument(CPDFSDK_Document* pReaderDoc) override {
135 m_pDoc = pReaderDoc;
136 }
137 CPDFSDK_Document* GetReaderDocument() override { return m_pDoc; }
138
139 virtual FX_BOOL GetHValueByName(const CFX_ByteStringC&,
140 FXJSE_HVALUE) override {
141 return FALSE;
142 }
143
144 virtual FX_BOOL SetHValueByName(const CFX_ByteStringC&,
145 FXJSE_HVALUE) override {
146 return FALSE;
147 }
148
149 protected:
150 CPDFSDK_Document* m_pDoc;
151 nonstd::unique_ptr<CJS_ContextStub> m_pContext;
152 };
153
154 // static
155 void IJS_Runtime::Initialize(unsigned int slot, void* isolate) {
156 }
157
158 // static
159 IJS_Runtime* IJS_Runtime::Create(CPDFDoc_Environment* pEnv) {
160 return new CJS_RuntimeStub;
161 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/javascript/JS_Runtime.cpp ('k') | pdfium.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698