aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla/MozRegisterComponents.cpp
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-06-19 02:52:03 +0800
committerChristian Persch <chpe@src.gnome.org>2006-06-19 02:52:03 +0800
commitc6573cb04bdc216e7e5ea3657cb1186eaf0f1095 (patch)
tree769cc33a1564a50d1414cb6b6b6f7306c1635840 /embed/mozilla/MozRegisterComponents.cpp
parent0db1af2c76d4cae33992f82a1736f6ed743b7dc1 (diff)
downloadgsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.gz
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.tar.zst
gsoc2013-epiphany-c6573cb04bdc216e7e5ea3657cb1186eaf0f1095.zip
A embed/mozilla/GeckoPrintService.cpp: A
2006-06-18 Christian Persch <chpe@cvs.gnome.org> * configure.ac: * data/default-prefs-common.js: * embed/Makefile.am: * embed/ephy-embed-shell.c: (ephy_embed_shell_dispose), (ephy_embed_shell_set_page_setup), (ephy_embed_shell_get_page_setup), (ephy_embed_shell_set_print_settings), (ephy_embed_shell_get_print_settings): * embed/ephy-embed-shell.h: * embed/mozilla/EphyBrowser.cpp: * embed/mozilla/EphyBrowser.h: * embed/mozilla/EphyUtils.cpp: * embed/mozilla/EphyUtils.h: * embed/mozilla/Makefile.am: A embed/mozilla/GeckoPrintService.cpp: A embed/mozilla/GeckoPrintService.h: A embed/mozilla/GeckoPrintSession.cpp: A embed/mozilla/GeckoPrintSession.h: * embed/mozilla/MozRegisterComponents.cpp: R embed/mozilla/PrintingPromptService.cpp: R embed/mozilla/PrintingPromptService.h: * embed/mozilla/mozilla-embed-single.cpp: R embed/print-dialog.c: R embed/print-dialog.h: * src/ephy-shell.c: (ephy_shell_dispose), (ephy_shell_get_prefs_dialog): * src/ephy-shell.h: * src/epiphany.defs: * src/window-commands.c: (page_setup_done_cb), (window_cmd_file_print_setup): Drop libgnomeprint[ui] and use gtk printing.
Diffstat (limited to 'embed/mozilla/MozRegisterComponents.cpp')
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp111
1 files changed, 75 insertions, 36 deletions
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index b2fb94b02..0ec74ff17 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -29,12 +29,14 @@
#include <nsComponentManagerUtils.h>
#include <nsCOMPtr.h>
+#include <nsCURILoader.h>
#include <nsDocShellCID.h>
#include <nsICategoryManager.h>
#include <nsIComponentManager.h>
#include <nsIComponentRegistrar.h>
#include <nsIGenericFactory.h>
#include <nsILocalFile.h>
+#include <nsIScriptNameSpaceManager.h>
#include <nsIServiceManager.h>
#include <nsMemory.h>
#include <nsNetCID.h>
@@ -53,9 +55,10 @@
#include "EphyContentPolicy.h"
#include "EphyPromptService.h"
#include "EphySidebar.h"
+#include "GeckoPrintService.h"
+#include "GeckoPrintSession.h"
#include "GlobalHistory.h"
#include "MozDownload.h"
-#include "PrintingPromptService.h"
#ifdef ENABLE_FILEPICKER
#include "FilePicker.h"
@@ -77,7 +80,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy)
NS_GENERIC_FACTORY_CONSTRUCTOR(EphyPromptService)
NS_GENERIC_FACTORY_CONSTRUCTOR(EphySidebar)
NS_GENERIC_FACTORY_CONSTRUCTOR(GContentHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService)
+NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoPrintService)
+NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoPrintSession)
NS_GENERIC_FACTORY_CONSTRUCTOR(MozDownload)
NS_GENERIC_FACTORY_CONSTRUCTOR(MozGlobalHistory)
@@ -96,41 +100,48 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSKeyPairDialogs)
NS_GENERIC_FACTORY_CONSTRUCTOR(GtkNSSSecurityWarningDialogs)
#endif
+#define XPINSTALL_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX "application/x-xpinstall"
+
/* class information */
NS_DECL_CLASSINFO(EphySidebar)
-static NS_METHOD
-RegisterContentPolicy(nsIComponentManager *aCompMgr, nsIFile *aPath,
- const char *registryLocation, const char *componentType,
- const nsModuleComponentInfo *info)
+static nsresult
+RegisterCategories (void)
{
- nsCOMPtr<nsICategoryManager> cm =
- do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
- NS_ENSURE_TRUE (cm, NS_ERROR_FAILURE);
-
nsresult rv;
- char *oldval = nsnull;
- rv = cm->AddCategoryEntry ("content-policy",
- EPHY_CONTENT_POLICY_CONTRACTID,
- EPHY_CONTENT_POLICY_CONTRACTID,
- PR_TRUE, PR_TRUE, &oldval);
- if (oldval)
- nsMemory::Free (oldval);
- return rv;
-}
+ nsCOMPtr<nsICategoryManager> catMan =
+ do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
+ NS_ENSURE_SUCCESS (rv, rv);
-static NS_METHOD
-RegisterSidebar(nsIComponentManager *aCompMgr, nsIFile *aPath,
- const char *registryLocation, const char *componentType,
- const nsModuleComponentInfo *info)
-{
- nsCOMPtr<nsICategoryManager> cm =
- do_GetService(NS_CATEGORYMANAGER_CONTRACTID);
- NS_ENSURE_TRUE (cm, NS_ERROR_FAILURE);
+ rv = catMan->AddCategoryEntry ("content-policy",
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ PR_FALSE /* don't persist */,
+ PR_TRUE /* replace */,
+ nsnull);
+
+ rv |= catMan->AddCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
+ "sidebar",
+ NS_SIDEBAR_CONTRACTID,
+ PR_FALSE /* don't persist */,
+ PR_TRUE /* replace */,
+ nsnull);
- return cm->AddCategoryEntry("JavaScript global property",
- "sidebar", NS_SIDEBAR_CONTRACTID,
- PR_FALSE, PR_TRUE, nsnull);
+#ifdef HAVE_GECKO_1_9
+ /* Unregister the XPI install trigger too
+ * Only do it on gecko 1.9 though, because it breaks in 1.8
+ * (because of https://bugzilla.mozilla.org/show_bug.cgi?id=329450)
+ */
+ rv |= catMan->DeleteCategoryEntry (JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY,
+ "InstallVersion",
+ PR_FALSE /* don't persist */);
+ rv |= catMan->DeleteCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
+ "InstallTrigger",
+ PR_FALSE /* don't persist */);
+ NS_ENSURE_SUCCESS (rv, rv);
+#endif
+
+ return rv;
}
static const nsModuleComponentInfo sAppComps[] = {
@@ -197,24 +208,29 @@ static const nsModuleComponentInfo sAppComps[] = {
MozGlobalHistoryConstructor
},
{
- G_PRINTINGPROMPTSERVICE_CLASSNAME,
- G_PRINTINGPROMPTSERVICE_CID,
- G_PRINTINGPROMPTSERVICE_CONTRACTID,
- GPrintingPromptServiceConstructor
+ GECKO_PRINT_SERVICE_CLASSNAME,
+ GECKO_PRINT_SERVICE_IID,
+ "@mozilla.org/embedcomp/printingprompt-service;1",
+ GeckoPrintServiceConstructor
+ },
+ {
+ GECKO_PRINT_SESSION_CLASSNAME,
+ GECKO_PRINT_SESSION_IID,
+ "@mozilla.org/gfx/printsession;1",
+ GeckoPrintSessionConstructor
},
{
EPHY_CONTENT_POLICY_CLASSNAME,
EPHY_CONTENT_POLICY_CID,
EPHY_CONTENT_POLICY_CONTRACTID,
EphyContentPolicyConstructor,
- RegisterContentPolicy
},
{
EPHY_SIDEBAR_CLASSNAME,
EPHY_SIDEBAR_CID,
NS_SIDEBAR_CONTRACTID,
EphySidebarConstructor,
- RegisterSidebar,
+ nsnull /* no register func */,
nsnull /* no unregister func */,
nsnull /* no factory destructor */,
NS_CI_INTERFACE_GETTER_NAME(EphySidebar),
@@ -314,5 +330,28 @@ mozilla_register_components (void)
}
}
+ rv = RegisterCategories();
+ ret = NS_SUCCEEDED (rv);
+
+ /* Unregister xpinstall content handler */
+ nsCID *cidPtr = nsnull;
+ rv = cr->ContractIDToCID (XPINSTALL_CONTRACTID, &cidPtr);
+ if (NS_SUCCEEDED (rv) && cidPtr)
+ {
+ nsCOMPtr<nsIFactory> factory;
+ rv = cm->GetClassObject (*cidPtr, NS_GET_IID (nsIFactory),
+ getter_AddRefs (factory));
+ if (NS_SUCCEEDED (rv))
+ {
+ rv = cr->UnregisterFactory (*cidPtr, factory);
+ }
+
+ nsMemory::Free (cidPtr);
+ }
+ if (NS_FAILED (rv))
+ {
+ g_warning ("Failed to unregister xpinstall content handler!\n");
+ }
+
return ret;
}