Chromium Code Reviews| 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/JS_Object.h" | 7 #include "fpdfsdk/javascript/JS_Object.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_mgr.h" | 9 #include "fpdfsdk/include/fsdk_mgr.h" |
| 10 #include "fpdfsdk/javascript/JS_Define.h" | 10 #include "fpdfsdk/javascript/JS_Define.h" |
| 11 #include "fpdfsdk/javascript/cjs_context.h" | 11 #include "fpdfsdk/javascript/cjs_context.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 int FXJS_MsgBox(CPDFDoc_Environment* pApp, | 15 int FXJS_MsgBox(CPDFDoc_Environment* pApp, |
|
dsinclair
2016/07/21 19:00:20
Can we move this straight into CJS_EmbedObj::MsgBo
| |
| 16 const FX_WCHAR* swMsg, | 16 const FX_WCHAR* swMsg, |
| 17 const FX_WCHAR* swTitle, | 17 const FX_WCHAR* swTitle, |
| 18 FX_UINT nType, | 18 FX_UINT nType, |
| 19 FX_UINT nIcon) { | 19 FX_UINT nIcon) { |
| 20 if (!pApp) | 20 if (!pApp) |
| 21 return 0; | 21 return 0; |
| 22 | 22 |
| 23 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) | 23 if (CPDFSDK_Document* pDoc = pApp->GetSDKDocument()) |
| 24 pDoc->KillFocusAnnot(); | 24 pDoc->KillFocusAnnot(); |
| 25 | 25 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 | 68 |
| 69 void CJS_Object::MakeWeak() { | 69 void CJS_Object::MakeWeak() { |
| 70 m_pV8Object.SetWeak(this, DisposeObject, | 70 m_pV8Object.SetWeak(this, DisposeObject, |
| 71 v8::WeakCallbackType::kInternalFields); | 71 v8::WeakCallbackType::kInternalFields); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void CJS_Object::Dispose() { | 74 void CJS_Object::Dispose() { |
| 75 m_pV8Object.Reset(); | 75 m_pV8Object.Reset(); |
| 76 } | 76 } |
| 77 | 77 |
| 78 FX_BOOL CJS_Object::IsType(const FX_CHAR* sClassName) { | |
| 79 return TRUE; | |
| 80 } | |
| 81 | |
| 82 CFX_ByteString CJS_Object::GetClassName() { | |
| 83 return ""; | |
| 84 } | |
| 85 | |
| 86 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {} | 78 void CJS_Object::InitInstance(IJS_Runtime* pIRuntime) {} |
| 87 | 79 |
| 88 void CJS_Object::ExitInstance() {} | 80 void CJS_Object::ExitInstance() {} |
| 89 | 81 |
| 90 int CJS_Object::MsgBox(CPDFDoc_Environment* pApp, | |
| 91 const FX_WCHAR* swMsg, | |
| 92 const FX_WCHAR* swTitle, | |
| 93 FX_UINT nType, | |
| 94 FX_UINT nIcon) { | |
| 95 return FXJS_MsgBox(pApp, swMsg, swTitle, nType, nIcon); | |
| 96 } | |
| 97 | |
| 98 void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) { | 82 void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) { |
| 99 if (pContext->IsMsgBoxEnabled()) { | 83 if (pContext->IsMsgBoxEnabled()) { |
| 100 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); | 84 CPDFDoc_Environment* pApp = pContext->GetReaderApp(); |
| 101 if (pApp) | 85 if (pApp) |
| 102 pApp->JS_appAlert(swMsg, nullptr, 0, 3); | 86 pApp->JS_appAlert(swMsg, nullptr, 0, 3); |
| 103 } | 87 } |
| 104 } | 88 } |
| 105 | 89 |
| 106 CJS_Timer::CJS_Timer(CJS_EmbedObj* pObj, | 90 CJS_Timer::CJS_Timer(CJS_EmbedObj* pObj, |
| 107 CPDFDoc_Environment* pApp, | 91 CPDFDoc_Environment* pApp, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 160 // static | 144 // static |
| 161 CJS_Timer::TimerMap* CJS_Timer::GetGlobalTimerMap() { | 145 CJS_Timer::TimerMap* CJS_Timer::GetGlobalTimerMap() { |
| 162 // Leak the timer array at shutdown. | 146 // Leak the timer array at shutdown. |
| 163 static auto* s_TimerMap = new TimerMap; | 147 static auto* s_TimerMap = new TimerMap; |
| 164 return s_TimerMap; | 148 return s_TimerMap; |
| 165 } | 149 } |
| 166 | 150 |
| 167 void CJS_Timer::OnDestroyed() { | 151 void CJS_Timer::OnDestroyed() { |
| 168 m_bValid = false; | 152 m_bValid = false; |
| 169 } | 153 } |
| OLD | NEW |