| 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 #include "app.h" | 7 #include "app.h" |
| 8 | 8 |
| 9 #include "../../../third_party/base/nonstd_unique_ptr.h" | 9 #include "../../../third_party/base/nonstd_unique_ptr.h" |
| 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. | 10 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 CJS_Array aDocs(pRuntime); | 116 CJS_Array aDocs(pRuntime); |
| 117 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { | 117 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) { |
| 118 CJS_Document* pJSDocument = NULL; | 118 CJS_Document* pJSDocument = NULL; |
| 119 if (pDoc == pCurDoc) { | 119 if (pDoc == pCurDoc) { |
| 120 v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); | 120 v8::Local<v8::Object> pObj = FXJS_GetThisObj(pRuntime->GetIsolate()); |
| 121 if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) | 121 if (FXJS_GetObjDefnID(pObj) == CJS_Document::g_nObjDefnID) |
| 122 pJSDocument = | 122 pJSDocument = |
| 123 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); | 123 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| 124 } else { | 124 } else { |
| 125 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( | 125 v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj( |
| 126 pRuntime->GetIsolate(), pContext, CJS_Document::g_nObjDefnID); | 126 pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID); |
| 127 pJSDocument = | 127 pJSDocument = |
| 128 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); | 128 (CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj); |
| 129 ASSERT(pJSDocument != NULL); | 129 ASSERT(pJSDocument != NULL); |
| 130 } | 130 } |
| 131 aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); | 131 aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument)); |
| 132 } | 132 } |
| 133 if (aDocs.GetLength() > 0) | 133 if (aDocs.GetLength() > 0) |
| 134 vp << aDocs; | 134 vp << aDocs; |
| 135 else | 135 else |
| 136 vp.SetNull(); | 136 vp.SetNull(); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); | 395 CJS_Runtime* pRuntime = pContext->GetJSRuntime(); |
| 396 FX_DWORD dwInterval = params.size() > 1 ? params[1].ToInt() : 1000; | 396 FX_DWORD dwInterval = params.size() > 1 ? params[1].ToInt() : 1000; |
| 397 | 397 |
| 398 CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); | 398 CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); |
| 399 ASSERT(pApp); | 399 ASSERT(pApp); |
| 400 CJS_Timer* pTimer = | 400 CJS_Timer* pTimer = |
| 401 new CJS_Timer(this, pApp, pRuntime, 0, script, dwInterval, 0); | 401 new CJS_Timer(this, pApp, pRuntime, 0, script, dwInterval, 0); |
| 402 m_aTimer.Add(pTimer); | 402 m_aTimer.Add(pTimer); |
| 403 | 403 |
| 404 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( | 404 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| 405 pRuntime->GetIsolate(), pContext, CJS_TimerObj::g_nObjDefnID); | 405 pRuntime->GetIsolate(), pRuntime, CJS_TimerObj::g_nObjDefnID); |
| 406 CJS_TimerObj* pJS_TimerObj = | 406 CJS_TimerObj* pJS_TimerObj = |
| 407 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); | 407 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| 408 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 408 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 409 pTimerObj->SetTimer(pTimer); | 409 pTimerObj->SetTimer(pTimer); |
| 410 | 410 |
| 411 vRet = pRetObj; | 411 vRet = pRetObj; |
| 412 return TRUE; | 412 return TRUE; |
| 413 } | 413 } |
| 414 | 414 |
| 415 FX_BOOL app::setTimeOut(IJS_Context* cc, | 415 FX_BOOL app::setTimeOut(IJS_Context* cc, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 436 FX_DWORD dwTimeOut = params.size() > 1 ? params[1].ToInt() : 1000; | 436 FX_DWORD dwTimeOut = params.size() > 1 ? params[1].ToInt() : 1000; |
| 437 | 437 |
| 438 CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); | 438 CPDFDoc_Environment* pApp = pRuntime->GetReaderApp(); |
| 439 ASSERT(pApp); | 439 ASSERT(pApp); |
| 440 | 440 |
| 441 CJS_Timer* pTimer = | 441 CJS_Timer* pTimer = |
| 442 new CJS_Timer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut); | 442 new CJS_Timer(this, pApp, pRuntime, 1, script, dwTimeOut, dwTimeOut); |
| 443 m_aTimer.Add(pTimer); | 443 m_aTimer.Add(pTimer); |
| 444 | 444 |
| 445 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( | 445 v8::Local<v8::Object> pRetObj = FXJS_NewFxDynamicObj( |
| 446 pRuntime->GetIsolate(), pContext, CJS_TimerObj::g_nObjDefnID); | 446 pRuntime->GetIsolate(), pRuntime, CJS_TimerObj::g_nObjDefnID); |
| 447 CJS_TimerObj* pJS_TimerObj = | 447 CJS_TimerObj* pJS_TimerObj = |
| 448 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); | 448 (CJS_TimerObj*)FXJS_GetPrivate(pRuntime->GetIsolate(), pRetObj); |
| 449 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); | 449 TimerObj* pTimerObj = (TimerObj*)pJS_TimerObj->GetEmbedObject(); |
| 450 pTimerObj->SetTimer(pTimer); | 450 pTimerObj->SetTimer(pTimer); |
| 451 | 451 |
| 452 vRet = pRetObj; | 452 vRet = pRetObj; |
| 453 return TRUE; | 453 return TRUE; |
| 454 } | 454 } |
| 455 | 455 |
| 456 FX_BOOL app::clearTimeOut(IJS_Context* cc, | 456 FX_BOOL app::clearTimeOut(IJS_Context* cc, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { | 805 FX_BOOL app::media(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) { |
| 806 return FALSE; | 806 return FALSE; |
| 807 } | 807 } |
| 808 | 808 |
| 809 FX_BOOL app::execDialog(IJS_Context* cc, | 809 FX_BOOL app::execDialog(IJS_Context* cc, |
| 810 const CJS_Parameters& params, | 810 const CJS_Parameters& params, |
| 811 CJS_Value& vRet, | 811 CJS_Value& vRet, |
| 812 CFX_WideString& sError) { | 812 CFX_WideString& sError) { |
| 813 return TRUE; | 813 return TRUE; |
| 814 } | 814 } |
| OLD | NEW |