| 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 <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "fpdfsdk/javascript/JS_Define.h" | 13 #include "fpdfsdk/javascript/JS_Define.h" |
| 14 | 14 |
| 15 class CJS_Runtime; | 15 class CJS_Runtime; |
| 16 class CJS_Timer; | 16 class CJS_Timer; |
| 17 | 17 |
| 18 class TimerObj : public CJS_EmbedObj { | 18 class TimerObj : public CJS_EmbedObj { |
| 19 public: | 19 public: |
| 20 TimerObj(CJS_Object* pJSObject); | 20 TimerObj(CJS_Object* pJSObject); |
| 21 ~TimerObj() override; | 21 ~TimerObj() override; |
| 22 | 22 |
| 23 public: | |
| 24 void SetTimer(CJS_Timer* pTimer); | 23 void SetTimer(CJS_Timer* pTimer); |
| 25 CJS_Timer* GetTimer() const; | 24 int GetTimerID() const { return m_nTimerID; } |
| 26 | 25 |
| 27 private: | 26 private: |
| 28 CJS_Timer* m_pTimer; | 27 int m_nTimerID; // Weak reference to timer through global map. |
| 29 }; | 28 }; |
| 30 | 29 |
| 31 class CJS_TimerObj : public CJS_Object { | 30 class CJS_TimerObj : public CJS_Object { |
| 32 public: | 31 public: |
| 33 CJS_TimerObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} | 32 CJS_TimerObj(v8::Local<v8::Object> pObject) : CJS_Object(pObject) {} |
| 34 ~CJS_TimerObj() override {} | 33 ~CJS_TimerObj() override {} |
| 35 | 34 |
| 36 DECLARE_JS_CLASS(); | 35 DECLARE_JS_CLASS(); |
| 37 }; | 36 }; |
| 38 | 37 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 FX_BOOL setTimeOut(IJS_Context* cc, | 150 FX_BOOL setTimeOut(IJS_Context* cc, |
| 152 const std::vector<CJS_Value>& params, | 151 const std::vector<CJS_Value>& params, |
| 153 CJS_Value& vRet, | 152 CJS_Value& vRet, |
| 154 CFX_WideString& sError); | 153 CFX_WideString& sError); |
| 155 | 154 |
| 156 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); | 155 static CFX_WideString SysPathToPDFPath(const CFX_WideString& sOldPath); |
| 157 | 156 |
| 158 private: | 157 private: |
| 159 // CJS_EmbedObj | 158 // CJS_EmbedObj |
| 160 void TimerProc(CJS_Timer* pTimer) override; | 159 void TimerProc(CJS_Timer* pTimer) override; |
| 160 void CancelProc(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); | 163 void ClearTimerCommon(const CJS_Value& param); |
| 164 | 164 |
| 165 bool m_bCalculate; | 165 bool m_bCalculate; |
| 166 bool m_bRuntimeHighLight; | 166 bool m_bRuntimeHighLight; |
| 167 std::vector<std::unique_ptr<CJS_Timer>> m_Timers; | 167 std::vector<std::unique_ptr<CJS_Timer>> m_Timers; |
| 168 }; | 168 }; |
| 169 | 169 |
| 170 class CJS_App : public CJS_Object { | 170 class CJS_App : public CJS_Object { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 JS_STATIC_METHOD(openDoc, app); | 204 JS_STATIC_METHOD(openDoc, app); |
| 205 JS_STATIC_METHOD(openFDF, app); | 205 JS_STATIC_METHOD(openFDF, app); |
| 206 JS_STATIC_METHOD(popUpMenuEx, app); | 206 JS_STATIC_METHOD(popUpMenuEx, app); |
| 207 JS_STATIC_METHOD(popUpMenu, app); | 207 JS_STATIC_METHOD(popUpMenu, app); |
| 208 JS_STATIC_METHOD(response, app); | 208 JS_STATIC_METHOD(response, app); |
| 209 JS_STATIC_METHOD(setInterval, app); | 209 JS_STATIC_METHOD(setInterval, app); |
| 210 JS_STATIC_METHOD(setTimeOut, app); | 210 JS_STATIC_METHOD(setTimeOut, app); |
| 211 }; | 211 }; |
| 212 | 212 |
| 213 #endif // FPDFSDK_JAVASCRIPT_APP_H_ | 213 #endif // FPDFSDK_JAVASCRIPT_APP_H_ |
| OLD | NEW |