Home | History | Annotate | Download | only in src
      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 FXJSE_CLASS_H_
      8 #define FXJSE_CLASS_H_
      9 class CFXJSE_Context;
     10 class CFXJSE_Value;
     11 class CFXJSE_Class {
     12  protected:
     13   CFXJSE_Class(CFXJSE_Context* lpContext)
     14       : m_lpClassDefinition(nullptr), m_pContext(lpContext) {}
     15 
     16  public:
     17   inline CFXJSE_Context* GetContext() { return m_pContext; }
     18   inline v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; }
     19 
     20  public:
     21   static CFXJSE_Class* Create(CFXJSE_Context* pContext,
     22                               const FXJSE_CLASS* lpClassDefintion,
     23                               FX_BOOL bIsJSGlobal = FALSE);
     24   static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext,
     25                                            const CFX_ByteStringC& szName);
     26   static void SetUpDynPropHandler(CFXJSE_Context* pContext,
     27                                   CFXJSE_Value* pValue,
     28                                   const FXJSE_CLASS* lpClassDefinition);
     29   static void SetUpNamedPropHandler(
     30       v8::Isolate* pIsolate,
     31       v8::Local<v8::ObjectTemplate>& hObjectTemplate,
     32       const FXJSE_CLASS* lpClassDefinition);
     33 
     34  protected:
     35   CFX_ByteString m_szClassName;
     36   const FXJSE_CLASS* m_lpClassDefinition;
     37   CFXJSE_Context* m_pContext;
     38   v8::Global<v8::FunctionTemplate> m_hTemplate;
     39   friend class CFXJSE_Context;
     40   friend class CFXJSE_Value;
     41 };
     42 struct CFXJSE_ArgumentsImpl {
     43   const v8::FunctionCallbackInfo<v8::Value>* m_pInfo;
     44   CFXJSE_Value* m_pRetValue;
     45 };
     46 #endif
     47