1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef nsIDOMScriptObjectFactory_h__
7 #define nsIDOMScriptObjectFactory_h__
9 #include "nsISupports.h"
10 #include "nsIDOMClassInfo.h"
11 #include "nsStringGlue.h"
12 #include "nsIScriptRuntime.h"
14 #define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \
15 { 0x2a50e17c, 0x46ff, 0x4150, \
16 { 0xbb, 0x46, 0xd8, 0x07, 0xb3, 0x36, 0xde, 0xab } }
18 class nsIScriptContext
;
19 class nsIScriptGlobalObject
;
20 class nsIDOMEventListener
;
22 typedef nsXPCClassInfo
* (*nsDOMClassInfoExternalConstructorFnc
)
25 class nsIDOMScriptObjectFactory
: public nsISupports
{
27 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_SCRIPT_OBJECT_FACTORY_IID
)
29 NS_IMETHOD_(nsISupports
*) GetClassInfoInstance(nsDOMClassInfoID aID
) = 0;
30 NS_IMETHOD_(nsISupports
*) GetExternalClassInfoInstance(const nsAString
& aName
) = 0;
32 // Register the info for an external class. aName must be static
33 // data, it will not be deleted by the DOM code. aProtoChainInterface
34 // must be registered in the JAVASCRIPT_DOM_INTERFACE category, or
35 // prototypes for this class won't work (except if the interface
36 // name starts with nsIDOM).
37 NS_IMETHOD
RegisterDOMClassInfo(const char *aName
,
38 nsDOMClassInfoExternalConstructorFnc aConstructorFptr
,
39 const nsIID
*aProtoChainInterface
,
40 const nsIID
**aInterfaces
,
41 uint32_t aScriptableFlags
,
42 bool aHasClassInterface
,
43 const nsCID
*aConstructorCID
) = 0;
45 nsIScriptRuntime
* GetJSRuntime()
51 nsCOMPtr
<nsIScriptRuntime
> mJSRuntime
;
54 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMScriptObjectFactory
,
55 NS_IDOM_SCRIPT_OBJECT_FACTORY_IID
)
57 #endif /* nsIDOMScriptObjectFactory_h__ */