aboutsummaryrefslogtreecommitdiffstats
path: root/embed/mozilla
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2006-09-17 05:20:36 +0800
committerChristian Persch <chpe@src.gnome.org>2006-09-17 05:20:36 +0800
commitba8b944c562fc183de39bdec84f05e90f98df6e2 (patch)
tree5f8682559a663b14711bfb090b9ee3fb60768ae8 /embed/mozilla
parente278c85d5790580a97946d3551d99b6636fef992 (diff)
downloadgsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar.gz
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar.bz2
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar.lz
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar.xz
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.tar.zst
gsoc2013-epiphany-ba8b944c562fc183de39bdec84f05e90f98df6e2.zip
Remove ill-conceived attempt at uninstalling the XPInstall handler, and
2006-09-16 Christian Persch <chpe@cvs.gnome.org> * embed/mozilla/EphyContentPolicy.cpp: * embed/mozilla/EphyContentPolicy.h: * embed/mozilla/EphySidebar.cpp: * embed/mozilla/EphySidebar.h: * embed/mozilla/MozRegisterComponents.cpp: Remove ill-conceived attempt at uninstalling the XPInstall handler, and move category registration to the classes that are being registered.
Diffstat (limited to 'embed/mozilla')
-rw-r--r--embed/mozilla/EphyContentPolicy.cpp44
-rw-r--r--embed/mozilla/EphyContentPolicy.h36
-rw-r--r--embed/mozilla/EphySidebar.cpp46
-rw-r--r--embed/mozilla/EphySidebar.h24
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp72
5 files changed, 143 insertions, 79 deletions
diff --git a/embed/mozilla/EphyContentPolicy.cpp b/embed/mozilla/EphyContentPolicy.cpp
index 56be892fd..77a519154 100644
--- a/embed/mozilla/EphyContentPolicy.cpp
+++ b/embed/mozilla/EphyContentPolicy.cpp
@@ -25,12 +25,15 @@
#include <nsStringAPI.h>
#include <nsCOMPtr.h>
+#include <nsICategoryManager.h>
#include <nsIDOMAbstractView.h>
#include <nsIDOMDocument.h>
#include <nsIDOMDocumentView.h>
#include <nsIDOMNode.h>
#include <nsIDOMWindow.h>
#include <nsIURI.h>
+#include <nsServiceManagerUtils.h>
+#include <nsXPCOMCID.h>
#include "eel-gconf-extensions.h"
#include "ephy-adblock-manager.h"
@@ -197,3 +200,44 @@ EphyContentPolicy::ShouldProcess(PRUint32 aContentType,
*aDecision = nsIContentPolicy::ACCEPT;
return NS_OK;
}
+
+
+/* static */ NS_METHOD
+EphyContentPolicy::Register (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const char* aComponentType,
+ const nsModuleComponentInfo* aInfo)
+{
+ nsresult rv;
+ nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = catMan->AddCategoryEntry ("content-policy",
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ PR_FALSE /* don't persist */,
+ PR_TRUE /* replace */,
+ nsnull);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ return rv;
+}
+
+/* static */ NS_METHOD
+EphyContentPolicy::Unregister (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const nsModuleComponentInfo* aInfo)
+{
+ nsresult rv;
+ nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = catMan->DeleteCategoryEntry ("content-policy",
+ EPHY_CONTENT_POLICY_CONTRACTID,
+ PR_FALSE /* don't persist */);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ return rv;
+}
diff --git a/embed/mozilla/EphyContentPolicy.h b/embed/mozilla/EphyContentPolicy.h
index 52f381a32..96f98374c 100644
--- a/embed/mozilla/EphyContentPolicy.h
+++ b/embed/mozilla/EphyContentPolicy.h
@@ -24,11 +24,16 @@
#include <glib.h>
#include <glib-object.h>
+#include <gtk/gtkwidget.h>
#include <nsIContentPolicy.h>
#include "ephy-embed.h"
+class nsIComponentManager;
+class nsIFile;
+struct nsModuleComponentInfo;
+
#define EPHY_CONTENT_POLICY_CONTRACTID "@gnome.org/projects/epiphany/epiphany-content-policy;1"
#define EPHY_CONTENT_POLICY_CLASSNAME "Epiphany Content Policy Class"
@@ -42,17 +47,30 @@
class EphyContentPolicy : public nsIContentPolicy
{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSICONTENTPOLICY
+ public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSICONTENTPOLICY
- EphyContentPolicy();
- virtual ~EphyContentPolicy();
-private:
- static GtkWidget *GetEmbedFromContext (nsISupports *aContext);
+ EphyContentPolicy();
+
+ static NS_METHOD Register (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const char* aComponentType,
+ const nsModuleComponentInfo* aInfo);
+
+ static NS_METHOD Unregister (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const nsModuleComponentInfo* aInfo);
+
+ private:
+ ~EphyContentPolicy();
+
+ static GtkWidget *GetEmbedFromContext (nsISupports *aContext);
- gboolean mLocked;
- GSList *mSafeProtocols;
+ gboolean mLocked;
+ GSList *mSafeProtocols;
};
#endif
diff --git a/embed/mozilla/EphySidebar.cpp b/embed/mozilla/EphySidebar.cpp
index 5e6025190..77dd16a1c 100644
--- a/embed/mozilla/EphySidebar.cpp
+++ b/embed/mozilla/EphySidebar.cpp
@@ -24,7 +24,11 @@
#include <nsStringAPI.h>
+#include <nsICategoryManager.h>
+#include <nsIScriptNameSpaceManager.h>
#include <nsMemory.h>
+#include <nsServiceManagerUtils.h>
+#include <nsXPCOMCID.h>
#ifdef HAVE_GECKO_1_9
#include <nsIClassInfoImpl.h>
@@ -58,6 +62,7 @@ EphySidebar::AddPanel (const PRUnichar *aTitle,
nsCString title;
EphyEmbedSingle *single;
+ /* FIXME: length-limit string */
NS_UTF16ToCString (nsDependentString(aTitle),
NS_CSTRING_ENCODING_UTF8, title);
@@ -96,6 +101,7 @@ EphySidebar::AddSearchEngine (const char *aEngineURL,
nsCString title;
EphyEmbedSingle *single;
+ /* FIXME: length-limit string */
NS_UTF16ToCString (nsDependentString(aSuggestedTitle),
NS_CSTRING_ENCODING_UTF8, title);
@@ -120,3 +126,43 @@ EphySidebar::AddMicrosummaryGenerator (const char *generatorURL)
}
#endif /* HAVE_GECKO_1_9 */
+
+/* static */ NS_METHOD
+EphySidebar::Register (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const char* aComponentType,
+ const nsModuleComponentInfo* aInfo)
+{
+ nsresult rv;
+ nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = catMan->AddCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
+ "sidebar",
+ NS_SIDEBAR_CONTRACTID,
+ PR_FALSE /* don't persist */,
+ PR_TRUE /* replace */,
+ nsnull);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ return rv;
+}
+
+/* static */ NS_METHOD
+EphySidebar::Unregister (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const nsModuleComponentInfo* aInfo)
+{
+ nsresult rv;
+ nsCOMPtr<nsICategoryManager> catMan (do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv));
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ rv = catMan->DeleteCategoryEntry (JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY,
+ "sidebar",
+ PR_FALSE /* don't persist */);
+ NS_ENSURE_SUCCESS (rv, rv);
+
+ return rv;
+}
diff --git a/embed/mozilla/EphySidebar.h b/embed/mozilla/EphySidebar.h
index be611d486..1eca053cb 100644
--- a/embed/mozilla/EphySidebar.h
+++ b/embed/mozilla/EphySidebar.h
@@ -24,6 +24,10 @@
#include <nsISidebar.h>
+class nsIComponentManager;
+class nsIFile;
+struct nsModuleComponentInfo;
+
#define EPHY_SIDEBAR_CLASSNAME \
"Epiphany's Sidebar Implementation"
@@ -38,12 +42,24 @@
class EphySidebar : public nsISidebar
{
public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSISIDEBAR
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISIDEBAR
+
+ EphySidebar();
+
+ static NS_METHOD Register (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const char* aComponentType,
+ const nsModuleComponentInfo* aInfo);
+
+ static NS_METHOD Unregister (nsIComponentManager* aComponentManager,
+ nsIFile* aPath,
+ const char* aRegistryLocation,
+ const nsModuleComponentInfo* aInfo);
- EphySidebar();
- virtual ~EphySidebar();
private:
+ ~EphySidebar();
};
#endif /* ! EPHY_SIDEBAR_H */
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index a811fad3b..eb6411f53 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -1,7 +1,7 @@
/*
* Copyright © 2001,2002,2003 Philip Langdale
* Copyright © 2003 Marco Pesenti Gritti
- * Copyright © 2004, 2005 Christian Persch
+ * Copyright © 2004, 2005, 2006 Christian Persch
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -107,44 +107,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GeckoFormSigningDialog)
/* class information */
NS_DECL_CLASSINFO(EphySidebar)
-static nsresult
-RegisterCategories (void)
-{
- nsresult rv;
- nsCOMPtr<nsICategoryManager> catMan =
- do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
- NS_ENSURE_SUCCESS (rv, rv);
-
- 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);
-
-#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;
-}
+/* FIXME: uninstall XPI handler */
static const nsModuleComponentInfo sAppComps[] = {
{
@@ -250,14 +213,16 @@ static const nsModuleComponentInfo sAppComps[] = {
EPHY_CONTENT_POLICY_CID,
EPHY_CONTENT_POLICY_CONTRACTID,
EphyContentPolicyConstructor,
+ EphyContentPolicy::Register,
+ EphyContentPolicy::Unregister
},
{
EPHY_SIDEBAR_CLASSNAME,
EPHY_SIDEBAR_CID,
NS_SIDEBAR_CONTRACTID,
EphySidebarConstructor,
- nsnull /* no register func */,
- nsnull /* no unregister func */,
+ EphySidebar::Register,
+ EphySidebar::Unregister,
nsnull /* no factory destructor */,
NS_CI_INTERFACE_GETTER_NAME(EphySidebar),
nsnull /* no language helper */,
@@ -356,30 +321,5 @@ mozilla_register_components (void)
}
}
- rv = RegisterCategories();
- ret = NS_SUCCEEDED (rv);
-
-#ifdef HAVE_GECKO_1_9
- /* 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");
- }
-#endif
-
return ret;
}