aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@web.de>2004-05-07 20:42:05 +0800
committerChristian Persch <chpe@src.gnome.org>2004-05-07 20:42:05 +0800
commitd6030231393e5370d8658f47de8e9ce9d990990f (patch)
treea06572bd8707a5f1e6385fbc7945882366562c59
parent1648fd61276201aaa49456ed17007b34d6d06b38 (diff)
downloadgsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar.gz
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar.bz2
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar.lz
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar.xz
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.tar.zst
gsoc2013-epiphany-d6030231393e5370d8658f47de8e9ce9d990990f.zip
Eliminate ExternalProtocolHandlers in favor of setting prefs to make
2004-04-18 Christian Biesinger <cbiesinger@web.de> * embed/mozilla/ExternalProtocolHandlers.cpp: * embed/mozilla/ExternalProtocolHandlers.h: * embed/mozilla/Makefile.am: * embed/mozilla/MozRegisterComponents.cpp: * embed/mozilla/MozRegisterComponents.h: * embed/mozilla/mozilla-embed-single.cpp: Eliminate ExternalProtocolHandlers in favor of setting prefs to make Mozilla not handle the protocols internally. (Backported from HEAD.)
-rw-r--r--ChangeLog12
-rw-r--r--embed/mozilla/ExternalProtocolHandlers.cpp195
-rw-r--r--embed/mozilla/ExternalProtocolHandlers.h154
-rw-r--r--embed/mozilla/Makefile.am2
-rw-r--r--embed/mozilla/MozRegisterComponents.cpp119
-rw-r--r--embed/mozilla/MozRegisterComponents.h10
-rw-r--r--embed/mozilla/mozilla-embed-single.cpp32
7 files changed, 30 insertions, 494 deletions
diff --git a/ChangeLog b/ChangeLog
index e8f472a56..839e8a4cd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2004-04-18 Christian Biesinger <cbiesinger@web.de>
+
+ * embed/mozilla/ExternalProtocolHandlers.cpp:
+ * embed/mozilla/ExternalProtocolHandlers.h:
+ * embed/mozilla/Makefile.am:
+ * embed/mozilla/MozRegisterComponents.cpp:
+ * embed/mozilla/MozRegisterComponents.h:
+ * embed/mozilla/mozilla-embed-single.cpp:
+
+ Eliminate ExternalProtocolHandlers in favor of setting prefs to make Mozilla
+ not handle the protocols internally. (Backported from HEAD.)
+
2004-05-06 Christian Persch <chpe@cvs.gnome.org>
* configure.in:
diff --git a/embed/mozilla/ExternalProtocolHandlers.cpp b/embed/mozilla/ExternalProtocolHandlers.cpp
deleted file mode 100644
index 8f85f2c01..000000000
--- a/embed/mozilla/ExternalProtocolHandlers.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * Copyright (C) 2001 Philip Langdale
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include "ExternalProtocolHandlers.h"
-#include "nsCOMPtr.h"
-#include "nsIComponentManager.h"
-#include "nsIURI.h"
-#include "nsCOMPtr.h"
-#include "nsIChannel.h"
-#include "nsIStorageStream.h"
-#include "nsIInputStream.h"
-#include "nsIOutputStream.h"
-#include "nsNetUtil.h"
-#include "nsIExternalProtocolService.h"
-#include "nsCExternalHandlerService.h"
-
-NS_IMPL_ISUPPORTS2 (GIRCProtocolHandler, nsIProtocolHandler, nsIContentHandler)
-NS_IMPL_ISUPPORTS2 (GFtpProtocolHandler, nsIProtocolHandler, nsIContentHandler)
-NS_IMPL_ISUPPORTS2 (GMailtoProtocolHandler, nsIProtocolHandler, nsIContentHandler)
-NS_IMPL_ISUPPORTS2 (GNewsProtocolHandler, nsIProtocolHandler, nsIContentHandler)
-
-static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
-
-/* Implementation file */
-NS_IMPL_ISUPPORTS1 (GBaseProtocolHandler, nsIProtocolHandler)
-
-GBaseProtocolHandler::GBaseProtocolHandler(const char *aScheme)
-{
- mScheme.Assign(aScheme);
-}
-
-GBaseProtocolHandler::~GBaseProtocolHandler()
-{
-}
-
-/* readonly attribute string scheme; */
-NS_IMETHODIMP GBaseProtocolHandler::GetScheme(nsACString &aScheme)
-{
- aScheme = mScheme;
- return NS_OK;
-}
-
-/* readonly attribute long defaultPort; */
-NS_IMETHODIMP GBaseProtocolHandler::GetDefaultPort(PRInt32 *aDefaultPort)
-{
- if (aDefaultPort)
- *aDefaultPort = -1;
- else
- return NS_ERROR_NULL_POINTER;
- return NS_OK;
-}
-
-/* readonly attribute short protocolFlags; */
-NS_IMETHODIMP GBaseProtocolHandler::GetProtocolFlags(PRUint32 *aProtocolFlags)
-{
- if (aProtocolFlags)
- *aProtocolFlags = nsIProtocolHandler::URI_STD;
- else
- return NS_ERROR_NULL_POINTER;
- return NS_OK;
-}
-
-/* nsIURI newURI (in string aSpec, in nsIURI aBaseURI); */
-NS_IMETHODIMP GBaseProtocolHandler::NewURI(const nsACString &aSpec,
- const char *aOriginCharset, nsIURI *aBaseURI,
- nsIURI **_retval)
-{
- nsresult rv = NS_OK;
- nsCOMPtr <nsIURI> newUri;
-
- rv = nsComponentManager::CreateInstance(kSimpleURICID, nsnull,
- NS_GET_IID(nsIURI),
- getter_AddRefs(newUri));
-
- if (NS_SUCCEEDED(rv))
- {
- newUri->SetSpec(aSpec);
- rv = newUri->QueryInterface(NS_GET_IID(nsIURI),
- (void **) _retval);
- }
- return rv;
-
-}
-
-/* nsIChannel newChannel (in nsIURI aURI); */
-NS_IMETHODIMP GBaseProtocolHandler::NewChannel(nsIURI *aURI,
- nsIChannel **_retval)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-/* boolean allowPort (in long port, in string scheme); */
-NS_IMETHODIMP GBaseProtocolHandler::AllowPort(PRInt32 port, const char *scheme,
- PRBool *_retval)
-{
- *_retval = PR_FALSE;
- return NS_OK;
-}
-
-/* Implementation file */
-NS_IMPL_ISUPPORTS2 (GBaseProtocolContentHandler, nsIProtocolHandler, nsIContentHandler)
-
-GBaseProtocolContentHandler::GBaseProtocolContentHandler(const char *aScheme) :
- GBaseProtocolHandler(aScheme)
-{
- mMimeType = NS_LITERAL_CSTRING("application-x-gnome-") + mScheme;
-}
-
-GBaseProtocolContentHandler::~GBaseProtocolContentHandler()
-{
-}
-
-/* nsIChannel newChannel (in nsIURI aURI); */
-NS_IMETHODIMP GBaseProtocolContentHandler::NewChannel(nsIURI *aURI,
- nsIChannel **_retval)
-{
- nsresult rv;
- nsCOMPtr<nsIStorageStream> sStream;
- rv = NS_NewStorageStream(1, 16, getter_AddRefs(sStream));
- NS_ENSURE_SUCCESS (rv, rv);
-
- nsCOMPtr<nsIOutputStream> oStream;
- rv = sStream->GetOutputStream(0, getter_AddRefs(oStream));
- NS_ENSURE_SUCCESS (rv, rv);
-
- PRUint32 bytes;
- rv = oStream->Write("Dummy stream\0", 13, &bytes);
- NS_ENSURE_SUCCESS (rv, rv);
-
- nsCOMPtr<nsIInputStream> iStream;
- rv = sStream->NewInputStream(0, getter_AddRefs(iStream));
- NS_ENSURE_SUCCESS (rv, rv);
-
- nsCOMPtr<nsIChannel> channel;
- rv = NS_NewInputStreamChannel(getter_AddRefs(channel), aURI,
- iStream, mMimeType, NS_LITERAL_CSTRING(""));
- NS_ENSURE_SUCCESS (rv, rv);
-
- NS_IF_ADDREF (*_retval = channel);
-
- return rv;
-}
-
-NS_IMETHODIMP GBaseProtocolContentHandler::HandleContent (
- const char * aContentType,
- const char * aCommand,
- nsISupports * aWindowContext,
- nsIRequest *aRequest)
-{
- NS_ENSURE_ARG (aRequest);
-
- nsresult rv = NS_OK;
-
- // First of all, get the content type and make sure it is a
- // content type we know how to handle!
- if (mMimeType.Equals(aContentType))
- {
- nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
- NS_ENSURE_TRUE (channel, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIURI> uri;
- channel->GetURI(getter_AddRefs(uri));
- NS_ENSURE_TRUE (uri, NS_ERROR_FAILURE);
-
- rv = aRequest->Cancel(NS_BINDING_ABORTED);
- NS_ENSURE_SUCCESS (rv, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIExternalProtocolService> ps =
- do_GetService (NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
- NS_ENSURE_TRUE (ps, NS_ERROR_FAILURE);
-
- rv = ps->LoadUrl (uri);
- }
-
- return rv;
-}
diff --git a/embed/mozilla/ExternalProtocolHandlers.h b/embed/mozilla/ExternalProtocolHandlers.h
deleted file mode 100644
index 027556d5e..000000000
--- a/embed/mozilla/ExternalProtocolHandlers.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright (C) 2001 Philip Langdale
- *
- * 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
- * the Free Software Foundation; either version 2, or (at your option)
- * any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- */
-
-/* We are registering protocol handlers for news, mailto and irc
- because mozilla load all modules on startup, so if you have these
- components installed it will try to use them as protocol handlers.
- Our implementation just forward to external protocol service.
- Ftp is a special case, it can be handled by mozilla but we
- want to use an external client when one is configured in GNOME
- handlers.
- IMPORTANT: there is no need to register handlers for other protocols
- here. Once they are configured in GNOME, they will just work.
-*/
-
-#ifndef EXTERNAL_PROTOCOL_HANDLERS
-#define EXTERNAL_PROTOCOL_HANDLERS
-
-#include "nsError.h"
-#include "nsIContentHandler.h"
-#include "nsIProtocolHandler.h"
-#include "nsCURILoader.h"
-#include "nsString.h"
-
-class GBaseProtocolHandler : public nsIProtocolHandler
-{
- public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIPROTOCOLHANDLER
-
- GBaseProtocolHandler (const char *aScheme);
- virtual ~GBaseProtocolHandler();
- protected:
- nsCString mScheme;
-};
-
-class GBaseProtocolContentHandler : public GBaseProtocolHandler,
- public nsIContentHandler
-{
- public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSICONTENTHANDLER
-
- NS_IMETHODIMP NewChannel(nsIURI *aURI, nsIChannel **_retval);
-
- GBaseProtocolContentHandler (const char *aScheme);
- virtual ~GBaseProtocolContentHandler();
- protected:
- nsCString mMimeType;
-};
-
-#define G_IRC_PROTOCOL_CID \
-{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4e */ \
- 0xaabe33d3, \
- 0x7455, \
- 0x4d8f, \
- {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4e} \
-}
-#define G_IRC_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "irc"
-#define G_IRC_PROTOCOL_CLASSNAME "Epiphany's irc Protocol Handler"
-#define G_IRC_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
- "application-x-gnome-irc"
-#define G_IRC_CONTENT_CLASSNAME "Epiphany's irc Content Handler"
-
-class GIRCProtocolHandler : public GBaseProtocolContentHandler
-{
- public:
- NS_DECL_ISUPPORTS
-
- GIRCProtocolHandler() : GBaseProtocolContentHandler("irc") {};
- virtual ~GIRCProtocolHandler() {};
-};
-
-#define G_FTP_PROTOCOL_CID \
-{ /* 5a48bdf4-a422-4eb4-b073-0fc3bee8e670 */ \
- 0x5a48bdf4, \
- 0xa422, \
- 0x4eb4, \
- {0xb0, 0x73, 0x0f, 0xc3, 0xbe, 0xe8, 0xe6, 0x70} \
-}
-#define G_FTP_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ftp"
-#define G_FTP_PROTOCOL_CLASSNAME "Epiphany's FTP Protocol Handler"
-#define G_FTP_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
- "application-x-gnome-ftp"
-#define G_FTP_CONTENT_CLASSNAME "Epiphany's FTP Content Handler"
-
-class GFtpProtocolHandler : public GBaseProtocolContentHandler
-{
- public:
- NS_DECL_ISUPPORTS
- GFtpProtocolHandler() : GBaseProtocolContentHandler("ftp") {};
- virtual ~GFtpProtocolHandler() {};
-};
-
-#define G_MAILTO_PROTOCOL_CID \
-{ /* aabe33d3-7455-4d8f-87e7-43e4541ace4d */ \
- 0xaabe33d3, \
- 0x7455, \
- 0x4d8f, \
- {0x87, 0xe7, 0x43, 0xe4, 0x54, 0x1a, 0xce, 0x4d} \
-}
-#define G_MAILTO_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "mailto"
-#define G_MAILTO_PROTOCOL_CLASSNAME "Epiphany's mailto Protocol Handler"
-#define G_MAILTO_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
- "application-x-gnome-mailto"
-#define G_MAILTO_CONTENT_CLASSNAME "Epiphany's mailto Content Handler"
-
-class GMailtoProtocolHandler : public GBaseProtocolContentHandler
-{
- public:
- NS_DECL_ISUPPORTS
- GMailtoProtocolHandler() : GBaseProtocolContentHandler("mailto") {};
- virtual ~GMailtoProtocolHandler() {};
- private:
-};
-
-#define G_NEWS_PROTOCOL_CID \
-{ /* 3583f8f9-abc7-4ff0-84cb-0eefcaec99f8 */ \
- 0x3583f8f9, \
- 0xabc7, \
- 0x4ff0, \
- {0x84, 0xcb, 0x0e, 0xef, 0xca, 0xec, 0x99, 0xf8} \
-}
-#define G_NEWS_PROTOCOL_CONTRACTID NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "news"
-#define G_NEWS_PROTOCOL_CLASSNAME "Epiphany's news Protocol Handler"
-#define G_NEWS_CONTENT_CONTRACTID NS_CONTENT_HANDLER_CONTRACTID_PREFIX \
- "application-x-gnome-news"
-#define G_NEWS_CONTENT_CLASSNAME "Epiphany's news Content Handler"
-
-class GNewsProtocolHandler : public GBaseProtocolContentHandler
-{
- public:
- NS_DECL_ISUPPORTS
-
- GNewsProtocolHandler() : GBaseProtocolContentHandler("news") {};
- virtual ~GNewsProtocolHandler() {};
- private:
-};
-
-#endif /* EXTERNAL_PROTOCOL_HANDLERS */
diff --git a/embed/mozilla/Makefile.am b/embed/mozilla/Makefile.am
index 1a943ecbc..16016a89f 100644
--- a/embed/mozilla/Makefile.am
+++ b/embed/mozilla/Makefile.am
@@ -63,8 +63,6 @@ libephymozillaembed_la_SOURCES = \
EphySingle.h \
EventContext.cpp \
EventContext.h \
- ExternalProtocolHandlers.cpp \
- ExternalProtocolHandlers.h \
ExternalProtocolService.cpp \
ExternalProtocolService.h \
FilePicker.cpp \
diff --git a/embed/mozilla/MozRegisterComponents.cpp b/embed/mozilla/MozRegisterComponents.cpp
index 308098460..f475f51b2 100644
--- a/embed/mozilla/MozRegisterComponents.cpp
+++ b/embed/mozilla/MozRegisterComponents.cpp
@@ -26,7 +26,6 @@
#include "ContentHandler.h"
#include "FilePicker.h"
#include "GlobalHistory.h"
-#include "ExternalProtocolHandlers.h"
#include "PrintingPromptService.h"
#include "MozDownload.h"
#include "ExternalProtocolService.h"
@@ -57,10 +56,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(GFilePicker)
NS_GENERIC_FACTORY_CONSTRUCTOR(GContentHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(MozGlobalHistory)
NS_GENERIC_FACTORY_CONSTRUCTOR(GPrintingPromptService)
-NS_GENERIC_FACTORY_CONSTRUCTOR(GIRCProtocolHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(GFtpProtocolHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(GNewsProtocolHandler)
-NS_GENERIC_FACTORY_CONSTRUCTOR(GMailtoProtocolHandler)
NS_GENERIC_FACTORY_CONSTRUCTOR(EphyContentPolicy)
#if MOZILLA_SNAPSHOT < 12
@@ -159,36 +154,6 @@ static const nsModuleComponentInfo sAppComps[] = {
GPrintingPromptServiceConstructor
},
{
- G_IRC_PROTOCOL_CLASSNAME,
- G_IRC_PROTOCOL_CID,
- G_IRC_PROTOCOL_CONTRACTID,
- GIRCProtocolHandlerConstructor
- },
- {
- G_IRC_CONTENT_CLASSNAME,
- G_IRC_PROTOCOL_CID,
- G_IRC_CONTENT_CONTRACTID,
- GIRCProtocolHandlerConstructor
- },
- {
- G_NEWS_PROTOCOL_CLASSNAME,
- G_NEWS_PROTOCOL_CID,
- G_NEWS_PROTOCOL_CONTRACTID,
- GNewsProtocolHandlerConstructor
- },
- {
- G_NEWS_CONTENT_CLASSNAME,
- G_NEWS_PROTOCOL_CID,
- G_NEWS_CONTENT_CONTRACTID,
- GNewsProtocolHandlerConstructor
- },
- {
- G_FTP_CONTENT_CLASSNAME,
- G_FTP_PROTOCOL_CID,
- G_FTP_CONTENT_CONTRACTID,
- GFtpProtocolHandlerConstructor
- },
- {
EPHY_ABOUT_REDIRECTOR_CLASSNAME,
EPHY_ABOUT_REDIRECTOR_CID,
EPHY_ABOUT_REDIRECTOR_EPIPHANY_CONTRACTID,
@@ -207,18 +172,6 @@ static const nsModuleComponentInfo sAppComps[] = {
EphyAboutRedirectorConstructor
},
{
- G_MAILTO_PROTOCOL_CLASSNAME,
- G_MAILTO_PROTOCOL_CID,
- G_MAILTO_PROTOCOL_CONTRACTID,
- GMailtoProtocolHandlerConstructor
- },
- {
- G_MAILTO_CONTENT_CLASSNAME,
- G_MAILTO_PROTOCOL_CID,
- G_MAILTO_CONTENT_CONTRACTID,
- GMailtoProtocolHandlerConstructor
- },
- {
EPHY_CONTENT_POLICY_CLASSNAME,
EPHY_CONTENT_POLICY_CID,
EPHY_CONTENT_POLICY_CONTRACTID,
@@ -227,18 +180,6 @@ static const nsModuleComponentInfo sAppComps[] = {
},
};
-static const nsModuleComponentInfo sFtpComps = {
- G_FTP_PROTOCOL_CLASSNAME,
- G_FTP_PROTOCOL_CID,
- G_FTP_PROTOCOL_CONTRACTID,
- GFtpProtocolHandlerConstructor
-};
-
-static NS_DEFINE_CID(knsFtpProtocolHandlerCID, NS_FTPPROTOCOLHANDLER_CID);
-
-/* Annoying globals to track the mozilla ftp handler so it can be restored. */
-static PRBool ftpRegistered = PR_FALSE;
-static nsCOMPtr<nsIFactory> nsFtpFactory;
gboolean
mozilla_register_components (void)
@@ -293,64 +234,4 @@ mozilla_register_components (void)
return ret;
}
-/**
- * mozilla_register_FtpProtocolHandler: Register Ftp Protocol Handler
- */
-gboolean
-mozilla_register_FtpProtocolHandler (void)
-{
- if (ftpRegistered == PR_TRUE) return TRUE;
- nsresult rv;
-
- nsCOMPtr<nsIComponentManager> cm;
- NS_GetComponentManager(getter_AddRefs(cm));
- NS_ENSURE_TRUE (cm, FALSE);
-
- rv = cm->GetClassObject(knsFtpProtocolHandlerCID,
- NS_GET_IID(nsIFactory),
- getter_AddRefs(nsFtpFactory));
- if (NS_FAILED (rv)) return FALSE;
-
- nsCOMPtr<nsIGenericFactory> ftpFactory;
- NS_NewGenericFactory(getter_AddRefs(ftpFactory), &sFtpComps);
- NS_ENSURE_TRUE (ftpFactory, FALSE);
-
- nsCOMPtr<nsIComponentRegistrar> cr;
- NS_GetComponentRegistrar(getter_AddRefs(cr));
- NS_ENSURE_TRUE (cr, FALSE);
-
- rv = cr->RegisterFactory(sFtpComps.mCID,
- sFtpComps.mDescription,
- sFtpComps.mContractID,
- ftpFactory);
- NS_ENSURE_SUCCESS (rv, FALSE);
-
- ftpRegistered = PR_TRUE;
-
- return TRUE;
-}
-
-/**
- * mozilla_unregister_FtpProtocolHandler: Unregister Ftp Protocol Handler
- */
-gboolean
-mozilla_unregister_FtpProtocolHandler (void)
-{
- if (ftpRegistered == PR_FALSE) return FALSE;
-
- nsresult rv;
- nsCOMPtr<nsIComponentRegistrar> cr;
- NS_GetComponentRegistrar(getter_AddRefs(cr));
- NS_ENSURE_TRUE (cr, FALSE);
-
- rv = cr->RegisterFactory(knsFtpProtocolHandlerCID,
- NS_FTPPROTOCOLHANDLER_CLASSNAME,
- G_FTP_PROTOCOL_CONTRACTID,
- nsFtpFactory);
- NS_ENSURE_SUCCESS (rv, FALSE);
-
- ftpRegistered = PR_FALSE;
-
- return TRUE;
-}
diff --git a/embed/mozilla/MozRegisterComponents.h b/embed/mozilla/MozRegisterComponents.h
index 1e4730c40..81c7617f1 100644
--- a/embed/mozilla/MozRegisterComponents.h
+++ b/embed/mozilla/MozRegisterComponents.h
@@ -14,6 +14,8 @@
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * $Id$
*/
#ifndef MOZREGISTERCOMPONENTS_H
@@ -21,10 +23,4 @@
gboolean mozilla_register_components (void);
-gboolean mozilla_register_FtpProtocolHandler (void);
-
-gboolean mozilla_unregister_FtpProtocolHandler (void);
-
-gboolean mozilla_register_MailtoProtocolHandler (void);
-
-#endif // MOZREGISTERCOMPONENTS_H
+#endif /* MOZREGISTERCOMPONENTS_H */
diff --git a/embed/mozilla/mozilla-embed-single.cpp b/embed/mozilla/mozilla-embed-single.cpp
index 055f5ff80..ed93b4564 100644
--- a/embed/mozilla/mozilla-embed-single.cpp
+++ b/embed/mozilla/mozilla-embed-single.cpp
@@ -1,4 +1,4 @@
-/*
+/* vim:set ts=8 noet sw=8:
* Copyright (C) 2000-2003 Marco Pesenti Gritti
* Copyright (C) 2003 Christian Persch
*
@@ -104,6 +104,7 @@ static void ephy_cookie_manager_iface_init (EphyCookieManagerIface *iface);
static void ephy_password_manager_iface_init (EphyPasswordManagerIface *iface);
static void ephy_permission_manager_iface_init (EphyPermissionManagerIface *iface);
static void mozilla_embed_single_init (MozillaEmbedSingle *ges);
+static gboolean have_gnome_url_handler (const gchar *protocol);
static GObjectClass *parent_class = NULL;
@@ -220,6 +221,19 @@ mozilla_set_default_prefs (MozillaEmbedSingle *mes)
pref->SetCharPref ("general.useragent.vendor", "Epiphany");
pref->SetCharPref ("general.useragent.vendorSub", VERSION);
+ /* Make sure that Mozilla does not handle these protocols internally */
+ pref->SetBoolPref("network.protocol-handler.external.news", TRUE);
+ pref->SetBoolPref("network.protocol-handler.external.mailto", TRUE);
+ pref->SetBoolPref("network.protocol-handler.external.irc", TRUE);
+ if (have_gnome_url_handler ("ftp"))
+ {
+ pref->SetBoolPref("network.protocol-handler.external.ftp", TRUE);
+ }
+ else
+ {
+ pref->SetBoolPref("network.protocol-handler.external.ftp", FALSE);
+ }
+
return TRUE;
}
@@ -359,20 +373,6 @@ have_gnome_url_handler (const gchar *protocol)
return rv;
}
-static void
-mozilla_register_external_protocols (void)
-{
- /* FIXME register only when needed */
- if (have_gnome_url_handler ("ftp"))
- {
- mozilla_register_FtpProtocolHandler ();
- }
- else
- {
- mozilla_unregister_FtpProtocolHandler ();
- }
-}
-
static nsresult
getUILang (nsAString& aUILang)
{
@@ -467,8 +467,6 @@ init_services (MozillaEmbedSingle *single)
mozilla_register_components ();
- mozilla_register_external_protocols ();
-
mozilla_init_observer (single);
return TRUE;