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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(), | 44 CJS_Runtime::FieldEvent event(m_pEventHandler->TargetName(), |
45 m_pEventHandler->EventType()); | 45 m_pEventHandler->EventType()); |
46 if (!m_pRuntime->AddEventToSet(event)) { | 46 if (!m_pRuntime->AddEventToSet(event)) { |
47 *info = JSGetStringFromID(this, IDS_STRING_JSEVENT); | 47 *info = JSGetStringFromID(this, IDS_STRING_JSEVENT); |
48 return FALSE; | 48 return FALSE; |
49 } | 49 } |
50 | 50 |
51 CFX_WideString sErrorMessage; | 51 CFX_WideString sErrorMessage; |
52 int nRet = 0; | 52 int nRet = 0; |
53 if (script.GetLength() > 0) { | 53 if (script.GetLength() > 0) { |
54 nRet = m_pRuntime->Execute(this, script.c_str(), &sErrorMessage); | 54 nRet = m_pRuntime->Execute(script.c_str(), &sErrorMessage); |
55 } | 55 } |
56 | 56 |
57 if (nRet < 0) { | 57 if (nRet < 0) { |
58 *info += sErrorMessage; | 58 *info += sErrorMessage; |
59 } else { | 59 } else { |
60 *info = JSGetStringFromID(this, IDS_STRING_RUN); | 60 *info = JSGetStringFromID(this, IDS_STRING_RUN); |
61 } | 61 } |
62 | 62 |
63 m_pRuntime->RemoveEventFromSet(event); | 63 m_pRuntime->RemoveEventFromSet(event); |
64 m_pEventHandler->Destroy(); | 64 m_pEventHandler->Destroy(); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { | 271 void CJS_Context::OnBatchExec(CPDFSDK_Document* pTarget) { |
272 m_pEventHandler->OnBatchExec(pTarget); | 272 m_pEventHandler->OnBatchExec(pTarget); |
273 } | 273 } |
274 | 274 |
275 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, | 275 void CJS_Context::OnMenu_Exec(CPDFSDK_Document* pTarget, |
276 const CFX_WideString& strTargetName) { | 276 const CFX_WideString& strTargetName) { |
277 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); | 277 m_pEventHandler->OnMenu_Exec(pTarget, strTargetName); |
278 } | 278 } |
OLD | NEW |