OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef FPDFSDK_JAVASCRIPT_APP_H_ | 7 #ifndef FPDFSDK_JAVASCRIPT_APP_H_ |
8 #define FPDFSDK_JAVASCRIPT_APP_H_ | 8 #define FPDFSDK_JAVASCRIPT_APP_H_ |
9 | 9 |
| 10 #include <memory> |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "fpdfsdk/javascript/JS_Define.h" | 13 #include "fpdfsdk/javascript/JS_Define.h" |
13 | 14 |
14 class CJS_Runtime; | 15 class CJS_Runtime; |
15 class CJS_Timer; | 16 class CJS_Timer; |
16 | 17 |
17 class TimerObj : public CJS_EmbedObj { | 18 class TimerObj : public CJS_EmbedObj { |
18 public: | 19 public: |
19 TimerObj(CJS_Object* pJSObject); | 20 TimerObj(CJS_Object* pJSObject); |
(...skipping 13 matching lines...) Expand all Loading... |
33 ~CJS_TimerObj() override {} | 34 ~CJS_TimerObj() override {} |
34 | 35 |
35 DECLARE_JS_CLASS(); | 36 DECLARE_JS_CLASS(); |
36 }; | 37 }; |
37 | 38 |
38 class app : public CJS_EmbedObj { | 39 class app : public CJS_EmbedObj { |
39 public: | 40 public: |
40 app(CJS_Object* pJSObject); | 41 app(CJS_Object* pJSObject); |
41 ~app() override; | 42 ~app() override; |
42 | 43 |
43 public: | |
44 FX_BOOL activeDocs(IJS_Context* cc, | 44 FX_BOOL activeDocs(IJS_Context* cc, |
45 CJS_PropValue& vp, | 45 CJS_PropValue& vp, |
46 CFX_WideString& sError); | 46 CFX_WideString& sError); |
47 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 47 FX_BOOL calculate(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
48 FX_BOOL formsVersion(IJS_Context* cc, | 48 FX_BOOL formsVersion(IJS_Context* cc, |
49 CJS_PropValue& vp, | 49 CJS_PropValue& vp, |
50 CFX_WideString& sError); | 50 CFX_WideString& sError); |
51 FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); | 51 FX_BOOL fs(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError); |
52 FX_BOOL fullscreen(IJS_Context* cc, | 52 FX_BOOL fullscreen(IJS_Context* cc, |
53 CJS_PropValue& vp, | 53 CJS_PropValue& vp, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 CJS_Value& vRet, | 153 CJS_Value& vRet, |
154 CFX_WideString& sError); | 154 CFX_WideString& sError); |
155 | 155 |
156 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); | 156 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); |
157 | 157 |
158 private: | 158 private: |
159 // CJS_EmbedObj | 159 // CJS_EmbedObj |
160 void TimerProc(CJS_Timer* pTimer) override; | 160 void TimerProc(CJS_Timer* pTimer) override; |
161 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); | 161 void RunJsScript(CJS_Runtime* pRuntime, const CFX_WideString& wsScript); |
162 | 162 |
| 163 void ClearTimerCommon(const CJS_Value& param); |
| 164 |
163 bool m_bCalculate; | 165 bool m_bCalculate; |
164 bool m_bRuntimeHighLight; | 166 bool m_bRuntimeHighLight; |
165 CFX_ArrayTemplate<CJS_Timer*> m_aTimer; | 167 std::vector<std::unique_ptr<CJS_Timer>> m_Timers; |
166 }; | 168 }; |
167 | 169 |
168 class CJS_App : public CJS_Object { | 170 class CJS_App : public CJS_Object { |
169 public: | 171 public: |
170 explicit CJS_App(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | 172 explicit CJS_App(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
171 ~CJS_App() override {} | 173 ~CJS_App() override {} |
172 | 174 |
173 DECLARE_JS_CLASS(); | 175 DECLARE_JS_CLASS(); |
174 | 176 |
175 JS_STATIC_PROP(activeDocs, app); | 177 JS_STATIC_PROP(activeDocs, app); |
(...skipping 26 matching lines...) Expand all Loading... |
202 JS_STATIC_METHOD(openDoc, app); | 204 JS_STATIC_METHOD(openDoc, app); |
203 JS_STATIC_METHOD(openFDF, app); | 205 JS_STATIC_METHOD(openFDF, app); |
204 JS_STATIC_METHOD(popUpMenuEx, app); | 206 JS_STATIC_METHOD(popUpMenuEx, app); |
205 JS_STATIC_METHOD(popUpMenu, app); | 207 JS_STATIC_METHOD(popUpMenu, app); |
206 JS_STATIC_METHOD(response, app); | 208 JS_STATIC_METHOD(response, app); |
207 JS_STATIC_METHOD(setInterval, app); | 209 JS_STATIC_METHOD(setInterval, app); |
208 JS_STATIC_METHOD(setTimeOut, app); | 210 JS_STATIC_METHOD(setTimeOut, app); |
209 }; | 211 }; |
210 | 212 |
211 #endif // FPDFSDK_JAVASCRIPT_APP_H_ | 213 #endif // FPDFSDK_JAVASCRIPT_APP_H_ |
OLD | NEW |