|
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/. */ |
|
5 |
|
6 #ifndef nsIDOMScriptObjectFactory_h__ |
|
7 #define nsIDOMScriptObjectFactory_h__ |
|
8 |
|
9 #include "nsISupports.h" |
|
10 #include "nsIDOMClassInfo.h" |
|
11 #include "nsString.h" |
|
12 |
|
13 #define NS_IDOM_SCRIPT_OBJECT_FACTORY_IID \ |
|
14 { 0x2a50e17c, 0x46ff, 0x4150, \ |
|
15 { 0xbb, 0x46, 0xd8, 0x07, 0xb3, 0x36, 0xde, 0xab } } |
|
16 |
|
17 class nsIScriptContext; |
|
18 class nsIScriptGlobalObject; |
|
19 class nsIDOMEventListener; |
|
20 |
|
21 typedef nsXPCClassInfo* (*nsDOMClassInfoExternalConstructorFnc) |
|
22 (const char* aName); |
|
23 |
|
24 class nsIDOMScriptObjectFactory : public nsISupports { |
|
25 public: |
|
26 NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDOM_SCRIPT_OBJECT_FACTORY_IID) |
|
27 |
|
28 NS_IMETHOD_(nsISupports *) GetClassInfoInstance(nsDOMClassInfoID aID) = 0; |
|
29 NS_IMETHOD_(nsISupports *) GetExternalClassInfoInstance(const nsAString& aName) = 0; |
|
30 |
|
31 // Register the info for an external class. aName must be static |
|
32 // data, it will not be deleted by the DOM code. aProtoChainInterface |
|
33 // must be registered in the JAVASCRIPT_DOM_INTERFACE category, or |
|
34 // prototypes for this class won't work (except if the interface |
|
35 // name starts with nsIDOM). |
|
36 NS_IMETHOD RegisterDOMClassInfo(const char *aName, |
|
37 nsDOMClassInfoExternalConstructorFnc aConstructorFptr, |
|
38 const nsIID *aProtoChainInterface, |
|
39 const nsIID **aInterfaces, |
|
40 uint32_t aScriptableFlags, |
|
41 bool aHasClassInterface, |
|
42 const nsCID *aConstructorCID) = 0; |
|
43 }; |
|
44 |
|
45 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDOMScriptObjectFactory, |
|
46 NS_IDOM_SCRIPT_OBJECT_FACTORY_IID) |
|
47 |
|
48 #endif /* nsIDOMScriptObjectFactory_h__ */ |