Back to index

lightning-sunbird  0.9+nobinonly
nsEmbeddingModule.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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) 2001
00020  * the Initial Developer. All Rights Reserved.
00021  *
00022  * Contributor(s):
00023  *
00024  * Alternatively, the contents of this file may be used under the terms of
00025  * either the GNU General Public License Version 2 or later (the "GPL"), or
00026  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00027  * in which case the provisions of the GPL or the LGPL are applicable instead
00028  * of those above. If you wish to allow use of your version of this file only
00029  * under the terms of either the GPL or the LGPL, and not to allow others to
00030  * use your version of this file under the terms of the MPL, indicate your
00031  * decision by deleting the provisions above and replace them with the notice
00032  * and other provisions required by the GPL or the LGPL. If you do not delete
00033  * the provisions above, a recipient may use your version of this file under
00034  * the terms of any one of the MPL, the GPL or the LGPL.
00035  *
00036  * ***** END LICENSE BLOCK ***** */
00037 
00038 #include "nsIGenericFactory.h"
00039 #include "nsDialogParamBlock.h"
00040 #include "nsPromptService.h"
00041 #include "nsWindowWatcher.h"
00042 #include "nsAppStartupNotifier.h"
00043 #include "nsJSConsoleService.h"
00044 #include "nsFind.h"
00045 #include "nsWebBrowserFind.h"
00046 #include "nsWebBrowserPersist.h"
00047 #include "nsCommandManager.h"
00048 #include "nsControllerCommandTable.h"
00049 #include "nsCommandParams.h"
00050 #include "nsCommandGroup.h"
00051 #ifndef WINCE
00052 #include "nsPrintingPromptService.h"
00053 #endif
00054 #include "nsBaseCommandController.h"
00055 #include "nsPrompt.h"
00056 #include "nsNetCID.h"
00057 #include "nsEmbedCID.h"
00058 
00059 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsWindowWatcher, Init)
00060 NS_GENERIC_FACTORY_CONSTRUCTOR(nsAppStartupNotifier)
00061 NS_GENERIC_FACTORY_CONSTRUCTOR(nsFind)
00062 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserFind)
00063 NS_GENERIC_FACTORY_CONSTRUCTOR(nsWebBrowserPersist)
00064 NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandTable)
00065 NS_GENERIC_FACTORY_CONSTRUCTOR(nsCommandManager)
00066 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsCommandParams, Init)
00067 NS_GENERIC_FACTORY_CONSTRUCTOR(nsControllerCommandGroup)
00068 NS_GENERIC_FACTORY_CONSTRUCTOR(nsBaseCommandController)
00069 
00070 #define NS_DEFAULTPROMPT_CLASSNAME \
00071     "nsDefaultPrompt"
00072 #define NS_DEFAULTPROMPT_CID                         \
00073 { /* 2e41ada0-62b7-4902-b9a6-e4542aa458ba */         \
00074     0x2e41ada0,                                      \
00075     0x62b7,                                          \
00076     0x4902,                                          \
00077     {0xb9, 0xa6, 0xe4, 0x54, 0x2a, 0xa4, 0x58, 0xba} \
00078 }
00079 
00080 #define NS_DEFAULTAUTHPROMPT_CLASSNAME \
00081     "nsDefaultAuthPrompt"
00082 #define NS_DEFAULTAUTHPROMPT_CID                     \
00083 { /* ca200860-4696-40d7-88fa-4490d423a8ef */         \
00084     0xca200860,                                      \
00085     0x4696,                                          \
00086     0x40d7,                                          \
00087     {0x88, 0xfa, 0x44, 0x90, 0xd4, 0x23, 0xa8, 0xef} \
00088 }
00089 
00090 static NS_METHOD
00091 nsDefaultPromptConstructor(nsISupports *outer, const nsIID &iid, void **result)
00092 {
00093   if (outer)
00094     return NS_ERROR_NO_AGGREGATION;
00095 
00096   nsCOMPtr<nsIPrompt> prompt;
00097   nsresult rv = NS_NewPrompter(getter_AddRefs(prompt), nsnull);
00098   if (NS_FAILED(rv))
00099     return rv;
00100 
00101   return prompt->QueryInterface(iid, result);
00102 }
00103 
00104 static NS_METHOD
00105 nsDefaultAuthPromptConstructor(nsISupports *outer, const nsIID &iid, void **result)
00106 {
00107   if (outer)
00108     return NS_ERROR_NO_AGGREGATION;
00109 
00110   nsCOMPtr<nsIAuthPrompt> prompt;
00111   nsresult rv = NS_NewAuthPrompter(getter_AddRefs(prompt), nsnull);
00112   if (NS_FAILED(rv))
00113     return rv;
00114 
00115   return prompt->QueryInterface(iid, result);
00116 }
00117 
00118 #ifdef MOZ_XUL
00119 NS_GENERIC_FACTORY_CONSTRUCTOR(nsDialogParamBlock)
00120 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPromptService, Init)
00121 NS_GENERIC_FACTORY_CONSTRUCTOR(nsJSConsoleService)
00122 #ifndef WINCE
00123 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrintingPromptService, Init)
00124 #endif
00125 #endif
00126 
00127 #ifdef MOZ_PROFILESHARING
00128 #include "nsProfileSharingSetup.h"
00129 NS_GENERIC_FACTORY_CONSTRUCTOR(nsProfileSharingSetup)
00130 #endif
00131 
00132 static const nsModuleComponentInfo gComponents[] = {
00133 
00134 #ifdef MOZ_XUL
00135   { "Dialog ParamBlock", NS_DIALOGPARAMBLOCK_CID, NS_DIALOGPARAMBLOCK_CONTRACTID, nsDialogParamBlockConstructor },
00136   { "Prompt Service", NS_PROMPTSERVICE_CID, NS_PROMPTSERVICE_CONTRACTID, nsPromptServiceConstructor },
00137    { "Nonblocking Alert Service", NS_PROMPTSERVICE_CID, NS_NONBLOCKINGALERTSERVICE_CONTRACTID, nsPromptServiceConstructor },
00138   { "JS Console Service", NS_JSCONSOLESERVICE_CID, NS_JSCONSOLESERVICE_CONTRACTID, nsJSConsoleServiceConstructor },
00139 #ifndef WINCE
00140   { "Printing Prompt Service", NS_PRINTINGPROMPTSERVICE_CID, NS_PRINTINGPROMPTSERVICE_CONTRACTID, nsPrintingPromptServiceConstructor },
00141 #endif
00142 #endif
00143   { "Window Watcher", NS_WINDOWWATCHER_CID, NS_WINDOWWATCHER_CONTRACTID, nsWindowWatcherConstructor },
00144   { "Find",           NS_FIND_CID, NS_FIND_CONTRACTID, nsFindConstructor },
00145   { "WebBrowserFind",           NS_WEB_BROWSER_FIND_CID, NS_WEB_BROWSER_FIND_CONTRACTID, nsWebBrowserFindConstructor },
00146   { NS_APPSTARTUPNOTIFIER_CLASSNAME, NS_APPSTARTUPNOTIFIER_CID, NS_APPSTARTUPNOTIFIER_CONTRACTID, nsAppStartupNotifierConstructor },
00147   { "WebBrowserPersist Component", NS_WEBBROWSERPERSIST_CID, NS_WEBBROWSERPERSIST_CONTRACTID, nsWebBrowserPersistConstructor },
00148   { "Controller Command Table", NS_CONTROLLERCOMMANDTABLE_CID, NS_CONTROLLERCOMMANDTABLE_CONTRACTID, nsControllerCommandTableConstructor },
00149   { "Command Manager", NS_COMMAND_MANAGER_CID, NS_COMMAND_MANAGER_CONTRACTID, nsCommandManagerConstructor },
00150   { "Command Params", NS_COMMAND_PARAMS_CID, NS_COMMAND_PARAMS_CONTRACTID, nsCommandParamsConstructor },
00151   { "Command Group", NS_CONTROLLER_COMMAND_GROUP_CID, NS_CONTROLLER_COMMAND_GROUP_CONTRACTID, nsControllerCommandGroupConstructor },
00152   { "Base Command Controller", NS_BASECOMMANDCONTROLLER_CID, NS_BASECOMMANDCONTROLLER_CONTRACTID, nsBaseCommandControllerConstructor },
00153   { NS_DEFAULTPROMPT_CLASSNAME, NS_DEFAULTPROMPT_CID, NS_DEFAULTPROMPT_CONTRACTID, nsDefaultPromptConstructor },
00154   { NS_DEFAULTAUTHPROMPT_CLASSNAME, NS_DEFAULTAUTHPROMPT_CID, NS_DEFAULTAUTHPROMPT_CONTRACTID, nsDefaultAuthPromptConstructor }
00155 #ifdef MOZ_PROFILESHARING
00156   ,{ "Profile Sharing Setup", NS_PROFILESHARINGSETUP_CID, NS_PROFILESHARINGSETUP_CONTRACTID, nsProfileSharingSetupConstructor }
00157 #endif
00158 };
00159 
00160 NS_IMPL_NSGETMODULE(embedcomponents, gComponents)