| 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 "fpdfsdk/javascript/cjs_context.h" | 7 #include "fpdfsdk/javascript/cjs_context.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/javascript/JS_EventHandler.h" | 9 #include "fpdfsdk/javascript/JS_EventHandler.h" |
| 10 #include "fpdfsdk/javascript/cjs_runtime.h" | 10 #include "fpdfsdk/javascript/cjs_runtime.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(), | 47 CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(), |
| 48 m_pEventHandler->EventType()); | 48 m_pEventHandler->EventType()); |
| 49 if (!m_pRuntime->AddEventToSet(event)) { | 49 if (!m_pRuntime->AddEventToSet(event)) { |
| 50 *info = JSGetStringFromID(this, IDS_STRING_JSEVENT); | 50 *info = JSGetStringFromID(this, IDS_STRING_JSEVENT); |
| 51 return FALSE; | 51 return FALSE; |
| 52 } | 52 } |
| 53 | 53 |
| 54 CFX_WideString sErrorMessage; | 54 CFX_WideString sErrorMessage; |
| 55 int nRet = 0; | 55 int nRet = 0; |
| 56 if (script.GetLength() > 0) { | 56 if (script.GetLength() > 0) { |
| 57 nRet = m_pRuntime->Execute(this, script.c_str(), &sErrorMessage); | 57 nRet = m_pRuntime->Execute(script.c_str(), &sErrorMessage); |
| 58 } | 58 } |
| 59 | 59 |
| 60 if (nRet < 0) { | 60 if (nRet < 0) { |
| 61 *info += sErrorMessage; | 61 *info += sErrorMessage; |
| 62 } else { | 62 } else { |
| 63 *info = JSGetStringFromID(this, IDS_STRING_RUN); | 63 *info = JSGetStringFromID(this, IDS_STRING_RUN); |
| 64 } | 64 } |
| 65 | 65 |
| 66 m_pRuntime->RemoveEventFromSet(event); | 66 m_pRuntime->RemoveEventFromSet(event); |
| 67 m_pEventHandler->Destroy(); | 67 m_pEventHandler->Destroy(); |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 } | 272 } |
| 273 | 273 |
| 274 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { | 274 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { |
| 275 m_pEventHandler->OnBatchExec(pTarget); | 275 m_pEventHandler->OnBatchExec(pTarget); |
| 276 } | 276 } |
| 277 | 277 |
| 278 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, | 278 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, |
| 279 const CFX_WideString& strTargetName) { | 279 const CFX_WideString& strTargetName) { |
| 280 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); | 280 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); |
| 281 } | 281 } |
| OLD | NEW |