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 "JS_Runtime.h" |
| 8 |
| 9 #include "../../../xfa/src/fxjse/src/value.h" |
| 10 #include "../../include/fpdfxfa/fpdfxfa_app.h" |
| 11 #include "../../include/fsdk_mgr.h" // For CPDFDoc_Environment. |
7 #include "../../include/javascript/IJavaScript.h" | 12 #include "../../include/javascript/IJavaScript.h" |
8 #include "../../include/javascript/JS_EventHandler.h" | 13 #include "Consts.h" |
9 #include "../../include/javascript/JS_Runtime.h" | 14 #include "Document.h" |
10 #include "../../include/javascript/JS_Context.h" | 15 #include "Field.h" |
11 #include "../../include/javascript/JS_Define.h" | 16 #include "Icon.h" |
12 #include "../../include/javascript/JS_Object.h" | 17 #include "JS_Context.h" |
13 #include "../../include/javascript/JS_Value.h" | 18 #include "JS_Define.h" |
14 #include "../../include/javascript/app.h" | 19 #include "JS_EventHandler.h" |
15 #include "../../include/javascript/color.h" | 20 #include "JS_GlobalData.h" |
16 #include "../../include/javascript/Consts.h" | 21 #include "JS_Object.h" |
17 #include "../../include/javascript/Document.h" | 22 #include "JS_Value.h" |
18 #include "../../include/javascript/event.h" | 23 #include "PublicMethods.h" |
19 #include "../../include/javascript/Field.h" | 24 #include "app.h" |
20 #include "../../include/javascript/Icon.h" | 25 #include "color.h" |
21 #include "../../include/javascript/PublicMethods.h" | 26 #include "console.h" |
22 #include "../../include/javascript/report.h" | 27 #include "event.h" |
23 #include "../../include/javascript/util.h" | 28 #include "global.h" |
24 #include "../../include/javascript/JS_GlobalData.h" | 29 #include "report.h" |
25 #include "../../include/javascript/global.h" | 30 #include "util.h" |
26 #include "../../include/javascript/console.h" | |
27 #include "../../include/fpdfxfa/fpdfxfa_app.h" | |
28 #include "../../../xfa/src/fxjse/src/value.h" | |
29 | 31 |
30 /* ------------------------------ CJS_Runtime ------------------------------ */ | 32 /* ------------------------------ CJS_Runtime ------------------------------ */ |
31 v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(v8::Isolate* pIsolate); | 33 v8::Global<v8::ObjectTemplate>& _getGlobalObjectTemplate(v8::Isolate* pIsolate); |
32 | 34 |
| 35 IFXJS_Runtime* IFXJS_Runtime::Create(CPDFDoc_Environment* pEnv) { |
| 36 return new CJS_Runtime(pEnv); |
| 37 } |
| 38 |
33 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) | 39 CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp) |
34 : m_pApp(pApp), | 40 : m_pApp(pApp), |
35 m_pDocument(NULL), | 41 m_pDocument(NULL), |
36 m_bBlocking(FALSE), | 42 m_bBlocking(FALSE), |
37 m_isolate(NULL), | 43 m_isolate(NULL), |
38 m_isolateManaged(false) { | 44 m_isolateManaged(false) { |
39 if (CPDFXFA_App::GetInstance()->GetJSERuntime()) { | 45 if (CPDFXFA_App::GetInstance()->GetJSERuntime()) { |
40 // TODO(tsepez): CPDFXFA_App should also use the embedder provided isolate. | 46 // TODO(tsepez): CPDFXFA_App should also use the embedder provided isolate. |
41 m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERuntime(); | 47 m_isolate = (v8::Isolate*)CPDFXFA_App::GetInstance()->GetJSERuntime(); |
42 } else if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) { | 48 } else if (m_pApp->GetFormFillInfo()->m_pJsPlatform->version >= 2) { |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 | 267 |
262 void CJS_Runtime::AddObserver(Observer* observer) { | 268 void CJS_Runtime::AddObserver(Observer* observer) { |
263 ASSERT(m_observers.find(observer) == m_observers.end()); | 269 ASSERT(m_observers.find(observer) == m_observers.end()); |
264 m_observers.insert(observer); | 270 m_observers.insert(observer); |
265 } | 271 } |
266 | 272 |
267 void CJS_Runtime::RemoveObserver(Observer* observer) { | 273 void CJS_Runtime::RemoveObserver(Observer* observer) { |
268 ASSERT(m_observers.find(observer) != m_observers.end()); | 274 ASSERT(m_observers.find(observer) != m_observers.end()); |
269 m_observers.erase(observer); | 275 m_observers.erase(observer); |
270 } | 276 } |
OLD | NEW |