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 FXJS_CFXJSE_CLASS_H_ 8 #define FXJS_CFXJSE_CLASS_H_ 9 10 #include "fxjs/cfxjse_arguments.h" 11 #include "fxjs/fxjse.h" 12 #include "v8/include/v8.h" 13 14 class CFXJSE_Context; 15 class CFXJSE_Value; 16 17 class CFXJSE_Class { 18 public: 19 static CFXJSE_Class* Create(CFXJSE_Context* pContext, 20 const FXJSE_CLASS_DESCRIPTOR* lpClassDefintion, 21 bool bIsJSGlobal = false); 22 static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext, 23 const CFX_ByteStringC& szName); 24 static void SetUpNamedPropHandler( 25 v8::Isolate* pIsolate, 26 v8::Local<v8::ObjectTemplate>& hObjectTemplate, 27 const FXJSE_CLASS_DESCRIPTOR* lpClassDefinition); 28 29 ~CFXJSE_Class(); 30 31 CFXJSE_Context* GetContext() { return m_pContext; } 32 v8::Global<v8::FunctionTemplate>& GetTemplate() { return m_hTemplate; } 33 34 protected: 35 explicit CFXJSE_Class(CFXJSE_Context* lpContext); 36 37 CFX_ByteString m_szClassName; 38 const FXJSE_CLASS_DESCRIPTOR* m_lpClassDefinition; 39 CFXJSE_Context* m_pContext; 40 v8::Global<v8::FunctionTemplate> m_hTemplate; 41 friend class CFXJSE_Context; 42 friend class CFXJSE_Value; 43 }; 44 45 #endif // FXJS_CFXJSE_CLASS_H_ 46