Kill off unused IFXJS interface methods.
[pdfium.git] / fpdfsdk / include / javascript / JS_Runtime.h
1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4  
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7 #ifndef _JS_RUNTIME_H_
8 #define _JS_RUNTIME_H_
9
10 class CJS_FieldEvent
11 {
12 public:
13         CFX_WideString          sTargetName;
14         JS_EVENT_T                      eEventType;
15         CJS_FieldEvent*         pNext;
16 };
17
18 class CJS_Runtime : public IFXJS_Runtime
19 {
20 public:
21         CJS_Runtime(CPDFDoc_Environment * pApp);
22         virtual ~CJS_Runtime();
23
24         virtual IFXJS_Context *                                 NewContext();
25         virtual void                                                    ReleaseContext(IFXJS_Context * pContext);
26         virtual IFXJS_Context*                                  GetCurrentContext();
27
28         virtual void                                                    SetReaderDocument(CPDFSDK_Document *pReaderDoc);
29         virtual CPDFSDK_Document *                              GetReaderDocument(){return m_pDocument;}
30
31         CPDFDoc_Environment *                                                   GetReaderApp(){return m_pApp;}
32
33         FX_BOOL                                                                 InitJSObjects();
34
35         FX_BOOL                                                                 AddEventToLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
36         void                                                                    RemoveEventInLoop(const CFX_WideString& sTargetName, JS_EVENT_T eEventType);
37         void                                                                    RemoveEventsInLoop(CJS_FieldEvent* pStart);
38
39         void                                                                    BeginBlock(){m_bBlocking = TRUE;}
40         void                                                                    EndBlock(){m_bBlocking = FALSE;}
41         FX_BOOL                                                                 IsBlocking(){return m_bBlocking;}
42
43         operator                                                                IJS_Runtime*() {return (IJS_Runtime*)m_isolate;}
44         v8::Isolate*                                                            GetIsolate(){return m_isolate;};
45         void                                                                    SetIsolate(v8::Isolate* isolate){m_isolate = isolate;}
46
47         v8::Handle<v8::Context>                                                 NewJSContext();
48 protected:
49         CFX_ArrayTemplate<CJS_Context *>                m_ContextArray;
50         CPDFDoc_Environment *                                                   m_pApp;
51         CPDFSDK_Document *                                              m_pDocument;
52         FX_BOOL                                                                 m_bBlocking;
53         CJS_FieldEvent*                                                 m_pFieldEventPath;
54
55         v8::Isolate*                                                            m_isolate;
56         v8::Persistent<v8::Context>                                             m_context;
57         FX_BOOL                                                                 m_bRegistered;
58 };
59
60 #endif //_JS_RUNTIME_H_
61