Back to index

lightning-sunbird  0.9+nobinonly
nsIDOMClassInfo.h
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
00002 /* ***** BEGIN LICENSE BLOCK *****
00003  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00004  *
00005  * The contents of this file are subject to the Mozilla Public License Version
00006  * 1.1 (the "License"); you may not use this file except in compliance with
00007  * the License. You may obtain a copy of the License at
00008  * http://www.mozilla.org/MPL/
00009  *
00010  * Software distributed under the License is distributed on an "AS IS" basis,
00011  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00012  * for the specific language governing rights and limitations under the
00013  * License.
00014  *
00015  * The Original Code is mozilla.org code.
00016  *
00017  * The Initial Developer of the Original Code is
00018  * Netscape Communications Corporation.
00019  * Portions created by the Initial Developer are Copyright (C) 2000
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *   Johnny Stenback <jst@netscape.com> (original author)
00024  *
00025  * Alternatively, the contents of this file may be used under the terms of
00026  * either of the GNU General Public License Version 2 or later (the "GPL"),
00027  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00028  * in which case the provisions of the GPL or the LGPL are applicable instead
00029  * of those above. If you wish to allow use of your version of this file only
00030  * under the terms of either the GPL or the LGPL, and not to allow others to
00031  * use your version of this file under the terms of the MPL, indicate your
00032  * decision by deleting the provisions above and replace them with the notice
00033  * and other provisions required by the GPL or the LGPL. If you do not delete
00034  * the provisions above, a recipient may use your version of this file under
00035  * the terms of any one of the MPL, the GPL or the LGPL.
00036  *
00037  * ***** END LICENSE BLOCK ***** */
00038 
00039 #ifndef nsIDOMClassInfo_h___
00040 #define nsIDOMClassInfo_h___
00041 
00042 #include "nsIClassInfo.h"
00043 #include "nsVoidArray.h"
00044 
00045 enum nsDOMClassInfoID {
00046   // Base classes
00047   eDOMClassInfo_Window_id,
00048   eDOMClassInfo_Location_id,
00049   eDOMClassInfo_Navigator_id,
00050   eDOMClassInfo_Plugin_id,
00051   eDOMClassInfo_PluginArray_id,
00052   eDOMClassInfo_MimeType_id,
00053   eDOMClassInfo_MimeTypeArray_id,
00054   eDOMClassInfo_BarProp_id,
00055   eDOMClassInfo_History_id,
00056   eDOMClassInfo_Screen_id,
00057 
00058   // Core classes
00059   eDOMClassInfo_XMLDocument_id,
00060   eDOMClassInfo_DocumentType_id,
00061   eDOMClassInfo_DOMImplementation_id,
00062   eDOMClassInfo_DOMException_id,
00063   eDOMClassInfo_DocumentFragment_id,
00064   eDOMClassInfo_Element_id,
00065   eDOMClassInfo_Attr_id,
00066   eDOMClassInfo_Text_id,
00067   eDOMClassInfo_Comment_id,
00068   eDOMClassInfo_CDATASection_id,
00069   eDOMClassInfo_ProcessingInstruction_id,
00070   eDOMClassInfo_Entity_id,
00071   eDOMClassInfo_EntityReference_id,
00072   eDOMClassInfo_Notation_id,
00073   eDOMClassInfo_NodeList_id,
00074   eDOMClassInfo_NamedNodeMap_id,
00075 
00076   // StyleSheet classes
00077   eDOMClassInfo_DocumentStyleSheetList_id,
00078 
00079   // Event classes
00080   eDOMClassInfo_Event_id,
00081   eDOMClassInfo_MutationEvent_id,
00082   eDOMClassInfo_UIEvent_id,
00083   eDOMClassInfo_MouseEvent_id,
00084   eDOMClassInfo_KeyboardEvent_id,
00085   eDOMClassInfo_PopupBlockedEvent_id,
00086 
00087   // HTML classes
00088   eDOMClassInfo_HTMLDocument_id,
00089   eDOMClassInfo_HTMLCollection_id,
00090   eDOMClassInfo_HTMLOptionsCollection_id,
00091   eDOMClassInfo_HTMLFormControlCollection_id,
00092   eDOMClassInfo_HTMLGenericCollection_id,
00093 
00094   // HTML element classes
00095   eDOMClassInfo_HTMLAnchorElement_id,
00096   eDOMClassInfo_HTMLAppletElement_id,
00097   eDOMClassInfo_HTMLAreaElement_id,
00098   eDOMClassInfo_HTMLBRElement_id,
00099   eDOMClassInfo_HTMLBaseElement_id,
00100   eDOMClassInfo_HTMLBaseFontElement_id,
00101   eDOMClassInfo_HTMLBodyElement_id,
00102   eDOMClassInfo_HTMLButtonElement_id,
00103   eDOMClassInfo_HTMLDListElement_id,
00104   eDOMClassInfo_HTMLDelElement_id,
00105   eDOMClassInfo_HTMLDirectoryElement_id,
00106   eDOMClassInfo_HTMLDivElement_id,
00107   eDOMClassInfo_HTMLEmbedElement_id,
00108   eDOMClassInfo_HTMLFieldSetElement_id,
00109   eDOMClassInfo_HTMLFontElement_id,
00110   eDOMClassInfo_HTMLFormElement_id,
00111   eDOMClassInfo_HTMLFrameElement_id,
00112   eDOMClassInfo_HTMLFrameSetElement_id,
00113   eDOMClassInfo_HTMLHRElement_id,
00114   eDOMClassInfo_HTMLHeadElement_id,
00115   eDOMClassInfo_HTMLHeadingElement_id,
00116   eDOMClassInfo_HTMLHtmlElement_id,
00117   eDOMClassInfo_HTMLIFrameElement_id,
00118   eDOMClassInfo_HTMLImageElement_id,
00119   eDOMClassInfo_HTMLInputElement_id,
00120   eDOMClassInfo_HTMLInsElement_id,
00121   eDOMClassInfo_HTMLIsIndexElement_id,
00122   eDOMClassInfo_HTMLLIElement_id,
00123   eDOMClassInfo_HTMLLabelElement_id,
00124   eDOMClassInfo_HTMLLegendElement_id,
00125   eDOMClassInfo_HTMLLinkElement_id,
00126   eDOMClassInfo_HTMLMapElement_id,
00127   eDOMClassInfo_HTMLMenuElement_id,
00128   eDOMClassInfo_HTMLMetaElement_id,
00129   eDOMClassInfo_HTMLModElement_id,
00130   eDOMClassInfo_HTMLOListElement_id,
00131   eDOMClassInfo_HTMLObjectElement_id,
00132   eDOMClassInfo_HTMLOptGroupElement_id,
00133   eDOMClassInfo_HTMLOptionElement_id,
00134   eDOMClassInfo_HTMLParagraphElement_id,
00135   eDOMClassInfo_HTMLParamElement_id,
00136   eDOMClassInfo_HTMLPreElement_id,
00137   eDOMClassInfo_HTMLQuoteElement_id,
00138   eDOMClassInfo_HTMLScriptElement_id,
00139   eDOMClassInfo_HTMLSelectElement_id,
00140   eDOMClassInfo_HTMLSpacerElement_id,
00141   eDOMClassInfo_HTMLSpanElement_id,
00142   eDOMClassInfo_HTMLStyleElement_id,
00143   eDOMClassInfo_HTMLTableCaptionElement_id,
00144   eDOMClassInfo_HTMLTableCellElement_id,
00145   eDOMClassInfo_HTMLTableColElement_id,
00146   eDOMClassInfo_HTMLTableColGroupElement_id,
00147   eDOMClassInfo_HTMLTableElement_id,
00148   eDOMClassInfo_HTMLTableRowElement_id,
00149   eDOMClassInfo_HTMLTableSectionElement_id,
00150   eDOMClassInfo_HTMLTextAreaElement_id,
00151   eDOMClassInfo_HTMLTitleElement_id,
00152   eDOMClassInfo_HTMLUListElement_id,
00153   eDOMClassInfo_HTMLUnknownElement_id,
00154   eDOMClassInfo_HTMLWBRElement_id,
00155 
00156   // CSS classes
00157   eDOMClassInfo_CSSStyleRule_id,
00158   eDOMClassInfo_CSSCharsetRule_id,
00159   eDOMClassInfo_CSSImportRule_id,
00160   eDOMClassInfo_CSSMediaRule_id,
00161   eDOMClassInfo_CSSNameSpaceRule_id,
00162   eDOMClassInfo_CSSRuleList_id,
00163   eDOMClassInfo_CSSGroupRuleRuleList_id,
00164   eDOMClassInfo_MediaList_id,
00165   eDOMClassInfo_StyleSheetList_id,
00166   eDOMClassInfo_CSSStyleSheet_id,
00167   eDOMClassInfo_CSSStyleDeclaration_id,
00168   eDOMClassInfo_ComputedCSSStyleDeclaration_id,
00169   eDOMClassInfo_ROCSSPrimitiveValue_id,
00170 
00171   // Range classes
00172   eDOMClassInfo_Range_id,
00173   eDOMClassInfo_Selection_id,
00174 
00175   // XUL classes
00176 #ifdef MOZ_XUL
00177   eDOMClassInfo_XULDocument_id,
00178   eDOMClassInfo_XULElement_id,
00179   eDOMClassInfo_XULCommandDispatcher_id,
00180   eDOMClassInfo_XULNodeList_id,
00181   eDOMClassInfo_XULNamedNodeMap_id,
00182   eDOMClassInfo_XULAttr_id,
00183 #endif
00184   eDOMClassInfo_XULControllers_id,
00185 #ifdef MOZ_XUL
00186   eDOMClassInfo_BoxObject_id,
00187   eDOMClassInfo_TreeSelection_id,
00188   eDOMClassInfo_TreeContentView_id,
00189 #endif
00190 
00191   // Crypto classes
00192   eDOMClassInfo_Crypto_id,
00193   eDOMClassInfo_CRMFObject_id,
00194   eDOMClassInfo_Pkcs11_id,
00195   
00196   // DOM Traversal classes
00197   eDOMClassInfo_TreeWalker_id,
00198 
00199   // Rect object used by getComputedStyle
00200   eDOMClassInfo_CSSRect_id,
00201 
00202   // DOM Chrome Window class, almost identical to Window
00203   eDOMClassInfo_ChromeWindow_id,
00204 
00205   // RGBColor object used by getComputedStyle
00206   eDOMClassInfo_CSSRGBColor_id,
00207 
00208   eDOMClassInfo_RangeException_id,
00209 
00210   // CSSValueList object that represents an nsIDOMCSSValueList, used
00211   // by DOM CSS
00212   eDOMClassInfo_CSSValueList_id,
00213 
00214   // ContentList object used for various live NodeLists
00215   eDOMClassInfo_ContentList_id,
00216   
00217   // Processing-instruction with target "xml-stylesheet"
00218   eDOMClassInfo_XMLStylesheetProcessingInstruction_id,
00219   
00220   eDOMClassInfo_ImageDocument_id,
00221 
00222 #ifdef MOZ_XUL
00223   eDOMClassInfo_XULTemplateBuilder_id,
00224   eDOMClassInfo_XULTreeBuilder_id,
00225 #endif
00226 
00227   // DOMStringList object
00228   eDOMClassInfo_DOMStringList_id,
00229 
00230   // NameList object used by the DOM
00231   eDOMClassInfo_NameList_id,
00232 
00233 #ifdef MOZ_XUL
00234   eDOMClassInfo_TreeColumn_id,
00235   eDOMClassInfo_TreeColumns_id,
00236 #endif
00237 
00238   eDOMClassInfo_CSSMozDocumentRule_id,
00239 
00240   eDOMClassInfo_BeforeUnloadEvent_id,
00241 
00242 #ifdef MOZ_SVG
00243   // The SVG document
00244   eDOMClassInfo_SVGDocument_id,
00245 
00246   // SVG element classes
00247   eDOMClassInfo_SVGCircleElement_id,
00248   eDOMClassInfo_SVGClipPathElement_id,
00249   eDOMClassInfo_SVGDefsElement_id,
00250   eDOMClassInfo_SVGDescElement_id,
00251   eDOMClassInfo_SVGEllipseElement_id,
00252   eDOMClassInfo_SVGGElement_id,
00253   eDOMClassInfo_SVGGradientElement_id,
00254   eDOMClassInfo_SVGImageElement_id,
00255   eDOMClassInfo_SVGLinearGradientElement_id,
00256   eDOMClassInfo_SVGLineElement_id,
00257   eDOMClassInfo_SVGMarkerElement_id,
00258   eDOMClassInfo_SVGMetadataElement_id,
00259   eDOMClassInfo_SVGPathElement_id,
00260   eDOMClassInfo_SVGPolygonElement_id,
00261   eDOMClassInfo_SVGPolylineElement_id,
00262   eDOMClassInfo_SVGRadialGradientElement_id,
00263   eDOMClassInfo_SVGRectElement_id,
00264   eDOMClassInfo_SVGScriptElement_id,
00265   eDOMClassInfo_SVGStopElement_id,
00266   eDOMClassInfo_SVGStyleElement_id,
00267   eDOMClassInfo_SVGSVGElement_id,
00268   eDOMClassInfo_SVGSymbolElement_id,
00269   eDOMClassInfo_SVGTextElement_id,
00270   eDOMClassInfo_SVGTitleElement_id,
00271   eDOMClassInfo_SVGTSpanElement_id,
00272   eDOMClassInfo_SVGUseElement_id,
00273 
00274   // other SVG classes
00275   eDOMClassInfo_SVGAngle_id,
00276   eDOMClassInfo_SVGAnimatedAngle_id,
00277   eDOMClassInfo_SVGAnimatedEnumeration_id,
00278   eDOMClassInfo_SVGAnimatedLength_id,
00279   eDOMClassInfo_SVGAnimatedLengthList_id,
00280   eDOMClassInfo_SVGAnimatedNumber_id,
00281   eDOMClassInfo_SVGAnimatedNumberList_id,
00282   eDOMClassInfo_SVGAnimatedPoints_id,
00283   eDOMClassInfo_SVGAnimatedPreserveAspectRatio_id,
00284   eDOMClassInfo_SVGAnimatedRect_id,
00285   eDOMClassInfo_SVGAnimatedString_id,
00286   eDOMClassInfo_SVGAnimatedTransformList_id,
00287   eDOMClassInfo_SVGEvent_id,
00288   eDOMClassInfo_SVGException_id,
00289   eDOMClassInfo_SVGLength_id,
00290   eDOMClassInfo_SVGLengthList_id,
00291   eDOMClassInfo_SVGMatrix_id,
00292   eDOMClassInfo_SVGNumber_id,
00293   eDOMClassInfo_SVGNumberList_id,
00294   eDOMClassInfo_SVGPathSegArcAbs_id,
00295   eDOMClassInfo_SVGPathSegArcRel_id,
00296   eDOMClassInfo_SVGPathSegClosePath_id,
00297   eDOMClassInfo_SVGPathSegCurvetoCubicAbs_id,
00298   eDOMClassInfo_SVGPathSegCurvetoCubicRel_id,
00299   eDOMClassInfo_SVGPathSegCurvetoCubicSmoothAbs_id,
00300   eDOMClassInfo_SVGPathSegCurvetoCubicSmoothRel_id,
00301   eDOMClassInfo_SVGPathSegCurvetoQuadraticAbs_id,
00302   eDOMClassInfo_SVGPathSegCurvetoQuadraticRel_id,
00303   eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothAbs_id,
00304   eDOMClassInfo_SVGPathSegCurvetoQuadraticSmoothRel_id,
00305   eDOMClassInfo_SVGPathSegLinetoAbs_id,
00306   eDOMClassInfo_SVGPathSegLinetoHorizontalAbs_id,
00307   eDOMClassInfo_SVGPathSegLinetoHorizontalRel_id,
00308   eDOMClassInfo_SVGPathSegLinetoRel_id,
00309   eDOMClassInfo_SVGPathSegLinetoVerticalAbs_id,
00310   eDOMClassInfo_SVGPathSegLinetoVerticalRel_id,
00311   eDOMClassInfo_SVGPathSegList_id,
00312   eDOMClassInfo_SVGPathSegMovetoAbs_id,
00313   eDOMClassInfo_SVGPathSegMovetoRel_id,
00314   eDOMClassInfo_SVGPoint_id,
00315   eDOMClassInfo_SVGPointList_id,
00316   eDOMClassInfo_SVGPreserveAspectRatio_id,
00317   eDOMClassInfo_SVGRect_id,
00318   eDOMClassInfo_SVGTransform_id,
00319   eDOMClassInfo_SVGTransformList_id,
00320   eDOMClassInfo_SVGZoomEvent_id,
00321 #endif // MOZ_SVG
00322 
00323   // Canvas
00324   eDOMClassInfo_HTMLCanvasElement_id,
00325 #ifdef MOZ_ENABLE_CANVAS
00326   eDOMClassInfo_CanvasRenderingContext2D_id,
00327   eDOMClassInfo_CanvasGradient_id,
00328   eDOMClassInfo_CanvasPattern_id,
00329 #endif
00330   
00331   // SmartCard Events
00332   eDOMClassInfo_SmartCardEvent_id,
00333   
00334   // PageTransition Events
00335   eDOMClassInfo_PageTransitionEvent_id,
00336 
00337   // WhatWG WebApps Objects
00338   eDOMClassInfo_Storage_id,
00339   eDOMClassInfo_StorageList_id,
00340   eDOMClassInfo_StorageItem_id,
00341   eDOMClassInfo_StorageEvent_id,
00342 
00343   eDOMClassInfo_Constructor_id,
00344 
00345 #if defined(MOZ_SVG)
00346   eDOMClassInfo_SVGTextPathElement_id,
00347 #endif
00348 
00349   eDOMClassInfo_WindowRoot_id,
00350 
00351   // DOMParser, XMLSerializer
00352   eDOMClassInfo_DOMParser_id,
00353   eDOMClassInfo_XMLSerializer_id,
00354 
00355   // XMLHttpRequest
00356   eDOMClassInfo_XMLHttpProgressEvent_id,
00357   eDOMClassInfo_XMLHttpRequest_id,
00358 
00359   // We are now trying to preserve binary compat in classinfo.  No more
00360   // putting things in those categories up there.  New entries are to be
00361   // added here, which is the end of the things that are currently on by
00362   // default.
00363 
00364   // Define this near the end so that enabling/disabling foreignobject doesn't
00365   // break binary compatibility
00366 #if defined(MOZ_SVG) && defined(MOZ_SVG_FOREIGNOBJECT)
00367   eDOMClassInfo_SVGForeignObjectElement_id,
00368 #endif
00369 
00370   eDOMClassInfo_XULCommandEvent_id,
00371 
00372   // This one better be the last one in this list
00373   eDOMClassInfoIDCount
00374 };
00375 
00376 #include "nsIXPCScriptable.h"
00377 
00378 #define DEFAULT_SCRIPTABLE_FLAGS                                           \
00379   (nsIXPCScriptable::USE_JSSTUB_FOR_ADDPROPERTY |                          \
00380    nsIXPCScriptable::USE_JSSTUB_FOR_DELPROPERTY |                          \
00381    nsIXPCScriptable::USE_JSSTUB_FOR_SETPROPERTY |                          \
00382    nsIXPCScriptable::ALLOW_PROP_MODS_DURING_RESOLVE |                      \
00383    nsIXPCScriptable::ALLOW_PROP_MODS_TO_PROTOTYPE |                        \
00384    nsIXPCScriptable::DONT_ASK_INSTANCE_FOR_SCRIPTABLE |                    \
00385    nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES |                        \
00386    nsIXPCScriptable::WANT_NEWRESOLVE |                                     \
00387    nsIXPCScriptable::WANT_CHECKACCESS |                                    \
00388    nsIXPCScriptable::WANT_PRECREATE |                                      \
00389    nsIXPCScriptable::WANT_POSTCREATE)
00390 
00391 #define DOM_DEFAULT_SCRIPTABLE_FLAGS                                       \
00392   (DEFAULT_SCRIPTABLE_FLAGS |                                              \
00393    nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE |                           \
00394    nsIXPCScriptable::CLASSINFO_INTERFACES_ONLY)
00395 
00396 
00397 typedef nsIClassInfo* (*nsDOMClassInfoExternalConstructorFnc)
00398   (const char* aName);
00399 
00400 
00405 #define NS_CLASSINFO_MAP_BEGIN(_class)
00406 
00407 #define NS_CLASSINFO_MAP_BEGIN_EXPORTED(_class)
00408 
00409 #define NS_CLASSINFO_MAP_ENTRY(_interface)
00410 
00411 #define NS_CLASSINFO_MAP_ENTRY_FUNCTION(_function)
00412 
00413 #define NS_CLASSINFO_MAP_END
00414 
00415 
00416 #include "nsIServiceManager.h"
00417 #include "nsIDOMScriptObjectFactory.h"
00418 #include "nsDOMCID.h"
00419 
00420 #define NS_INTERFACE_MAP_ENTRY_DOM_CLASSINFO(_class)                       \
00421   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {                             \
00422     static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID);   \
00423                                                                            \
00424     nsresult rv;                                                           \
00425     nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,     \
00426                                                           &rv));           \
00427     if (NS_FAILED(rv)) {                                                   \
00428       *aInstancePtr = nsnull;                                              \
00429       return rv;                                                           \
00430     }                                                                      \
00431                                                                            \
00432     foundInterface =                                                       \
00433       sof->GetClassInfoInstance(eDOMClassInfo_##_class##_id);              \
00434   } else
00435 
00436 // Looks up the nsIClassInfo for a class name registered with the 
00437 // nsScriptNamespaceManager. Remember to release NS_CLASSINFO_NAME(_class)
00438 // (eg. when your module unloads).
00439 #define NS_INTERFACE_MAP_ENTRY_EXTERNAL_DOM_CLASSINFO(_class)              \
00440   if (aIID.Equals(NS_GET_IID(nsIClassInfo))) {                             \
00441     extern nsISupports *NS_CLASSINFO_NAME(_class);                         \
00442     if (NS_CLASSINFO_NAME(_class)) {                                       \
00443       foundInterface = NS_CLASSINFO_NAME(_class);                          \
00444     } else {                                                               \
00445       static NS_DEFINE_CID(kDOMSOF_CID, NS_DOM_SCRIPT_OBJECT_FACTORY_CID); \
00446                                                                            \
00447       nsresult rv;                                                         \
00448       nsCOMPtr<nsIDOMScriptObjectFactory> sof(do_GetService(kDOMSOF_CID,   \
00449                                                             &rv));         \
00450       if (NS_FAILED(rv)) {                                                 \
00451         *aInstancePtr = nsnull;                                            \
00452         return rv;                                                         \
00453       }                                                                    \
00454                                                                            \
00455       foundInterface =                                                     \
00456         sof->GetExternalClassInfoInstance(NS_LITERAL_STRING(#_class));     \
00457                                                                            \
00458       if (foundInterface) {                                                \
00459         NS_CLASSINFO_NAME(_class) = foundInterface;                        \
00460         NS_CLASSINFO_NAME(_class)->AddRef();                               \
00461       }                                                                    \
00462     }                                                                      \
00463   } else
00464 
00465 
00466 #define NS_DECL_DOM_CLASSINFO(_class) \
00467   nsISupports *NS_CLASSINFO_NAME(_class) = nsnull;
00468 
00469 // {891a7b01-1b61-11d6-a7f2-f690b638899c}
00470 #define NS_IDOMCI_EXTENSION_IID  \
00471 { 0x891a7b01, 0x1b61, 0x11d6, \
00472 { 0xa7, 0xf2, 0xf6, 0x90, 0xb6, 0x38, 0x89, 0x9c } }
00473 
00474 class nsIDOMScriptObjectFactory;
00475 
00476 class nsIDOMCIExtension : public nsISupports {
00477 public:  
00478   NS_DEFINE_STATIC_IID_ACCESSOR(NS_IDOMCI_EXTENSION_IID)
00479 
00480   NS_IMETHOD RegisterDOMCI(const char* aName,
00481                            nsIDOMScriptObjectFactory* aDOMSOFactory) = 0;
00482 };
00483 
00484 
00485 #define NS_DOMCI_EXTENSION_NAME(_module) ns##_module##DOMCIExtension
00486 #define NS_DOMCI_EXTENSION_CONSTRUCTOR(_module) \
00487   ns##_module##DOMCIExtensionConstructor
00488 #define NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(_extension) \
00489   NS_GENERIC_FACTORY_CONSTRUCTOR(_extension)
00490 
00491 #define NS_DOMCI_EXTENSION(_module)                                       \
00492 class NS_DOMCI_EXTENSION_NAME(_module) : public nsIDOMCIExtension         \
00493 {                                                                         \
00494 public:                                                                   \
00495   NS_DOMCI_EXTENSION_NAME(_module)();                                     \
00496   virtual ~NS_DOMCI_EXTENSION_NAME(_module)();                            \
00497                                                                           \
00498   NS_DECL_ISUPPORTS                                                       \
00499                                                                           \
00500   NS_IMETHOD RegisterDOMCI(const char* aName,                             \
00501                            nsIDOMScriptObjectFactory* aDOMSOFactory);     \
00502 };                                                                        \
00503                                                                           \
00504 NS_DOMCI_EXTENSION_CONSTRUCTOR_IMP(NS_DOMCI_EXTENSION_NAME(_module))      \
00505                                                                           \
00506 NS_DOMCI_EXTENSION_NAME(_module)::NS_DOMCI_EXTENSION_NAME(_module)()      \
00507 {                                                                         \
00508 }                                                                         \
00509                                                                           \
00510 NS_DOMCI_EXTENSION_NAME(_module)::~NS_DOMCI_EXTENSION_NAME(_module)()     \
00511 {                                                                         \
00512 }                                                                         \
00513                                                                           \
00514 NS_IMPL_ISUPPORTS1(NS_DOMCI_EXTENSION_NAME(_module), nsIDOMCIExtension)   \
00515                                                                           \
00516 NS_IMETHODIMP                                                             \
00517 NS_DOMCI_EXTENSION_NAME(_module)::RegisterDOMCI(const char* aName,        \
00518                                                 nsIDOMScriptObjectFactory* aDOMSOFactory) \
00519 {
00520 
00521 #define NS_DOMCI_EXTENSION_ENTRY_BEGIN(_class)                            \
00522   if (nsCRT::strcmp(aName, #_class) == 0) {                               \
00523     static const nsIID* interfaces[] = {
00524 
00525 #define NS_DOMCI_EXTENSION_ENTRY_INTERFACE(_interface)                    \
00526       &NS_GET_IID(_interface),
00527 
00528 // Don't forget to register the primary interface (_proto) in the 
00529 // JAVASCRIPT_DOM_INTERFACE category, or prototypes for this class
00530 // won't work (except if the interface name starts with nsIDOM).
00531 #define NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, _proto, _hasclassif,  \
00532                                             _constructorcid)              \
00533       nsnull                                                              \
00534     };                                                                    \
00535     aDOMSOFactory->RegisterDOMClassInfo(#_class, nsnull, _proto,          \
00536                                         interfaces,                       \
00537                                         DOM_DEFAULT_SCRIPTABLE_FLAGS,     \
00538                                         _hasclassif, _constructorcid);    \
00539     return NS_OK;                                                         \
00540   }
00541 
00542 #define NS_DOMCI_EXTENSION_ENTRY_END(_class, _proto, _hasclassif,         \
00543                                      _constructorcid)                     \
00544   NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, &NS_GET_IID(_proto),        \
00545                                       _hasclassif, _constructorcid)
00546 
00547 #define NS_DOMCI_EXTENSION_ENTRY_END_NO_PRIMARY_IF(_class, _hasclassif,   \
00548                                                    _constructorcid)       \
00549   NS_DOMCI_EXTENSION_ENTRY_END_HELPER(_class, nsnull, _hasclassif,        \
00550                                       _constructorcid)
00551 
00552 #define NS_DOMCI_EXTENSION_END                                            \
00553   return NS_ERROR_FAILURE;                                                \
00554 }
00555 
00556 
00557 #endif /* nsIDOMClassInfo_h___ */